Git development
 help / color / mirror / Atom feed
* Re: git-svn branch naming question
From: Björn Steinbrink @ 2007-12-09  2:13 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Peter Baumann, git
In-Reply-To: <20071209020510.GM3199@genesis.frugalware.org>

On 2007.12.09 03:05:10 +0100, Miklos Vajna wrote:
> On Sun, Dec 09, 2007 at 12:52:48AM +0100, Miklos Vajna <vmiklos@frugalware.org> wrote:
> > >   [svn-remote "svn"]
> > >         url = https://url/to/your/svn/repo
> > >         fetch = trunk:refs/heads/trunk
                                 ^^^^^
> > >         branches = branches/*:refs/heads/*
                                         ^^^^^
> > >         tags = tags/*:refs/heads/tags/*
                                 ^^^^^

>         url = svn+ssh://vmiklos@svn.gnome.org/svn/ooo-build
>         fetch = trunk:refs/master
>         branches = branches/*:refs/*
>         tags = tags/*:refs/tags/*

Just a guess, but this seems pretty headless ;-)

Björn

> and wanted to fetch the revisions, but actually
> 
> $ git svn fetch
> 
> does not fetch any revisions. (yes, it does once i put back the
> "remotes" prefix). is this a bug? :)
> 
> thanks,
> - VMiklos

^ permalink raw reply

* Re: Where has "git ls-remote" reference pattern matching gone?
From: Daniel Barkalow @ 2007-12-09  2:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Eyvind Bernhardsen, git
In-Reply-To: <7vve78tzw1.fsf@gitster.siamese.dyndns.org>

On Sat, 8 Dec 2007, Junio C Hamano wrote:

> Eyvind Bernhardsen <eyvind-git@orakel.ntnu.no> writes:
> 
> > ls-remote was recently made a builtin; was reference filtering
> > deliberately removed, or was it just lost in translation from the
> > shell script?
> 
> I suspect that to be the case.  Daniel, I think this is yours.

Ah, sure enough. I didn't see that feature there, I guess. Am I right that 
it's supposed to have "git ls-remote origin db/*" return refs of the 
form "*/db/*", interpreted as for globs?

Eyvind: can I get a test case? I haven't ever used this feature, and I'm 
not sure I'll implement it correctly.

	-Daniel
*This .sig left intentionally blank*

^ permalink raw reply

* What does this error mean?
From: Bo Yang @ 2007-12-09  2:24 UTC (permalink / raw)
  To: git

Hi,
   I run git pull to pull the recent changes from my http repository. 
And get the error:

Fetching refs/heads/master from http://nkbbs.org/git/mozilla.git using http
walk 5b082f95aa62e032e6bf9e7b4a72d41dcdc209b4
walk 90d82d12ee4a9ab400df9f34f0bfddee14420bf8
walk 1ad49fd5be35acaa572a76ab12d05d297414a9fe
error: Could not read 56edc89ce300e654c7b76c0c421a7a1ee0aaf958
Waiting for 
http://nkbbs.org/git/mozilla.git/objects/9d/b3e42472d01b8e3587a3e4a375e8f368483a81
Getting alternates list for http://nkbbs.org/git/mozilla.git
Waiting for 
http://nkbbs.org/git/mozilla.git/objects/e5/ea160617bcffcb6262a8d8f838ada80b090670
Waiting for 
http://nkbbs.org/git/mozilla.git/objects/e7/7681194544ca87e2bc42bffc21616679410fec
Waiting for 
http://nkbbs.org/git/mozilla.git/objects/48/7cf54d6429467a4e2c2c1eb3608c710e6d9d4f
Waiting for 
http://nkbbs.org/git/mozilla.git/objects/ef/68bd85ca219b1042abd49417571de016b10d05

Could you please tell me that what does this mean and how can I deal 
with this? Thanks!

Regards!
Bo

^ permalink raw reply

* Re: git-svn branch naming question
From: Miklos Vajna @ 2007-12-09  2:25 UTC (permalink / raw)
  To: Björn Steinbrink; +Cc: Peter Baumann, git
In-Reply-To: <20071209021336.GA8327@atjola.homenet>

[-- Attachment #1: Type: text/plain, Size: 649 bytes --]

On Sun, Dec 09, 2007 at 03:13:36AM +0100, Björn Steinbrink <B.Steinbrink@gmx.de> wrote:
> >         url = svn+ssh://vmiklos@svn.gnome.org/svn/ooo-build
> >         fetch = trunk:refs/master
> >         branches = branches/*:refs/*
> >         tags = tags/*:refs/tags/*
> 
> Just a guess, but this seems pretty headless ;-)

oh, right. here is my fixed config:

[svn-remote "svn"]
        url = svn+ssh://vmiklos@svn.gnome.org/svn/ooo-build
        fetch = trunk:refs/heads/master
        branches = branches/*:refs/heads/*
        tags = tags/*:refs/tags/*

git svn fetch still does not seem to do anything :S

thanks,
- VMiklos

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: git-svn branch naming question
From: Eric Wong @ 2007-12-09  2:26 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Peter Baumann, git
In-Reply-To: <20071209020510.GM3199@genesis.frugalware.org>

Miklos Vajna <vmiklos@frugalware.org> wrote:
> On Sun, Dec 09, 2007 at 12:52:48AM +0100, Miklos Vajna <vmiklos@frugalware.org> wrote:
> > >   [svn-remote "svn"]
> > >         url = https://url/to/your/svn/repo
> > >         fetch = trunk:refs/heads/trunk
> > >         branches = branches/*:refs/heads/*
> > >         tags = tags/*:refs/heads/tags/*
> > > 
> > > but I advice you to not do this. refs/remotes has a special meaning in git,
> > > e.g.  you can't commit directly to it (which makes sense, because it only
> > > tracks the state of the remote repo. On the other hand remote branches won't
> > > get cloned per default.)
> > 
> > yes, that's exactly what i want to do - in case the target is to convert
> > an svn repo to a git one (and i need git-svn since git-svnimport is to
> > be removed in 1.5.4)
> 
> hm, this seem to be not-working for me.
> 
> after "git svn init -s url" i edited the config:
> 
> $ cat .git/config
> [core]
>         repositoryformatversion = 0
>         filemode = true
>         bare = false
>         logallrefupdates = true
> [svn-remote "svn"]
>         url = svn+ssh://vmiklos@svn.gnome.org/svn/ooo-build
>         fetch = trunk:refs/master
>         branches = branches/*:refs/*
>         tags = tags/*:refs/tags/*
> 
> and wanted to fetch the revisions, but actually
> 
> $ git svn fetch
> 
> does not fetch any revisions. (yes, it does once i put back the
> "remotes" prefix). is this a bug? :)

I'm not sure if it's considered a "bug", but that's just the
way it is at the moment.  I can't remember why, but I did
make git-svn force the presence of the "remotes/" prefix
in all refs it writes to...

-- 
Eric Wong

^ permalink raw reply

* [PATCH] Restore ls-remote reference pattern matching
From: Daniel Barkalow @ 2007-12-09  2:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Eyvind Bernhardsen

I entirely missed that "git ls-remote <repo> <ref-pattern>..." is
supposed to work. This restores it.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
How's this? I vaguely tested it, and it doesn't break existing tests, and 
it matches my guess at how the old code worked, at least maybe.

 builtin-ls-remote.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/builtin-ls-remote.c b/builtin-ls-remote.c
index 56f3f88..f8669ce 100644
--- a/builtin-ls-remote.c
+++ b/builtin-ls-remote.c
@@ -17,6 +17,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 	struct remote *remote;
 	struct transport *transport;
 	const struct ref *ref;
+	const char **refpathspec = NULL;
 
 	setup_git_directory_gently(&nongit);
 
@@ -50,9 +51,12 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 		break;
 	}
 
-	if (!dest || i != argc - 1)
+	if (!dest)
 		usage(ls_remote_usage);
 
+	if (argc > i + 1)
+		refpathspec = get_pathspec("*", argv + i);
+
 	remote = nongit ? NULL : remote_get(dest);
 	if (remote && !remote->url_nr)
 		die("remote %s has no configured URL", dest);
@@ -66,7 +70,9 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 		return 1;
 
 	while (ref) {
-		if (check_ref_type(ref, flags))
+		if (check_ref_type(ref, flags) && 
+		    (!refpathspec || 
+		     pathspec_match(refpathspec, NULL, ref->name, 0)))
 			printf("%s	%s\n", sha1_to_hex(ref->old_sha1), ref->name);
 		ref = ref->next;
 	}
-- 
1.5.3.6.886.gb204

^ permalink raw reply related

* Re: git-svn branch naming question
From: Miklos Vajna @ 2007-12-09  2:36 UTC (permalink / raw)
  To: Eric Wong; +Cc: Peter Baumann, git
In-Reply-To: <20071209022624.GA31033@soma>

[-- Attachment #1: Type: text/plain, Size: 649 bytes --]

On Sat, Dec 08, 2007 at 06:26:24PM -0800, Eric Wong <normalperson@yhbt.net> wrote:
> I'm not sure if it's considered a "bug", but that's just the
> way it is at the moment.  I can't remember why, but I did
> make git-svn force the presence of the "remotes/" prefix
> in all refs it writes to...

okay, i see. one problem: git-svnimport is to be removed and (afaik) the
supposed way is to use git-svn instead. what is the supposed way to use
git-svn to convert an svn repo to a git one if the method i tried is not
working?

(if the branches are fetched to "remotes/" then they won't be visible
when one clones the converted repo)

thanks,
- VMiklos

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] Restore ls-remote reference pattern matching
From: Junio C Hamano @ 2007-12-09  3:22 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: git, Eyvind Bernhardsen
In-Reply-To: <Pine.LNX.4.64.0712082134350.5349@iabervon.org>

Daniel Barkalow <barkalow@iabervon.org> writes:

> How's this? I vaguely tested it, and it doesn't break existing tests, and 
> it matches my guess at how the old code worked, at least maybe.

Well, contrib/examples/git-ls-remote.sh is your friend and you do not
have to "guess".

It did, for each ref $path it got from peek-remote, this:

		for pat
		do
			case "/$path" in
			*/$pat )
				match=yes
				break ;;
			esac
		done

