From c7f34c180b7117cf60ad12a8b180eed33716e390 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 23 Apr 2007 10:21:25 +0200 Subject: [PATCH 1/6] dir.c(common_prefix): Fix two bugs The function common_prefix() is used to find the common subdirectory of a couple of pathnames. When checking if the next pathname matches up with the prefix, it incorrectly checked the whole path, not just the prefix (including the slash). Thus, the expensive part of the loop was executed always. The other bug is more serious: if the first and the last pathname in the list have a longer common prefix than the common prefix for _all_ pathnames in the list, the longer one would be chosen. This bug was probably hidden by the fact that bash's wildcard expansion sorts the results, and the code just so happens to work with sorted input. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- dir.c | 3 ++- t/t3700-add.sh | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dir.c b/dir.c index b48e19dc09..602282bd1b 100644 --- a/dir.c +++ b/dir.c @@ -24,8 +24,9 @@ int common_prefix(const char **pathspec) prefix = slash - path + 1; while ((next = *++pathspec) != NULL) { int len = strlen(next); - if (len >= prefix && !memcmp(path, next, len)) + if (len >= prefix && !memcmp(path, next, prefix)) continue; + len = prefix - 1; for (;;) { if (!len) return 0; diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 08e035220c..ad8cc7d4ae 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -104,4 +104,10 @@ test_expect_success 'add ignored ones with -f' ' git-ls-files --error-unmatch d.ig/d.if d.ig/d.ig ' +mkdir 1 1/2 1/3 +touch 1/2/a 1/3/b 1/2/c +test_expect_success 'check correct prefix detection' ' + git add 1/2/a 1/3/b 1/2/c +' + test_done From 81178fe48c1466f400741842f9e3da1528cfd124 Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Mon, 23 Apr 2007 19:56:45 -0400 Subject: [PATCH 2/6] Reverse the order of -b and --track in the man page. Using "-b --track newbranch oldbranch" gives the error: git checkout: updating paths is incompatible with switching branches/forcing However, "--track -b ..." works just fine. Signed-off-by: Brian Gernhardt Signed-off-by: Junio C Hamano --- Documentation/git-checkout.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 4f2e847dc3..918d8ee720 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -8,7 +8,7 @@ git-checkout - Checkout and switch to a branch SYNOPSIS -------- [verse] -'git-checkout' [-q] [-f] [-b [--track | --no-track] [-l]] [-m] [] +'git-checkout' [-q] [-f] [[--track | --no-track] -b [-l]] [-m] [] 'git-checkout' [] ... DESCRIPTION From 6777c3806da18d4a3a05e5bcdde0aa9efb9b3b9f Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Mon, 23 Apr 2007 17:32:04 -0700 Subject: [PATCH 3/6] Fix typo in git-am: s/Was is/Was it/ Signed-off-by: Josh Triplett Signed-off-by: Junio C Hamano --- git-am.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-am.sh b/git-am.sh index e69ecbfdb1..c9f66e2784 100755 --- a/git-am.sh +++ b/git-am.sh @@ -291,7 +291,7 @@ do <"$dotest/$msgnum" >"$dotest/info" || stop_here $this test -s $dotest/patch || { - echo "Patch is empty. Was is split wrong?" + echo "Patch is empty. Was it split wrong?" stop_here $this } git-stripspace < "$dotest/msg" > "$dotest/msg-clean" From ce748f59923b3a3d432d6e8a12366f71284b595f Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Mon, 23 Apr 2007 20:02:34 -0400 Subject: [PATCH 4/6] Ignore all man sections as they are generated files. Signed-off-by: Brian Gernhardt Signed-off-by: Junio C Hamano --- Documentation/.gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/.gitignore b/Documentation/.gitignore index b98d21e98e..a37b2152bd 100644 --- a/Documentation/.gitignore +++ b/Documentation/.gitignore @@ -1,7 +1,6 @@ *.xml *.html -*.1 -*.7 +*.[1-8] *.made howto-index.txt doc.dep From bbc6354171a08e2c43d651f8645bcdb76bf9f92b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 23 Apr 2007 23:17:41 -0700 Subject: [PATCH 5/6] Build RPM with ETC_GITCONFIG=/etc/gitconfig Signed-off-by: Junio C Hamano --- git.spec.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git.spec.in b/git.spec.in index 46aee88fd1..87197d10e1 100644 --- a/git.spec.in +++ b/git.spec.in @@ -86,12 +86,14 @@ Perl interface to Git %build make %{_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" WITH_OWN_SUBPROCESS_PY=YesPlease \ + ETC_GITCONFIG=/etc/gitconfig \ prefix=%{_prefix} all %{!?_without_docs: doc} %install rm -rf $RPM_BUILD_ROOT make %{_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" DESTDIR=$RPM_BUILD_ROOT \ WITH_OWN_SUBPROCESS_PY=YesPlease \ + ETC_GITCONFIG=/etc/gitconfig \ prefix=%{_prefix} mandir=%{_mandir} INSTALLDIRS=vendor \ install %{!?_without_docs: install-doc} find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} ';' From 41728d69426dd707d4978929f8f4ac7a16f115f3 Mon Sep 17 00:00:00 2001 From: Gerrit Pape Date: Mon, 23 Apr 2007 12:06:29 +0000 Subject: [PATCH 6/6] Documentation/git-reset.txt: suggest git commit --amend in example. In example 'Undo a commit and redo', refer to 'git commit --amend', as this is the easier alternative. Signed-off-by: Junio C Hamano --- Documentation/git-reset.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt index 5b55cda512..19c5b9bbda 100644 --- a/Documentation/git-reset.txt +++ b/Documentation/git-reset.txt @@ -67,6 +67,8 @@ message, or both. Leaves working tree as it was before "reset". <3> "reset" copies the old head to .git/ORIG_HEAD; redo the commit by starting with its log message. If you do not need to edit the message further, you can give -C option instead. ++ +See also the --amend option to gitlink:git-commit[1]. Undo commits permanently:: +