I do not think pathspec_match() matches the string in a way compatible
with the above loop, and calling get_pathspec(prefix, argv) with
anything but a real path is a misuse of the interface.

I think if you do fnmatch(3) that would be compatible with the shell
loop.

^ permalink raw reply

* Re: git-svn branch naming question
From: Eric Wong @ 2007-12-09  3:26 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Peter Baumann, git
In-Reply-To: <20071209023600.GP3199@genesis.frugalware.org>

Miklos Vajna <vmiklos@frugalware.org> wrote:
> On Sat, Dec 08, 2007 at 06:26:24PM -0800, Eric Wong <normalperson@yhbt.net> wrote:
> > I'm not sure if it's considered a "bug", but that's just the
> > way it is at the moment.  I can't remember why, but I did
> > make git-svn force the presence of the "remotes/" prefix
> > in all refs it writes to...
> 
> okay, i see. one problem: git-svnimport is to be removed and (afaik) the
> supposed way is to use git-svn instead. what is the supposed way to use
> git-svn to convert an svn repo to a git one if the method i tried is not
> working?
> 
> (if the branches are fetched to "remotes/" then they won't be visible
> when one clones the converted repo)

I'm pretty sure the reasoning behind "remotes/" being forced by git-svn
was to prevent users from shooting themselves in the foot, since
committing to those remote refs will break both git-svn fetch and
dcommit...

Heck, the entire "remotes/" idea started because a git-svn user made the
mistake of committing to the remote tracking branch directly:

  http://thread.gmane.org/gmane.comp.version-control.git/16869/focus=16875

I'll consider accepting a patch to lift that restriction (but still use
the "remotes/" by default, of course).


Also, it's possible to fetch them after editing .git/config a little:

  Harvey Harrison's "[RFC] Mirroring svn" post has a good example
  on how to do it.

  http://mid.gmane.org/1196922153.10408.101.camel@brick

Perhaps git-clone could gain the ability to clone refs/remotes/ as-is
without an extra step?

-- 
Eric Wong

^ permalink raw reply

* Re: [PATCH] gitweb: Teach "a=blob" action to be more lenient about blob/file mime type
From: Junio C Hamano @ 2007-12-09  3:34 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <1197114913-15626-1-git-send-email-jnareb@gmail.com>

Jakub Narebski <jnareb@gmail.com> writes:

> Since 930cf7dd7cc6b87d173f182230763e1f1913d319 'blob' action knows the
> file type; if the file type is not "text/*" or one of common network
> image formats/mimetypes (gif, png, jpeg) then the action "blob"
> defaulted to "blob_plain".  This caused the problem if mimetypes file
> was not well suited for web, for example returning "application/x-sh"
> for "*.sh" shell scripts, instead of "text/plain" (or other "text/*").
>
> Now "blob" action defaults to "blob_plain" ('raw' view) only if file
> is of type which is neither "text/*" nor "image/{gif,png,jpeg}"
> AND it is binary file.  Otherwise it assumes that it can be displayed
> either in <img> tag ("image/*" mimetype), or can be displayed line by
> line (otherwise).

Ok, the intent sounds sane.  Let's see if the implementation is also
sane.

> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index eac7e16..b833327 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -4302,7 +4302,7 @@ sub git_blob {
>  	open my $fd, "-|", git_cmd(), "cat-file", "blob", $hash
>  		or die_error(undef, "Couldn't cat $file_name, $hash");
>  	my $mimetype = blob_mimetype($fd, $file_name);
> -	if ($mimetype !~ m!^(?:text/|image/(?:gif|png|jpeg)$)!) {
> +	if ($mimetype !~ m!^(?:text/|image/(?:gif|png|jpeg)$)! && -B $fd) {
>  		close $fd;
>  		return git_blob_plain($mimetype);
>  	}

"If not text or image and binary go blob_plain" -- Ok.

> @@ -4343,16 +4343,7 @@ sub git_blob {
>  	}
>  	git_print_page_path($file_name, "blob", $hash_base);
>  	print "<div class=\"page_body\">\n";
> +	if ($mimetype =~ m!^image/!) {
>  		print qq!<img type="$mimetype"!;
>  		if ($file_name) {
>  			print qq! alt="$file_name" title="$file_name"!;
> @@ -4361,7 +4352,16 @@ sub git_blob {
>  		      href(action=>"blob_plain", hash=>$hash,
>  		           hash_base=>$hash_base, file_name=>$file_name) .
>  		      qq!" />\n!;
> +	} else {
> +		my $nr;
> +		while (my $line = <$fd>) {
> +			chomp $line;
> +			$nr++;
> +			$line = untabify($line);
> +			printf "<div class=\"pre\"><a id=\"l%i\" href=\"#l%i\" class=\"linenr\">%4i</a> %s</div>\n",
> +			       $nr, $nr, $nr, esc_html($line, -nbsp=>1);
> +		}
> +	} els

"If image, do image, but otherwise show line-by-line" -- Ok.

There is a "Huh?" on the last line, though.

> P.S. BTW is there some plumbing for scripts to help with
> gitattributes, for example showing all gitattributes (or status of
> selected attributes) for given path?

$ git grep gitattributes Documentation | grep -i display

^ permalink raw reply

* Re: [PATCH] Restore ls-remote reference pattern matching
From: Daniel Barkalow @ 2007-12-09  5:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Eyvind Bernhardsen
In-Reply-To: <7vodd0tuuu.fsf@gitster.siamese.dyndns.org>

On Sat, 8 Dec 2007, Junio C Hamano wrote:

> Daniel Barkalow <barkalow@iabervon.org> writes:
> 
> > How's this? I vaguely tested it, and it doesn't break existing tests, and 
> > it matches my guess at how the old code worked, at least maybe.
> 
> Well, contrib/examples/git-ls-remote.sh is your friend and you do not
> have to "guess".
> 
> It did, for each ref $path it got from peek-remote, this:
> 
> 		for pat
> 		do
> 			case "/$path" in
> 			*/$pat )
> 				match=yes
> 				break ;;
> 			esac
> 		done
> 
> I do not think pathspec_match() matches the string in a way compatible
> with the above loop, and calling get_pathspec(prefix, argv) with
> anything but a real path is a misuse of the interface.

I'd found the same code ("git log -p -- git-ls-remote.sh" also reveals it, 
and I couldn't remember it's contrib/examples that things end up in), but 
I don't really follow that shell syntax.

> I think if you do fnmatch(3) that would be compatible with the shell
> loop.

Maybe:
--- cut here ---
I entirely missed that "git ls-remote <repo> <ref-pattern>..." is
supposed to work. This restores it.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
This matches git-name-rev --refs=<ref-pattern>, anyway, which is the 
closest example I could find. If this isn't the desired behavior, it's 
probably easier to just edit this instead of trying to explain the right 
thing to me.

 builtin-ls-remote.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/builtin-ls-remote.c b/builtin-ls-remote.c
index 56f3f88..d936c28 100644
--- a/builtin-ls-remote.c
+++ b/builtin-ls-remote.c
@@ -17,6 +17,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 	struct remote *remote;
 	struct transport *transport;
 	const struct ref *ref;
+	const char **refpatterns = NULL;
 
 	setup_git_directory_gently(&nongit);
 
@@ -50,9 +51,12 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 		break;
 	}
 
-	if (!dest || i != argc - 1)
+	if (!dest)
 		usage(ls_remote_usage);
 
+	if (argc > i + 1)
+		refpatterns = argv + i;
+
 	remote = nongit ? NULL : remote_get(dest);
 	if (remote && !remote->url_nr)
 		die("remote %s has no configured URL", dest);
@@ -66,8 +70,18 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 		return 1;
 
 	while (ref) {
-		if (check_ref_type(ref, flags))
-			printf("%s	%s\n", sha1_to_hex(ref->old_sha1), ref->name);
+		if (check_ref_type(ref, flags)) {
+			int match = 0;
+			if (refpatterns) {
+				for (i = 0; refpatterns[i]; i++) {
+					if (!fnmatch(refpatterns[i], ref->name, 0))
+						match = 1;
+				}
+			} else
+				match = 1;
+			if (match)
+				printf("%s	%s\n", sha1_to_hex(ref->old_sha1), ref->name);
+		}
 		ref = ref->next;
 	}
 	return 0;
-- 
1.5.3.6.886.gb204

^ permalink raw reply related

* Re: git-svn branch naming question
From: Harvey Harrison @ 2007-12-09  5:16 UTC (permalink / raw)
  To: Eric Wong; +Cc: Miklos Vajna, Peter Baumann, git
In-Reply-To: <20071209032608.GB31033@soma>

On Sat, 2007-12-08 at 19:26 -0800, Eric Wong wrote:

> 
> Perhaps git-clone could gain the ability to clone refs/remotes/ as-is
> without an extra step?
> 

Something in the spirit of --mirror perhaps?  

--mirror-remotes sounds about right

Harvey

^ permalink raw reply

* git-bisect run make -j64 kernel/ (was Re: git-bisect feature suggestion: "git-bisect diff")
From: Christian Couder @ 2007-12-09  5:33 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: git, Junio C Hamano
In-Reply-To: <20071208152922.GB30270@elte.hu>

[-- Attachment #1: Type: text/plain, Size: 6388 bytes --]

Le samedi 8 décembre 2007, Ingo Molnar a écrit :
> Currently, in the Linux kernel, if i do this:
>
>  $ git-bisect run make -j64 kernel/
>
> it fails with:
>
>  running make -j64 kernel/
>    CHK     include/linux/version.h
>    CHK     include/linux/utsrelease.h
>    CALL    scripts/checksyscalls.sh
>  bisect run failed:
>  bisect_good exited with error code 1
>
> although the command "make -j64 kernel/" returns with 0.
>
> i have to write a script around "make -j64 kernel/" to get this to work
> - it would be nice to have this "out of box".

It seems to work for me. After creating a .config, I did:

$ git bisect good v2.6.23
$ git bisect bad HEAD
$ git bisect run make -j64 kernel/

Then I had to answer some configuration questions (I hit <enter>  everytime) 
but it run fine.

My git version is:

git version 1.5.3.7.2200.g9275-dirty

I attached the log (from git bisect log) and here is the end of the 
bisection:


Bisecting: 74 revisions left to test after this
[09f3eca2b7e2762e223fdd359f9d0f6303a85f6c] Merge branch 'for-2.6.24' of 
git://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc
running make -j64 kernel/
scripts/kconfig/conf -s arch/x86/Kconfig
#
# configuration written to .config
#
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CC      arch/x86/kernel/asm-offsets.s
  GEN     include/asm-x86/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CC      kernel/sched.o
  CC      kernel/fork.o
  CC      kernel/panic.o
  CC      kernel/printk.o
  CC      kernel/profile.o
  CC      kernel/exec_domain.o
  CC      kernel/exit.o
  CC      kernel/itimer.o
  CC      kernel/time.o
  CC      kernel/softirq.o
  CC      kernel/resource.o
  CC      kernel/sysctl.o
  CC      kernel/capability.o
  CC      kernel/ptrace.o
  CC      kernel/timer.o
  CC      kernel/user.o
  CC      kernel/signal.o
  CC      kernel/sys.o
  CC      kernel/kmod.o
  CC      kernel/user_namespace.o
  CC      kernel/pid.o
  CC      kernel/rcupdate.o
  CC      kernel/workqueue.o
  CC      kernel/params.o
  CC      kernel/posix-timers.o
  CC      kernel/kthread.o
  CC      kernel/kfifo.o
  CC      kernel/posix-cpu-timers.o
  CC      kernel/mutex.o
  CC      kernel/hrtimer.o
  CC      kernel/rwsem.o
  CC      kernel/latency.o
  CC      kernel/nsproxy.o
  CC      kernel/extable.o
  CC      kernel/wait.o
  CC      kernel/utsname.o
  CC      kernel/notifier.o
  CC      kernel/sysctl_check.o
  CC      kernel/futex.o
  CC      kernel/srcu.o
  CC      kernel/irq/handle.o
  CC      kernel/power/main.o
  CC      kernel/power/pm.o
  CC      kernel/time/timekeeping.o
  CC      kernel/power/process.o
  CC      kernel/irq/manage.o
  CC      kernel/time/ntp.o
  CC      kernel/irq/spurious.o
  CC      kernel/time/jiffies.o
  CC      kernel/time/clockevents.o
  CC      kernel/time/timer_list.o
  CC      kernel/time/tick-common.o
  CC      kernel/rtmutex.o
  CC      kernel/dma.o
  CC      kernel/cpu.o
  CC      kernel/power/console.o
  CC      kernel/irq/resend.o
  CC      kernel/power/poweroff.o
  CC      kernel/irq/chip.o
  CC      kernel/irq/devres.o
  CC      kernel/time/clocksource.o
  CC      kernel/time/tick-broadcast.o
  CC      kernel/irq/proc.o
  CC      kernel/irq/autoprobe.o
  CC      kernel/irq/migration.o
  CC      kernel/uid16.o
  CC      kernel/spinlock.o
  CC      kernel/module.o
  CC      kernel/acct.o
  CC      kernel/kexec.o
  CC      kernel/stop_machine.o
  CC      kernel/kallsyms.o
  CC      kernel/audit.o
  CC      kernel/auditfilter.o
  CC      kernel/ksysfs.o
kernel/power/pm.c:205: warning: 'pm_register' is deprecated (declared at 
kernel/power/pm.c:64)
kernel/power/pm.c:205: warning: 'pm_register' is deprecated (declared at 
kernel/power/pm.c:64)
kernel/power/pm.c:206: warning: 'pm_send_all' is deprecated (declared at 
kernel/power/pm.c:180)
kernel/power/pm.c:206: warning: 'pm_send_all' is deprecated (declared at 
kernel/power/pm.c:180)
  CC      kernel/utsname_sysctl.o
  LD      kernel/power/built-in.o
  LD      kernel/irq/built-in.o
  LD      kernel/time/built-in.o
  LD      kernel/built-in.o
Bisecting: 38 revisions left to test after this
[e17587b5b90da78f56c7a948e54dbac3dc791f31] Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6
running make -j64 kernel/
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
Bisecting: 17 revisions left to test after this
[c32bc6e9b0778c891f7f3b97cd05c8cdf98b6721] e1000: fix memcpy in 
e1000_get_strings
running make -j64 kernel/
scripts/kconfig/conf -s arch/x86/Kconfig
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CC      kernel/sched.o
  CC      kernel/hrtimer.o
  CC      kernel/time/clockevents.o
  LD      kernel/time/built-in.o
  LD      kernel/built-in.o
Bisecting: 8 revisions left to test after this
[4696c3c406a8b32112f8e1f70b3db1114950dcb1] ibm_newemac: Correct opb_bus_freq 
value
running make -j64 kernel/
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
Bisecting: 4 revisions left to test after this
[7962024e9d16e9349d76b553326f3fa7be64305e] S2io: Check for register 
initialization completion before accesing device registers
running make -j64 kernel/
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
Bisecting: 2 revisions left to test after this
[d1aa690a7d1afa673c3383bfcd6e96ddb350939a] ata_piix: add Toshiba Tecra M4 to 
broken suspend list
running make -j64 kernel/
scripts/kconfig/conf -s arch/x86/Kconfig
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
Bisecting: 1 revisions left to test after this
[459ad68893a84fb0881e57919340b97edbbc3dc7] libata: kill spurious NCQ 
completion detection
running make -j64 kernel/
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
94545baded0bfbabdc30a3a4cb48b3db479dd6ef is first bad commit
bisect run success

It found the HEAD as the first bad commit as expected, because I had no 
compilation error.

Christian.





[-- Attachment #2: make_j64_kernel_bisect.log --]
[-- Type: text/x-log, Size: 2576 bytes --]

git-bisect start
# good: [bbf25010f1a6b761914430f5fca081ec8c7accd1] Linux 2.6.23
git-bisect good bbf25010f1a6b761914430f5fca081ec8c7accd1
# bad: [94545baded0bfbabdc30a3a4cb48b3db479dd6ef] Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
git-bisect bad 94545baded0bfbabdc30a3a4cb48b3db479dd6ef
# good: [92d15c2ccbb3e31a3fc71ad28fdb55e1319383c0] Merge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block
git-bisect good 92d15c2ccbb3e31a3fc71ad28fdb55e1319383c0
# good: [c09b360a2b0779e08bacb88d3fcd8458ebc49658] Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
git-bisect good c09b360a2b0779e08bacb88d3fcd8458ebc49658
# good: [6fa02839bf9412e18e773d04e96182b4cd0b5d57] nfsd4: recheck for secure ports in fh_verify
git-bisect good 6fa02839bf9412e18e773d04e96182b4cd0b5d57
# good: [b5faa4b89e4d83203b1f44f143a351b518f7cda2] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/blackfin-2.6
git-bisect good b5faa4b89e4d83203b1f44f143a351b518f7cda2
# good: [c99da91e7a12724127475a85cc7a38214b3504e2] Merge branch 'master' into upstream-fixes
git-bisect good c99da91e7a12724127475a85cc7a38214b3504e2
# good: [131b17d42de6194fa960132c1f62c29923c4f20c] spi: initial BF54x SPI support
git-bisect good 131b17d42de6194fa960132c1f62c29923c4f20c
# good: [09f3eca2b7e2762e223fdd359f9d0f6303a85f6c] Merge branch 'for-2.6.24' of git://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc
git-bisect good 09f3eca2b7e2762e223fdd359f9d0f6303a85f6c
# good: [e17587b5b90da78f56c7a948e54dbac3dc791f31] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6
git-bisect good e17587b5b90da78f56c7a948e54dbac3dc791f31
# good: [c32bc6e9b0778c891f7f3b97cd05c8cdf98b6721] e1000: fix memcpy in e1000_get_strings
git-bisect good c32bc6e9b0778c891f7f3b97cd05c8cdf98b6721
# good: [4696c3c406a8b32112f8e1f70b3db1114950dcb1] ibm_newemac: Correct opb_bus_freq value
git-bisect good 4696c3c406a8b32112f8e1f70b3db1114950dcb1
# good: [7962024e9d16e9349d76b553326f3fa7be64305e] S2io: Check for register initialization completion before accesing device registers
git-bisect good 7962024e9d16e9349d76b553326f3fa7be64305e
# good: [d1aa690a7d1afa673c3383bfcd6e96ddb350939a] ata_piix: add Toshiba Tecra M4 to broken suspend list
git-bisect good d1aa690a7d1afa673c3383bfcd6e96ddb350939a
# good: [459ad68893a84fb0881e57919340b97edbbc3dc7] libata: kill spurious NCQ completion detection
git-bisect good 459ad68893a84fb0881e57919340b97edbbc3dc7

^ permalink raw reply

* How-to combine several separate git repos?
From: Wink Saville @ 2007-12-09  6:34 UTC (permalink / raw)
  To: git

I've got several git repositories of different projects and was thinking
I should combine into one repository, but my googling around didn't turn up
any simple way of doing it.

Any advice?

Wink Saville

^ permalink raw reply

* Re: [PATCH] Restore ls-remote reference pattern matching
From: Junio C Hamano @ 2007-12-09  6:51 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: git, Eyvind Bernhardsen
In-Reply-To: <Pine.LNX.4.64.0712082346310.5349@iabervon.org>

Daniel Barkalow <barkalow@iabervon.org> writes:

> I'd found the same code ("git log -p -- git-ls-remote.sh" also reveals it, 
> and I couldn't remember it's contrib/examples that things end up in), but 
> I don't really follow that shell syntax.

Sorry, I should have been more explicit.

At this point in the scripted version:

	for pat
	do
		case "/$path" in
		*/$pat )
			match=yes
			break ;;
		esac
	done

 - $path is what we read from peek-remote (or the equivalent from curl
   for http), e.g. "refs/heads/master", or "HEAD".

 - we iterate over remainder of arguments to the script, assigning each
   to $pat;

 - we check if the pattern "*/$pat" matches "/$path".  "case" matching
   rule is an entire string match with globbing, so it is asking if
   /$path ends with /$pat.  IOW, $pat="master" matches:

	$path=refs/heads/master
        $path=refs/remotes/origin/master

   but it does not match $path="refs/heads/omaster".

---

 builtin-ls-remote.c |   44 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/builtin-ls-remote.c b/builtin-ls-remote.c
index 56f3f88..bae7c48 100644
--- a/builtin-ls-remote.c
+++ b/builtin-ls-remote.c
@@ -6,6 +6,35 @@
 static const char ls_remote_usage[] =
 "git-ls-remote [--upload-pack=<git-upload-pack>] [<host>:]<directory>";
 
+/*
+ * pattern is a list of tail-part of accepted refnames.  Is there one
+ * among then that is a suffix of the path?  Directory boundary must
+ * be honored when doing this match.  IOW, patterns "master" and
+ * "sa/master" both match path "refs/hold/sa/master".  On the other
+ * hand, path "refs/hold/foosa/master" is matched by "master" but not
+ * by "sa/master".
+ */
+
+static int tail_match(const char **pattern, const char *path)
+{
+	int pathlen;
+	const char *p;
+
+	if (!*pattern)
+		return 1; /* no restriction */
+
+	for (pathlen = strlen(path); (p = *pattern); pattern++) {
+		int pfxlen = pathlen - strlen(p);
+		if (pfxlen < 0)
+			continue; /* pattern is longer, will never match */
+		if (strcmp(path + pfxlen, p))
+			continue; /* no tail match */
+		if (!pfxlen || path[pfxlen - 1] == '/')
+			return 1; /* fully match at directory boundary */
+	}
+	return 0;
+}
+
 int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 {
 	int i;
@@ -13,6 +42,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 	int nongit = 0;
 	unsigned flags = 0;
 	const char *uploadpack = NULL;
+	const char **pattern = NULL;
 
 	struct remote *remote;
 	struct transport *transport;
@@ -50,9 +80,9 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 		break;
 	}
 
-	if (!dest || i != argc - 1)
+	if (!dest)
 		usage(ls_remote_usage);
-
+	pattern = argv + i + 1;
 	remote = nongit ? NULL : remote_get(dest);
 	if (remote && !remote->url_nr)
 		die("remote %s has no configured URL", dest);
@@ -65,10 +95,12 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 	if (!ref)
 		return 1;
 
-	while (ref) {
-		if (check_ref_type(ref, flags))
-			printf("%s	%s\n", sha1_to_hex(ref->old_sha1), ref->name);
-		ref = ref->next;
+	for ( ; ref; ref = ref->next) {
+		if (!check_ref_type(ref, flags))
+			continue;
+		if (!tail_match(pattern, ref->name))
+			continue;
+		printf("%s	%s\n", sha1_to_hex(ref->old_sha1), ref->name);
 	}
 	return 0;
 }

^ permalink raw reply related

* Re: [PATCH 3/3] Fix commit-msg hook to allow editing
From: Junio C Hamano @ 2007-12-09  7:21 UTC (permalink / raw)
  To: Wincent Colaiuta; +Cc: git, krh
In-Reply-To: <1197113889-16243-4-git-send-email-win@wincent.com>

Wincent Colaiuta <win@wincent.com> writes:

> The old git-commit.sh script allowed the commit-msg hook to not only
> prevent a commit from proceding, but also to edit the commit message
> on the fly and allow it to proceed. So here we teach builtin-commit
> to do the same.

This is a bit unfortunate.

> @@ -787,14 +787,18 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
>  		const char *env[2] = { index, NULL };
>  		snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
>  		launch_editor(git_path(commit_editmsg), &sb, env);

Here, launch-editor lets the user edit an external file, and reads it
back into &sb, but ...

>  	}
> +	if (!no_verify) {
> +		if (run_hook(index_file, "commit-msg", git_path(commit_editmsg))) {
> +			rollback_index_files();
> +			exit(1);
> +		}
> +		strbuf_setlen(&sb, header_len);
> +	}

we need to discard it (I would prefer setlen to be done before running
the hook, just to make the logic flow more natural), because we need to
read it back again anyway.  On the other hand, if we do not start the
editor, we used to read the contents before running the hook, which was
wrong, and the call to read the file is moved after, like this:

> +	if ((no_edit || !no_verify) &&
> +	    strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) {
>  		rollback_index_files();
> +		die("could not read commit message");
>  	}

which makes the logic to decide if we read the file back again
unnecessarily convoluted.  The reason why (no_edit || !no_verify) is
there is very closely tied to the fact that you happened to have already
read in the launch_editor() codepath but not yet in no_edit codepath.
This feels very error prone.

	Side note. an unrelated reason where this convolution comes from
	is the unfortunate naming of many options and double-negations
	they bring in.  A normal human being needs to read expressions
	like "if (!no_foo || no_foo)" three times before understanding
	what is being checked.

I would suggest doing the above differently.

 * Allow launch_editor() not to read back the edited result into strbuf
   at all (perhaps pass NULL to signal that), and make "if (!no_edit)"
   codepath use it;

 * The codeflow would become:

	if (!no_edit) {
		launch editor, in "no readback" mode;
	}
	if (!no_verify) {
        	run hook, let it interfere;
	}
	read the file to &sb, no matter what no_edit/no_verify says.

IOW, how about something like this?

---

 builtin-commit.c |    9 +++++----
 builtin-tag.c    |    2 ++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/builtin-commit.c b/builtin-commit.c
index 2032ca3..30a9deb 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -787,16 +787,17 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 		char index[PATH_MAX];
 		const char *env[2] = { index, NULL };
 		snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
-		launch_editor(git_path(commit_editmsg), &sb, env);
-	} else if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) {
-		rollback_index_files();
-		die("could not read commit message");
+		launch_editor(git_path(commit_editmsg), NULL, env);
 	}
 	if (!no_verify &&
 	    run_hook(index_file, "commit-msg", git_path(commit_editmsg))) {
 		rollback_index_files();
 		exit(1);
 	}
+	if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) {
+		rollback_index_files();
+		die("could not read commit message");
+	}
 
 	/* Truncate the message just before the diff, if any. */
 	p = strstr(sb.buf, "\ndiff --git a/");
diff --git a/builtin-tag.c b/builtin-tag.c
index 729389b..9f966fc 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -53,6 +53,8 @@ void launch_editor(const char *path, struct strbuf *buffer, const char *const *e
 			die("There was a problem with the editor %s.", editor);
 	}
 
+	if (!buffer)
+		return;
 	if (strbuf_read_file(buffer, path, 0) < 0)
 		die("could not read message file '%s': %s",
 		    path, strerror(errno));


                

^ permalink raw reply related

* [PATCH 0/2] [RFT] git-svn: more efficient revision -> commit mapping
From: Eric Wong @ 2007-12-09  7:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Eric Wong

This is very lightly tested, but describes the format I described in:

  http://article.gmane.org/gmane.comp.version-control.git/67126

  (more in the commit messages)

I'll be out of town the next few days and I'm not sure how much I'll be
able to follow up on it while I'm gone.  Please test, especially if
you're dealing with a repository where large .rev_db files are a
problem.

Junio: not intended for master just yet, but if you hear nothing but
good things about it, feel free :)

---
 git-svn.perl               |  323 ++++++++++++++++++++++++++++++--------------
 t/lib-git-svn.sh           |   26 ++++
 t/t9107-git-svn-migrate.sh |   16 ++-
 3 files changed, 258 insertions(+), 107 deletions(-)

-- 
Eric Wong

^ permalink raw reply

* [PATCH 1/2] git-svn: replace .rev_db with a more space-efficient .rev_map format
From: Eric Wong @ 2007-12-09  7:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Eric Wong
In-Reply-To: <1197185262-16765-1-git-send-email-normalperson@yhbt.net>

Migrations are done automatically on an as-needed basis when new
revisions are to be fetched.  Stale remote branches do not get
migrated, yet.

However, unless you set noMetadata or useSvkProps it's safe to
just do:

  find $GIT_DIR/svn -name '.rev_db*' -print0 | xargs rm -f

to purge all the old .rev_db files.

The new format is a one-way migration and is NOT compatible with
old versions of git-svn.

This is the replacement for the rev_db format, which was too big
and inefficient for large repositories with a lot of sparse history
(mainly tags).

The format is this:

  - 24 bytes for every record,
    * 4 bytes for the integer representing an SVN revision number
    * 20 bytes representing the sha1 of a git commit

  - No empty padding records like the old format

  - new records are written append-only since SVN revision numbers
    increase monotonically

  - lookups on SVN revision number are done via a binary search

  - Piping the file to xxd(1) -c24 is a good way of dumping it for
    viewing or editing, should the need ever arise.

As with .rev_db, these files are disposable unless noMetadata or
useSvmProps is set.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-svn.perl               |  286 ++++++++++++++++++++++++++++----------------
 t/lib-git-svn.sh           |   26 ++++
 t/t9107-git-svn-migrate.sh |   16 ++-
 3 files changed, 218 insertions(+), 110 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 9f884eb..b45c7e3 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -529,7 +529,7 @@ sub cmd_find_rev {
 			    "$head history\n";
 		}
 		my $desired_revision = substr($revision_or_hash, 1);
-		$result = $gs->rev_db_get($desired_revision);
+		$result = $gs->rev_map_get($desired_revision);
 	} else {
 		my (undef, $rev, undef) = cmt_metadata($revision_or_hash);
 		$result = $rev;
@@ -1128,12 +1128,12 @@ sub working_head_info {
 		if (defined $url && defined $rev) {
 			next if $max{$url} and $max{$url} < $rev;
 			if (my $gs = Git::SVN->find_by_url($url)) {
-				my $c = $gs->rev_db_get($rev);
+				my $c = $gs->rev_map_get($rev);
 				if ($c && $c eq $hash) {
 					close $fh; # break the pipe
 					return ($url, $rev, $uuid, $gs);
 				} else {
-					$max{$url} ||= $gs->rev_db_max;
+					$max{$url} ||= $gs->rev_map_max;
 				}
 			}
 		}
@@ -1234,6 +1234,8 @@ sub md5sum {
 package Git::SVN;
 use strict;
 use warnings;
+use Fcntl qw/:DEFAULT :seek/;
+use constant rev_map_fmt => 'NH40';
 use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent
             $_repack $_repack_flags $_use_svm_props $_head
             $_use_svnsync_props $no_reuse_existing $_minimize_url
@@ -1362,7 +1364,7 @@ sub fetch_all {
 	if ($fetch) {
 		foreach my $p (sort keys %$fetch) {
 			my $gs = Git::SVN->new($fetch->{$p}, $repo_id, $p);
-			my $lr = $gs->rev_db_max;
+			my $lr = $gs->rev_map_max;
 			if (defined $lr) {
 				$base = $lr if ($lr < $base);
 			}
@@ -1897,38 +1899,20 @@ sub last_rev_commit {
 			return ($rev, $c);
 		}
 	}
-	my $db_path = $self->db_path;
-	unless (-e $db_path) {
+	my $map_path = $self->map_path;
+	unless (-e $map_path) {
 		($self->{last_rev}, $self->{last_commit}) = (undef, undef);
 		return (undef, undef);
 	}
-	my $offset = -41; # from tail
-	my $rl;
-	open my $fh, '<', $db_path or croak "$db_path not readable: $!\n";
-	sysseek($fh, $offset, 2); # don't care for errors
-	sysread($fh, $rl, 41) == 41 or return (undef, undef);
-	chomp $rl;
-	while (('0' x40) eq $rl && sysseek($fh, 0, 1) != 0) {
-		$offset -= 41;
-		sysseek($fh, $offset, 2); # don't care for errors
-		sysread($fh, $rl, 41) == 41 or return (undef, undef);
-		chomp $rl;
-	}
-	if ($c && $c ne $rl) {
-		die "$db_path and ", $self->refname,
-		    " inconsistent!:\n$c != $rl\n";
-	}
-	my $rev = sysseek($fh, 0, 1) or croak $!;
-	$rev =  ($rev - 41) / 41;
-	close $fh or croak $!;
-	($self->{last_rev}, $self->{last_commit}) = ($rev, $c);
-	return ($rev, $c);
+	my ($rev, $commit) = $self->rev_map_max;
+	($self->{last_rev}, $self->{last_commit}) = ($rev, $commit);
+	return ($rev, $commit);
 }
 
 sub get_fetch_range {
 	my ($self, $min, $max) = @_;
 	$max ||= $self->ra->get_latest_revnum;
-	$min ||= $self->rev_db_max;
+	$min ||= $self->rev_map_max;
 	(++$min, $max);
 }
 
@@ -2073,7 +2057,7 @@ sub do_git_commit {
 		    " was r$lr, but we are about to fetch: ",
 		    "r$log_entry->{revision}!\n";
 	}
-	if (my $c = $self->rev_db_get($log_entry->{revision})) {
+	if (my $c = $self->rev_map_get($log_entry->{revision})) {
 		croak "$log_entry->{revision} = $c already exists! ",
 		      "Why are we refetching it?\n";
 	}
@@ -2116,14 +2100,14 @@ sub do_git_commit {
 		die "Failed to commit, invalid sha1: $commit\n";
 	}
 
-	$self->rev_db_set($log_entry->{revision}, $commit, 1);
+	$self->rev_map_set($log_entry->{revision}, $commit, 1);
 
 	$self->{last_rev} = $log_entry->{revision};
 	$self->{last_commit} = $commit;
 	print "r$log_entry->{revision}";
 	if (defined $log_entry->{svm_revision}) {
 		 print " (\@$log_entry->{svm_revision})";
-		 $self->rev_db_set($log_entry->{svm_revision}, $commit,
+		 $self->rev_map_set($log_entry->{svm_revision}, $commit,
 		                   0, $self->svm_uuid);
 	}
 	print " = $commit ($self->{ref_id})\n";
@@ -2465,25 +2449,44 @@ sub set_tree {
 	}
 }
 
+sub rebuild_from_rev_db {
+	my ($self, $path) = @_;
+	my $r = -1;
+	open my $fh, '<', $path or croak "open: $!";
+	while (<$fh>) {
+		length($_) == 41 or croak "inconsistent size in ($_) != 41";
+		chomp($_);
+		++$r;
+		next if $_ eq ('0' x 40);
+		$self->rev_map_set($r, $_);
+		print "r$r = $_\n";
+	}
+	close $fh or croak "close: $!";
+	unlink $path or croak "unlink: $!";
+}
+
 sub rebuild {
 	my ($self) = @_;
-	my $db_path = $self->db_path;
-	return if (-e $db_path && ! -z $db_path);
+	my $map_path = $self->map_path;
+	return if (-e $map_path && ! -z $map_path);
 	return unless ::verify_ref($self->refname.'^0');
-	if (-f $self->{db_root}) {
-		rename $self->{db_root}, $db_path or die
-		     "rename $self->{db_root} => $db_path failed: $!\n";
-		my ($dir, $base) = ($db_path =~ m#^(.*?)/?([^/]+)$#);
-		symlink $base, $self->{db_root} or die
-		     "symlink $base => $self->{db_root} failed: $!\n";
+	if ($self->use_svm_props || $self->no_metadata) {
+		my $rev_db = $self->rev_db_path;
+		$self->rebuild_from_rev_db($rev_db);
+		if ($self->use_svm_props) {
+			my $svm_rev_db = $self->rev_db_path($self->svm_uuid);
+			$self->rebuild_from_rev_db($svm_rev_db);
+		}
+		$self->unlink_rev_db_symlink;
 		return;
 	}
-	print "Rebuilding $db_path ...\n";
-	my ($log, $ctx) = command_output_pipe("log", '--no-color', $self->refname);
-	my $latest;
+	print "Rebuilding $map_path ...\n";
+	my ($log, $ctx) =
+	    command_output_pipe(qw/rev-list --pretty=raw --no-color --reverse/,
+	                        $self->refname, '--');
 	my $full_url = $self->full_url;
 	remove_username($full_url);
-	my $svn_uuid;
+	my $svn_uuid = $self->ra_uuid;
 	my $c;
 	while (<$log>) {
 		if ( m{^commit ($::sha1)$} ) {
@@ -2499,46 +2502,64 @@ sub rebuild {
 
 		# if we merged or otherwise started elsewhere, this is
 		# how we break out of it
-		if ((defined $svn_uuid && ($uuid ne $svn_uuid)) ||
+		if (($uuid ne $svn_uuid) ||
 		    ($full_url && $url && ($url ne $full_url))) {
 			next;
 		}
-		$latest ||= $rev;
-		$svn_uuid ||= $uuid;
 
-		$self->rev_db_set($rev, $c);
+		$self->rev_map_set($rev, $c);
 		print "r$rev = $c\n";
 	}
 	command_close_pipe($log, $ctx);
-	print "Done rebuilding $db_path\n";
+	print "Done rebuilding $map_path\n";
+	my $rev_db_path = $self->rev_db_path;
+	if (-f $self->rev_db_path) {
+		unlink $self->rev_db_path or croak "unlink: $!";
+	}
+	$self->unlink_rev_db_symlink;
 }
 
-# rev_db:
+# rev_map:
 # Tie::File seems to be prone to offset errors if revisions get sparse,
 # it's not that fast, either.  Tie::File is also not in Perl 5.6.  So
 # one of my favorite modules is out :<  Next up would be one of the DBM
-# modules, but I'm not sure which is most portable...  So I'll just
-# go with something that's plain-text, but still capable of
-# being randomly accessed.  So here's my ultra-simple fixed-width
-# database.  All records are 40 characters + "\n", so it's easy to seek
-# to a revision: (41 * rev) is the byte offset.
-# A record of 40 0s denotes an empty revision.
-# And yes, it's still pretty fast (faster than Tie::File).
+# modules, but I'm not sure which is most portable...
+#
+# This is the replacement for the rev_db format, which was too big
+# and inefficient for large repositories with a lot of sparse history
+# (mainly tags)
+#
+# The format is this:
+#   - 24 bytes for every record,
+#     * 4 bytes for the integer representing an SVN revision number
+#     * 20 bytes representing the sha1 of a git commit
+#   - No empty padding records like the old format
+#   - new records are written append-only since SVN revision numbers
+#     increase monotonically
+#   - lookups on SVN revision number are done via a binary search
+#   - Piping the file to xxd(1) -c24 is a good way of dumping it for
+#     viewing or editing, should the need ever arise.
+#
 # These files are disposable unless noMetadata or useSvmProps is set
 
-sub _rev_db_set {
+sub _rev_map_set {
 	my ($fh, $rev, $commit) = @_;
-	my $offset = $rev * 41;
-	# assume that append is the common case:
-	seek $fh, 0, 2 or croak $!;
-	my $pos = tell $fh;
-	if ($pos < $offset) {
-		for (1 .. (($offset - $pos) / 41)) {
-			print $fh (('0' x 40),"\n") or croak $!;
+
+	my $size = (stat($fh))[7];
+	($size % 24) == 0 or croak "inconsistent size: $size";
+
+	if ($size > 0) {
+		sysseek($fh, -24, SEEK_END) or croak "seek: $!";
+		my $read = sysread($fh, my $buf, 24) or croak "read: $!";
+		$read == 24 or croak "read only $read bytes (!= 24)";
+		my ($last_rev, $last_commit) = unpack(rev_map_fmt, $buf);
+		if ($last_rev >= $rev) {
+			croak "last_rev is higher!: $last_rev >= $rev";
 		}
 	}
-	seek $fh, $offset, 0 or croak $!;
-	print $fh $commit,"\n" or croak $!;
+	sysseek($fh, 0, SEEK_END) or croak "seek: $!";
+	syswrite($fh, pack(rev_map_fmt, $rev, $commit), 24) == 24 or
+	  croak "write: $!";
 }
 
 sub mkfile {
@@ -2551,10 +2572,10 @@ sub mkfile {
 	}
 }
 
-sub rev_db_set {
+sub rev_map_set {
 	my ($self, $rev, $commit, $update_ref, $uuid) = @_;
 	length $commit == 40 or die "arg3 must be a full SHA1 hexsum\n";
-	my $db = $self->db_path($uuid);
+	my $db = $self->map_path($uuid);
 	my $db_lock = "$db.lock";
 	my $sig;
 	if ($update_ref) {
@@ -2569,16 +2590,18 @@ sub rev_db_set {
 	# and we can't afford to lose it because rebuild() won't work
 	if ($self->use_svm_props || $self->no_metadata) {
 		$sync = 1;
-		copy($db, $db_lock) or die "rev_db_set(@_): ",
+		copy($db, $db_lock) or die "rev_map_set(@_): ",
 					   "Failed to copy: ",
 					   "$db => $db_lock ($!)\n";
 	} else {
-		rename $db, $db_lock or die "rev_db_set(@_): ",
+		rename $db, $db_lock or die "rev_map_set(@_): ",
 					    "Failed to rename: ",
 					    "$db => $db_lock ($!)\n";
 	}
-	open my $fh, '+<', $db_lock or die "Couldn't open $db_lock: $!\n";
-	_rev_db_set($fh, $rev, $commit);
+
+	sysopen(my $fh, $db_lock, O_RDWR | O_APPEND | O_CREAT)
+	     or croak "Couldn't open $db_lock: $!\n";
+	_rev_map_set($fh, $rev, $commit);
 	if ($sync) {
 		$fh->flush or die "Couldn't flush $db_lock: $!\n";
 		$fh->sync or die "Couldn't sync $db_lock: $!\n";
@@ -2589,7 +2612,7 @@ sub rev_db_set {
 		command_noisy('update-ref', '-m', "r$rev",
 		              $self->refname, $commit);
 	}
-	rename $db_lock, $db or die "rev_db_set(@_): ", "Failed to rename: ",
+	rename $db_lock, $db or die "rev_map_set(@_): ", "Failed to rename: ",
 	                            "$db_lock => $db ($!)\n";
 	delete $LOCKFILES{$db_lock};
 	if ($update_ref) {
@@ -2599,29 +2622,61 @@ sub rev_db_set {
 	}
 }
 
-sub rev_db_max {
+sub rev_map_max {
 	my ($self) = @_;
 	$self->rebuild;
-	my $db_path = $self->db_path;
-	my @stat = stat $db_path or return 0;
-	($stat[7] % 41) == 0 or die "$db_path inconsistent size: $stat[7]\n";
-	my $max = $stat[7] / 41;
-	(($max > 0) ? $max - 1 : 0);
+	my $map_path = $self->map_path;
+	stat $map_path or return wantarray ? (0, undef) : 0;
+	sysopen(my $fh, $map_path, O_RDONLY) or croak "open: $!";
+	my $size = (stat($fh))[7];
+	($size % 24) == 0 or croak "inconsistent size: $size";
+
+	if ($size == 0) {
+		close $fh or croak "close: $!";
+		return wantarray ? (0, undef) : 0;
+	}
+
+	sysseek($fh, -24, SEEK_END);
+	sysread($fh, my $buf, 24) == 24 or croak "read: $!";
+	close $fh or croak "close: $!";
+	my ($r, $c) = unpack(rev_map_fmt, $buf);
+	wantarray ? ($r, $c) : $r;
 }
 
-sub rev_db_get {
+sub rev_map_get {
 	my ($self, $rev, $uuid) = @_;
-	my $ret;
-	my $offset = $rev * 41;
-	my $db_path = $self->db_path($uuid);
-	return undef unless -e $db_path;
-	open my $fh, '<', $db_path or croak $!;
-	if (sysseek($fh, $offset, 0) == $offset) {
-		my $read = sysread($fh, $ret, 40);
-		$ret = undef if ($read != 40 || $ret eq ('0'x40));
+	my $map_path = $self->map_path($uuid);
+	return undef unless -e $map_path;
+
+	sysopen(my $fh, $map_path, O_RDONLY) or croak "open: $!";
+	my $size = (stat($fh))[7];
+	($size % 24) == 0 or croak "inconsistent size: $size";
+
+	if ($size == 0) {
+		close $fh or croak "close: $fh";
+		return undef;
 	}
-	close $fh or croak $!;
-	$ret;
+
+	my ($l, $u) = (0, $size - 24);
+	my ($r, $c, $buf);
+
+	while ($l <= $u) {
+		my $i = int(($l/24 + $u/24) / 2) * 24;
+		sysseek($fh, $i, SEEK_SET) or croak "seek: $!";
+		sysread($fh, my $buf, 24) == 24 or croak "read: $!";
+		my ($r, $c) = unpack('NH40', $buf);
+
+		if ($r < $rev) {
+			$l = $i + 24;
+		} elsif ($r > $rev) {
+			$u = $i - 24;
+		} else { # $r == $rev
+			close($fh) or croak "close: $!";
+			return $c;
+		}
+	}
+	close($fh) or croak "close: $!";
+	undef;
 }
 
 # Finds the first svn revision that exists on (if $eq_ok is true) or
@@ -2633,7 +2688,7 @@ sub find_rev_before {
 	--$rev unless $eq_ok;
 	$min_rev ||= 1;
 	while ($rev >= $min_rev) {
-		if (my $c = $self->rev_db_get($rev)) {
+		if (my $c = $self->rev_map_get($rev)) {
 			return ($rev, $c);
 		}
 		--$rev;
@@ -2648,9 +2703,9 @@ sub find_rev_before {
 sub find_rev_after {
 	my ($self, $rev, $eq_ok, $max_rev) = @_;
 	++$rev unless $eq_ok;
-	$max_rev ||= $self->rev_db_max();
+	$max_rev ||= $self->rev_map_max;
 	while ($rev <= $max_rev) {
-		if (my $c = $self->rev_db_get($rev)) {
+		if (my $c = $self->rev_map_get($rev)) {
 			return ($rev, $c);
 		}
 		++$rev;
@@ -2673,13 +2728,32 @@ sub _new {
 	bless {
 		ref_id => $ref_id, dir => $dir, index => "$dir/index",
 	        path => $path, config => "$ENV{GIT_DIR}/svn/config",
-	        db_root => "$dir/.rev_db", repo_id => $repo_id }, $class;
+	        map_root => "$dir/.rev_map", repo_id => $repo_id }, $class;
 }
 
-sub db_path {
+# for read-only access of old .rev_db formats
+sub unlink_rev_db_symlink {
+	my ($self) = @_;
+	my $link = $self->rev_db_path;
+	$link =~ s/\.[\w-]+$// or croak "missing UUID at the end of $link";
+	if (-l $link) {
+		unlink $link or croak "unlink: $link failed!";
+	}
+}
+
+sub rev_db_path {
+	my ($self, $uuid) = @_;
+	my $db_path = $self->map_path($uuid);
+	$db_path =~ s{/\.rev_map\.}{/\.rev_db\.}
+	    or croak "map_path: $db_path does not contain '/.rev_map.' !";
+	$db_path;
+}
+
+# the new replacement for .rev_db
+sub map_path {
 	my ($self, $uuid) = @_;
 	$uuid ||= $self->ra_uuid;
-	"$self->{db_root}.$uuid";
+	"$self->{map_root}.$uuid";
 }
 
 sub uri_encode {
@@ -3763,7 +3837,7 @@ sub gs_fetch_loop_common {
 
 			foreach my $gs ($self->match_globs(\%exists, $paths,
 			                                   $globs, $r)) {
-				if ($gs->rev_db_max >= $r) {
+				if ($gs->rev_map_max >= $r) {
 					next;
 				}
 				next unless $gs->match_paths($paths, $r);
@@ -3789,12 +3863,6 @@ sub gs_fetch_loop_common {
 				$ra_invalid = undef;
 			}
 		}
-		# pre-fill the .rev_db since it'll eventually get filled in
-		# with '0' x40 if something new gets committed
-		foreach my $gs (@$gsv) {
-			next if defined $gs->rev_db_get($max);
-			$gs->rev_db_set($max, 0 x40);
-		}
 		foreach my $g (@$globs) {
 			my $k = "svn-remote.$g->{remote}.$g->{t}-maxRev";
 			Git::SVN::tmp_config($k, $max);
@@ -4030,7 +4098,7 @@ sub git_svn_log_cmd {
 	push @cmd, @log_opts;
 	if (defined $r_max && $r_max == $r_min) {
 		push @cmd, '--max-count=1';
-		if (my $c = $gs->rev_db_get($r_max)) {
+		if (my $c = $gs->rev_map_get($r_max)) {
 			push @cmd, $c;
 		}
 	} elsif (defined $r_max) {
@@ -4311,6 +4379,16 @@ package Git::SVN::Migration;
 #              --use-separate-remotes option in git-clone (now default)
 #            - we do not automatically migrate to this (following
 #              the example set by core git)
+#
+# v5 layout: .rev_db.$UUID => .rev_map.$UUID
+#            - newer, more-efficient format that uses 24-bytes per record
+#              with no filler space.
+#            - use xxd -c24 < .rev_map.$UUID to view and debug
+#            - This is a one-way migration, repositories updated to the
+#              new format will not be able to use old git-svn without
+#              rebuilding the .rev_db.  Rebuilding the rev_db is not
+#              possible if noMetadata or useSvmProps are set; but should
+#              be no problem for users that use the (sensible) defaults.
 use strict;
 use warnings;
 use Carp qw/croak/;
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 8d4a447..9ee35e7 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -82,3 +82,29 @@ stop_httpd () {
 	test -z "$SVN_HTTPD_PORT" && return
 	"$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop
 }
+
+convert_to_rev_db () {
+	perl -w -- - "$@" <<\EOF
+use strict;
+@ARGV == 2 or die "Usage: convert_to_rev_db <input> <output>";
+open my $wr, '+>', $ARGV[1] or die "$!: couldn't open: $ARGV[1]";
+open my $rd, '<', $ARGV[0] or die "$!: couldn't open: $ARGV[0]";
+my $size = (stat($rd))[7];
+($size % 24) == 0 or die "Inconsistent size: $size";
+while (sysread($rd, my $buf, 24) == 24) {
+	my ($r, $c) = unpack('NH40', $buf);
+	my $offset = $r * 41;
+	seek $wr, 0, 2 or die $!;
+	my $pos = tell $wr;
+	if ($pos < $offset) {
+		for (1 .. (($offset - $pos) / 41)) {
+			print $wr (('0' x 40),"\n") or die $!;
+		}
+	}
+	seek $wr, $offset, 0 or die $!;
+	print $wr $c,"\n" or die $!;
+}
+close $wr or die $!;
+close $rd or die $!;
+EOF
+}
diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh
index 67fdf70..0a41d52 100755
--- a/t/t9107-git-svn-migrate.sh
+++ b/t/t9107-git-svn-migrate.sh
@@ -97,15 +97,19 @@ test_expect_success 'migrate --minimize on old inited layout' "
 	grep '^:refs/remotes/git-svn' fetch.out
 	"
 
-test_expect_success  ".rev_db auto-converted to .rev_db.UUID" "
+test_expect_success  ".rev_db auto-converted to .rev_map.UUID" "
 	git-svn fetch -i trunk &&
-	expect=$GIT_DIR/svn/trunk/.rev_db.* &&
+	test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
+	expect=\"\$(ls $GIT_DIR/svn/trunk/.rev_map.*)\" &&
 	test -n \"\$expect\" &&
-	mv \$expect $GIT_DIR/svn/trunk/.rev_db &&
+	rev_db=\$(echo \$expect | sed -e 's,_map,_db,') &&
+	convert_to_rev_db \$expect \$rev_db &&
+	rm -f \$expect &&
+	test -f \$rev_db &&
 	git-svn fetch -i trunk &&
-	test -L $GIT_DIR/svn/trunk/.rev_db &&
-	test -f \$expect &&
-	cmp \$expect $GIT_DIR/svn/trunk/.rev_db
+	test -z \"\$(ls $GIT_DIR/svn/trunk/.rev_db.* 2>/dev/null)\" &&
+	test ! -e $GIT_DIR/svn/trunk/.rev_db &&
+	test -f \$expect
 	"
 
 test_done
-- 
1.5.3.7.1114.g6df1d

^ permalink raw reply related

* [PATCH 2/2] git-svn: reinstate old rev_db optimization in new rev_map
From: Eric Wong @ 2007-12-09  7:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Eric Wong
In-Reply-To: <1197185262-16765-1-git-send-email-normalperson@yhbt.net>

This reinstates an old optimization in .rev_db which
stored the highest revision number we scanned, allowing
us to avoid scanning the SVN log for those revisions
again in a subsequent invocation.

This means the last 24-byte record in a .rev_map file
can be a 4-byte SVN revision number with 20-bytes of
zeroes representing a non-existent commit.  This record
can and will be overwritten when a new commit iff
the commit is all zeroes.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-svn.perl |   71 ++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 57 insertions(+), 14 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index b45c7e3..55484f7 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1904,7 +1904,7 @@ sub last_rev_commit {
 		($self->{last_rev}, $self->{last_commit}) = (undef, undef);
 		return (undef, undef);
 	}
-	my ($rev, $commit) = $self->rev_map_max;
+	my ($rev, $commit) = $self->rev_map_max(1);
 	($self->{last_rev}, $self->{last_commit}) = ($rev, $commit);
 	return ($rev, $commit);
 }
@@ -2534,11 +2534,16 @@ sub rebuild {
 #     * 4 bytes for the integer representing an SVN revision number
 #     * 20 bytes representing the sha1 of a git commit
 #   - No empty padding records like the old format
+#     (except the last record, which can be overwritten)
 #   - new records are written append-only since SVN revision numbers
 #     increase monotonically
 #   - lookups on SVN revision number are done via a binary search
-#   - Piping the file to xxd(1) -c24 is a good way of dumping it for
-#     viewing or editing, should the need ever arise.
+#   - Piping the file to xxd -c24 is a good way of dumping it for
+#     viewing or editing (piped back through xxd -r), should the need
+#     ever arise.
+#   - The last record can be padding revision with an all-zero sha1
+#     This is used to optimize fetch performance when using multiple
+#     "fetch" directives in .git/config
 #
 # These files are disposable unless noMetadata or useSvmProps is set
 
@@ -2548,16 +2553,32 @@ sub _rev_map_set {
 	my $size = (stat($fh))[7];
 	($size % 24) == 0 or croak "inconsistent size: $size";
 
+	my $wr_offset = 0;
 	if ($size > 0) {
 		sysseek($fh, -24, SEEK_END) or croak "seek: $!";
 		my $read = sysread($fh, my $buf, 24) or croak "read: $!";
 		$read == 24 or croak "read only $read bytes (!= 24)";
 		my ($last_rev, $last_commit) = unpack(rev_map_fmt, $buf);
-		if ($last_rev >= $rev) {
-			croak "last_rev is higher!: $last_rev >= $rev";
+		if ($last_commit eq ('0' x40)) {
+			if ($size >= 48) {
+				sysseek($fh, -48, SEEK_END) or croak "seek: $!";
+				$read = sysread($fh, $buf, 24) or
+				    croak "read: $!";
+				$read == 24 or
+				    croak "read only $read bytes (!= 24)";
+				($last_rev, $last_commit) =
+				    unpack(rev_map_fmt, $buf);
+				if ($last_commit eq ('0' x40)) {
+					croak "inconsistent .rev_map\n";
+				}
+			}
+			if ($last_rev >= $rev) {
+				croak "last_rev is higher!: $last_rev >= $rev";
+			}
+			$wr_offset = -24;
 		}
 	}
-	sysseek($fh, 0, SEEK_END) or croak "seek: $!";
+	sysseek($fh, $wr_offset, SEEK_END) or croak "seek: $!";
 	syswrite($fh, pack(rev_map_fmt, $rev, $commit), 24) == 24 or
 	  croak "write: $!";
 }
@@ -2599,7 +2620,7 @@ sub rev_map_set {
 					    "$db => $db_lock ($!)\n";
 	}
 
-	sysopen(my $fh, $db_lock, O_RDWR | O_APPEND | O_CREAT)
+	sysopen(my $fh, $db_lock, O_RDWR | O_CREAT)
 	     or croak "Couldn't open $db_lock: $!\n";
 	_rev_map_set($fh, $rev, $commit);
 	if ($sync) {
@@ -2622,25 +2643,40 @@ sub rev_map_set {
 	}
 }
 
+# If want_commit, this will return an array of (rev, commit) where
+# commit _must_ be a valid commit in the archive.
+# Otherwise, it'll return the max revision (whether or not the
+# commit is valid or just a 0x40 placeholder).
 sub rev_map_max {
-	my ($self) = @_;
+	my ($self, $want_commit) = @_;
 	$self->rebuild;
 	my $map_path = $self->map_path;
-	stat $map_path or return wantarray ? (0, undef) : 0;
+	stat $map_path or return $want_commit ? (0, undef) : 0;
 	sysopen(my $fh, $map_path, O_RDONLY) or croak "open: $!";
 	my $size = (stat($fh))[7];
 	($size % 24) == 0 or croak "inconsistent size: $size";
 
 	if ($size == 0) {
 		close $fh or croak "close: $!";
-		return wantarray ? (0, undef) : 0;
+		return $want_commit ? (0, undef) : 0;
 	}
 
-	sysseek($fh, -24, SEEK_END);
+	sysseek($fh, -24, SEEK_END) or croak "seek: $!";
 	sysread($fh, my $buf, 24) == 24 or croak "read: $!";
-	close $fh or croak "close: $!";
 	my ($r, $c) = unpack(rev_map_fmt, $buf);
-	wantarray ? ($r, $c) : $r;
+	if ($want_commit && $c eq ('0' x40)) {
+		if ($size < 48) {
+			return $want_commit ? (0, undef) : 0;
+		}
+		sysseek($fh, -48, SEEK_END) or croak "seek: $!";
+		sysread($fh, $buf, 24) == 24 or croak "read: $!";
+		($r, $c) = unpack(rev_map_fmt, $buf);
+		if ($c eq ('0'x40)) {
+			croak "Penultimate record is all-zeroes in $map_path";
+		}
+	}
+	close $fh or croak "close: $!";
+	$want_commit ? ($r, $c) : $r;
 }
 
 sub rev_map_get {
@@ -2672,7 +2708,7 @@ sub rev_map_get {
 			$u = $i - 24;
 		} else { # $r == $rev
 			close($fh) or croak "close: $!";
-			return $c;
+			return $c eq ('0' x 40) ? undef : $c;
 		}
 	}
 	close($fh) or croak "close: $!";
@@ -3863,6 +3899,13 @@ sub gs_fetch_loop_common {
 				$ra_invalid = undef;
 			}
 		}
+		# pre-fill the .rev_db since it'll eventually get filled in
+		# with '0' x40 if something new gets committed
+		foreach my $gs (@$gsv) {
+			next if $gs->rev_map_max >= $max;
+			next if defined $gs->rev_map_get($max);
+			$gs->rev_map_set($max, 0 x40);
+		}
 		foreach my $g (@$globs) {
 			my $k = "svn-remote.$g->{remote}.$g->{t}-maxRev";
 			Git::SVN::tmp_config($k, $max);
-- 
1.5.3.7.1114.g6df1d

^ permalink raw reply related

* Re: Something is broken in repack
From: Junio C Hamano @ 2007-12-09  8:05 UTC (permalink / raw)
  To: Jon Smirl; +Cc: Nicolas Pitre, Git Mailing List
In-Reply-To: <7vodd0vnhv.fsf@gitster.siamese.dyndns.org>

Junio C Hamano <gitster@pobox.com> writes:

> Nicolas Pitre <nico@cam.org> writes:
>
>> On Fri, 7 Dec 2007, Jon Smirl wrote:
>>
>>> Starting with a 2GB pack of the same data my process size only grew to
>>> 3GB with 2GB of mmaps.
>>
>> Which is quite reasonable, even if the same issue might still be there.
>>
>> So the problem seems to be related to the pack access code and not the 
>> repack code.  And it must have something to do with the number of deltas 
>> being replayed.  And because the repack is attempting delta compression 
>> roughly from newest to oldest, and because old objects are typically in 
>> a deeper delta chain, then this might explain the logarithmic slowdown.
>>
>> So something must be wrong with the delta cache in sha1_file.c somehow.
>
> I was reaching the same conclusion but haven't managed to spot anything
> blatantly wrong in that area.  Will need to dig more.

Does this problem have correlation with the use of threads?  Do you see
the same bloat with or without THREADED_DELTA_SEARCH defined?

^ permalink raw reply

* [PATCH] don't mention index refreshing side effect in git-status docs
From: Jeff King @ 2007-12-09  8:21 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Steven Grimm, git

The tip about speeding up subsequent operations is now
obsolete; since aecbf914, git-diff now squelches empty diffs
and performs an automatic refresh.

Signed-off-by: Jeff King <peff@peff.net>
---
This is on top of my other patches to the git-status docs.

I don't see any reason to mention this side effect at all. Those who
know enough to set diff.autorefreshindex presumably know what they are
doing, and the removed paragraph is a bit confusing to those who don't.

If there is some desire to document the side effect, I think we should
at least remove the mention of speeding up git-diff (which is just wrong
now).

 Documentation/git-status.txt |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index a1bb9bd..5c5a480 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -28,13 +28,6 @@ If there is no path that is different between the index file and
 the current HEAD commit (i.e., there is nothing to commit by running
 `git-commit`), the command exits with non-zero status.
 
-If any paths have been touched in the working tree (that is,
-their modification times have changed) but their contents and
-permissions are identical to those in the index file, the command
-updates the index file. Running `git-status` can thus speed up
-subsequent operations such as `git-diff` if the working tree
-contains many paths that have been touched but not modified.
-
 
 OUTPUT
 ------
-- 
1.5.3.7.2187.gb646

^ permalink raw reply related

* git-svn capabilities
From: Pedro Melo @ 2007-12-09  8:20 UTC (permalink / raw)
  To: git

Hi,

I've been following along the gcc/git thread with interest and I've  
used Harvey Harrison recipe

http://article.gmane.org/gmane.comp.version-control.git/67253

with success on several svn repos.

One thing that I'm not sure yet if it is possible to do is this:

can I have a single central git repo that tracks the svn repo, allow  
several developers to use clone to copy that repo, and each one of  
them (after proper manual configuration) uses dcommit to push back to  
svn?

All the recipes so far assume that each developer has to go through  
the initial git-svn fetch and have a copy of the entire SVN repo, and  
that seems wasteful to me.

Thanks,
-- 
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: melo@simplicidade.org
Use XMPP!

^ permalink raw reply

* Re: [PATCH] gitweb: Make config_to_multi return [] instead of [undef]
From: Junio C Hamano @ 2007-12-09  8:29 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Petr Baudis, git
In-Reply-To: <m38x45tb9y.fsf@roke.D-201>

Jakub Narebski <jnareb@gmail.com> writes:

> Petr Baudis <pasky@suse.cz> writes:
>
>> This is important for the list of clone urls, where if there are
>> no per-repository clone URL configured, the default base URLs
>> are never used for URL construction with this patch.
>
> Thanks.
>  
>> @@ -1512,7 +1512,7 @@ sub config_to_int {
>>  sub config_to_multi {
>>  	my $val = shift;
>>  
>> -	return ref($val) ? $val : [ $val ];
>> +	return ref($val) ? $val : $val ? [ $val ] : [];
>>  }
>
> Shouldn't it be
>
>   +	return ref($val) ? $val : defined($val) ? [ $val ] : [];

I think so.  Pasky?

^ permalink raw reply

* Re: [PATCH] don't mention index refreshing side effect in git-status docs
From: Junio C Hamano @ 2007-12-09  8:33 UTC (permalink / raw)
  To: Jeff King; +Cc: Steven Grimm, git
In-Reply-To: <20071209082133.GA2257@coredump.intra.peff.net>

Jeff King <peff@peff.net> writes:

> If there is some desire to document the side effect, I think we should
> at least remove the mention of speeding up git-diff (which is just wrong
> now).

Why is it "just wrong"?  Having to squelch the false hits and to run
auto-refresh are both unnecessary overhead if your index is fresh.

^ permalink raw reply

* Re: git-svn capabilities
From: Adam Roben @ 2007-12-09  8:37 UTC (permalink / raw)
  To: Pedro Melo; +Cc: git
In-Reply-To: <DB0B4F17-9E06-4C28-933E-FDEF9BAD6539@simplicidade.org>

Pedro Melo wrote:
> Hi,
>
> I've been following along the gcc/git thread with interest and I've 
> used Harvey Harrison recipe
>
> http://article.gmane.org/gmane.comp.version-control.git/67253
>
> with success on several svn repos.
>
> One thing that I'm not sure yet if it is possible to do is this:
>
> can I have a single central git repo that tracks the svn repo, allow 
> several developers to use clone to copy that repo, and each one of 
> them (after proper manual configuration) uses dcommit to push back to 
> svn?
>
> All the recipes so far assume that each developer has to go through 
> the initial git-svn fetch and have a copy of the entire SVN repo, and 
> that seems wasteful to me.

The "Basic Examples" section of the git-svn man page describe how to do 
just that (though only for a single branch).

-Adam

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox