From 64ca23afda5bd7514115a4457abf37db21b989ac Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 23 Aug 2008 13:05:10 -0700 Subject: [PATCH 01/41] discard_cache: reset lazy name_hash bit We forgot to reset name_hash_initialized bit when discarding the in-core index. Signed-off-by: Junio C Hamano --- read-cache.c | 1 + 1 file changed, 1 insertion(+) diff --git a/read-cache.c b/read-cache.c index 2c03ec3069..6c57095f73 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1243,6 +1243,7 @@ int discard_index(struct index_state *istate) istate->cache_nr = 0; istate->cache_changed = 0; istate->timestamp = 0; + istate->name_hash_initialized = 0; free_hash(&istate->name_hash); cache_tree_free(&(istate->cache_tree)); free(istate->alloc); From 9d865356abc08b253bc15b5fb50471d80c828be1 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 6 Sep 2008 19:09:16 -0700 Subject: [PATCH 02/41] diff Porcelain: do not disable auto index refreshing on -C -C When we enabled the automatic refreshing of the index to "diff" Porcelain, we disabled it when --find-copies-harder was asked, but there is no good reason to do so. In the following command sequence, the first "diff" shows an "empty" diff exposing stat dirtyness, while the second one does not. $ >foo $ git add foo $ touch foo $ git diff -C -C $ git diff -C This fixes the inconsistency. Signed-off-by: Junio C Hamano --- diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diff.c b/diff.c index b3a7da70a5..85d690183f 100644 --- a/diff.c +++ b/diff.c @@ -3394,7 +3394,7 @@ void diffcore_std(struct diff_options *options) if (DIFF_OPT_TST(options, QUIET)) return; - if (options->skip_stat_unmatch && !DIFF_OPT_TST(options, FIND_COPIES_HARDER)) + if (options->skip_stat_unmatch) diffcore_skip_stat_unmatch(options); if (options->break_opt != -1) diffcore_break(options->break_opt); From df58a8274d6865020682a6739bc59b87a9761991 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 1 Sep 2008 23:20:26 -0700 Subject: [PATCH 03/41] diff --quiet: make it synonym to --exit-code >/dev/null The point of --quiet was to return the status as early as possible without doing any extra processing. Well behaved scripts, when they expect to run many diff operations inside, are supposed to run "update-index --refresh" upfront; we do not want them to pay the price of iterating over the index and comparing the contents to fix the stat dirtiness, and we avoided most of the processing in diffcore_std() when --quiet is in effect. But scripts that adhere to the good practice won't have to pay any more price than the necessary lstat(2) that will report stat cleanliness, as long as only -q is given without any fancier diff options. More importantly, users who do ask for "--quiet -M --filter=D" (in order to notice only the deletion, not paths that disappeared only because they have been renamed away) deserve to get the result they asked for, even it means they have to pay the extra price; the alternative is to get a cheap early return that gives a result they did not ask for, which is much worse. Signed-off-by: Junio C Hamano --- diff.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/diff.c b/diff.c index 85d690183f..13be211568 100644 --- a/diff.c +++ b/diff.c @@ -2393,13 +2393,6 @@ int diff_setup_done(struct diff_options *options) DIFF_OPT_SET(options, EXIT_WITH_STATUS); } - /* - * If we postprocess in diffcore, we cannot simply return - * upon the first hit. We need to run diff as usual. - */ - if (options->pickaxe || options->filter) - DIFF_OPT_CLR(options, QUIET); - return 0; } @@ -3391,9 +3384,6 @@ static void diffcore_skip_stat_unmatch(struct diff_options *diffopt) void diffcore_std(struct diff_options *options) { - if (DIFF_OPT_TST(options, QUIET)) - return; - if (options->skip_stat_unmatch) diffcore_skip_stat_unmatch(options); if (options->break_opt != -1) From a5ccc5979d210500d00169f98cc8567ea346fcb0 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 21 Feb 2008 15:10:37 -0800 Subject: [PATCH 04/41] Don't verify host name in SSL certs when GIT_SSL_NO_VERIFY is set Originally from Mike Hommey; earlier we were disabling SSL_VERIFYPEER but SSL_VERIFYHOST was in effect even when the user asked not to with the environment variable. Signed-off-by: Junio C Hamano --- http.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/http.c b/http.c index 1108ab4a31..a97fdf5117 100644 --- a/http.c +++ b/http.c @@ -165,7 +165,16 @@ static CURL* get_curl_handle(void) { CURL* result = curl_easy_init(); - curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, curl_ssl_verify); + if (!curl_ssl_verify) { + curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 0); + } else { + /* Verify authenticity of the peer's certificate */ + curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 1); + /* The name in the cert must match whom we tried to connect */ + curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2); + } + #if LIBCURL_VERSION_NUM >= 0x070907 curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL); #endif From 8beb1f33d15af6cdb6bf7d8296fd73eb8df2f152 Mon Sep 17 00:00:00 2001 From: Dmitry Potapov Date: Tue, 9 Sep 2008 00:42:48 +0400 Subject: [PATCH 05/41] git-rebase-interactive: do not squash commits on abort If git rebase interactive is stopped by "edit" command and then the user said "git rebase --continue" while having some stage changes, git rebase interactive is trying to amend the last commit by doing: git --soft reset && git commit However, the user can abort commit for some reason by providing an empty log message, and that would leave the last commit undone, while the user being completely unaware about what happened. Now if the user tries to continue, by issuing "git rebase --continue" that squashes two previous commits. Signed-off-by: Dmitry Potapov Signed-off-by: Junio C Hamano --- git-rebase--interactive.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 929d681c47..990104a52d 100755 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -427,14 +427,18 @@ do else . "$DOTEST"/author-script || die "Cannot find the author identity" + amend= if test -f "$DOTEST"/amend then + amend=$(git rev-parse --verify HEAD) git reset --soft HEAD^ || die "Cannot rewind the HEAD" fi export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE && - git commit --no-verify -F "$DOTEST"/message -e || - die "Could not commit staged changes." + git commit --no-verify -F "$DOTEST"/message -e || { + test -n "$amend" && git reset --soft $amend + die "Could not commit staged changes." + } fi require_clean_work_tree From c14c3c82da9a46c65008060ad8e6dacef1a24ba9 Mon Sep 17 00:00:00 2001 From: Dmitry Potapov Date: Tue, 9 Sep 2008 16:05:26 +0400 Subject: [PATCH 06/41] git-rebase--interactive: auto amend only edited commit "git rebase --continue" issued after git rebase being stop by "edit" command is trying to amend the last commit using stage changes. However, if the last commit is not the commit that was marked as "edit" then it can produce unexpected results. For instance, after being stop by "edit", I have made some changes to commit message using "git commit --amend". After that I realized that I forgot to add some changes to some file. So, I said "git add file" and the "git rebase --continue". Unfortunately, it caused that the new commit message was lost. Another problem is that after being stopped at "edit", the user adds new commits. In this case, automatic amend behavior of git rebase triggered by some stage changes causes that not only that the log message of the last commit is lost but that it will contain also wrong Author and Date information. Therefore, this patch restrict automatic amend only to the situation where HEAD is the commit at which git rebase stop by "edit" command. Signed-off-by: Dmitry Potapov Signed-off-by: Junio C Hamano --- git-rebase--interactive.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 990104a52d..edb6ec6ed0 100755 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -284,7 +284,7 @@ do_next () { pick_one $sha1 || die_with_patch $sha1 "Could not apply $sha1... $rest" make_patch $sha1 - : > "$DOTEST"/amend + git rev-parse --verify HEAD > "$DOTEST"/amend warn "Stopped at $sha1... $rest" warn "You can amend the commit now, with" warn @@ -431,6 +431,10 @@ do if test -f "$DOTEST"/amend then amend=$(git rev-parse --verify HEAD) + test "$amend" = $(cat "$DOTEST"/amend) || + die "\ +You have uncommitted changes in your working tree. Please, commit them +first and then run 'git rebase --continue' again." git reset --soft HEAD^ || die "Cannot rewind the HEAD" fi From d8bdc49265559786533d7f7377b2c39038dd6309 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 21 Aug 2008 19:31:50 -0500 Subject: [PATCH 07/41] Fix permission bits on sources checked out with an overtight umask Two patches 9907721 (templates/Makefile: don't depend on local umask setting, 2008-02-28) and 96cda0b (templates/Makefile: install is unnecessary, just use mkdir -p, 2008-08-21) tried to prevent an overtight umask the builder/installer might have from screwing over the installation procedure, but we forgot there was another source of trouble. If the person who checked out the source tree had an overtight umask, it will leak out to the built products, which is propagated to the installation destination. Signed-off-by: Junio C Hamano --- templates/Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/templates/Makefile b/templates/Makefile index cc3fc3094c..a12c6e214e 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -23,17 +23,19 @@ all: boilerplates.made custom bpsrc = $(filter-out %~,$(wildcard *--*)) boilerplates.made : $(bpsrc) - $(QUIET)ls *--* 2>/dev/null | \ + $(QUIET)umask 022 && ls *--* 2>/dev/null | \ while read boilerplate; \ do \ case "$$boilerplate" in *~) continue ;; esac && \ dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \ dir=`expr "$$dst" : '\(.*\)/'` && \ - $(INSTALL) -d -m 755 blt/$$dir && \ + mkdir -p blt/$$dir && \ case "$$boilerplate" in \ - *--) ;; \ - *) cp -p $$boilerplate blt/$$dst ;; \ - esac || exit; \ + *--) continue;; \ + esac && \ + cp $$boilerplate blt/$$dst && \ + if test -x "blt/$$dst"; then rx=rx; else rx=r; fi && \ + chmod a+$$rx "blt/$$dst" || exit; \ done && \ date >$@ From 5521883490e85f4d973141972cf16f89a79f1979 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 7 Sep 2008 19:49:25 -0700 Subject: [PATCH 08/41] checkout: do not lose staged removal The logic to checkout a different commit implements the safety to never lose user's local changes. For example, switching from a commit to another commit, when you have changed a path that is different between them, need to merge your changes to the version from the switched-to commit, which you may not necessarily be able to resolve easily. By default, "git checkout" refused to switch branches, to give you a chance to stash your local changes (or use "-m" to merge, accepting the risks of getting conflicts). This safety, however, had one deliberate hole since early June 2005. When your local change was to remove a path (and optionally to stage that removal), the command checked out the path from the switched-to commit nevertheless. This was to allow an initial checkout to happen smoothly (e.g. an initial checkout is done by starting with an empty index and switching from the commit at the HEAD to the same commit). We can tighten the rule slightly to allow this special case to pass, without losing sight of removal explicitly done by the user, by noticing if the index is truly empty when the operation begins. For historical background, see: http://thread.gmane.org/gmane.comp.version-control.git/4641/focus=4646 This case is marked as *0* in the message, which both Linus and I said "it feels somewhat wrong but otherwise we cannot start from an empty index". Signed-off-by: Junio C Hamano --- Documentation/git-read-tree.txt | 11 ++++++++++- builtin-checkout.c | 2 ++ builtin-read-tree.c | 1 + unpack-trees.c | 11 ++++++++++- unpack-trees.h | 1 + 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt index 6f4b9b017f..309deac23b 100644 --- a/Documentation/git-read-tree.txt +++ b/Documentation/git-read-tree.txt @@ -160,7 +160,10 @@ Here are the "carry forward" rules: 0 nothing nothing nothing (does not happen) 1 nothing nothing exists use M 2 nothing exists nothing remove path from index - 3 nothing exists exists use M + 3 nothing exists exists, use M if "initial checkout" + H == M keep index otherwise + exists fail + H != M clean I==H I==M ------------------ @@ -207,6 +210,12 @@ you picked it up via e-mail in a patch form), `git diff-index merge, but it would not show in `git diff-index --cached $M` output after two-tree merge. +Case #3 is slightly tricky and needs explanation. The result from this +rule logically should be to remove the path if the user staged the removal +of the path and then swiching to a new branch. That however will prevent +the initial checkout from happening, so the rule is modified to use M (new +tree) only when the contents of the index is empty. Otherwise the removal +of the path is kept as long as $H and $M are the same. 3-Way Merge ~~~~~~~~~~~ diff --git a/builtin-checkout.c b/builtin-checkout.c index f6f8f086de..774f29992a 100644 --- a/builtin-checkout.c +++ b/builtin-checkout.c @@ -242,6 +242,8 @@ static int merge_working_tree(struct checkout_opts *opts, } /* 2-way merge to the new branch */ + topts.initial_checkout = (!active_nr && + (old->commit == new->commit)); topts.update = 1; topts.merge = 1; topts.gently = opts->merge; diff --git a/builtin-read-tree.c b/builtin-read-tree.c index dddc3044b8..362216b272 100644 --- a/builtin-read-tree.c +++ b/builtin-read-tree.c @@ -206,6 +206,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) break; case 2: opts.fn = twoway_merge; + opts.initial_checkout = !active_nr; break; case 3: default: diff --git a/unpack-trees.c b/unpack-trees.c index ef21c62195..e59d144d28 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -941,8 +941,17 @@ int twoway_merge(struct cache_entry **src, struct unpack_trees_options *o) return -1; } } - else if (newtree) + else if (newtree) { + if (oldtree && !o->initial_checkout) { + /* + * deletion of the path was staged; + */ + if (same(oldtree, newtree)) + return 1; + return reject_merge(oldtree, o); + } return merged_entry(newtree, current, o); + } return deleted_entry(oldtree, current, o); } diff --git a/unpack-trees.h b/unpack-trees.h index 94e567265a..0d26f3d73e 100644 --- a/unpack-trees.h +++ b/unpack-trees.h @@ -26,6 +26,7 @@ struct unpack_trees_options { verbose_update:1, aggressive:1, skip_unmerged:1, + initial_checkout:1, gently:1; const char *prefix; int pos; From 903e09a3ecca8941b32bae08b821545941591348 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 18 Sep 2008 00:32:37 -0700 Subject: [PATCH 09/41] diff/diff-files: do not use --cc too aggressively Textual diff output for unmerged paths was too eager to give condensed combined diff. Even though "diff -c" (and "diff-files -c -p") is a request to view combined diff without condensing (otherwise the user would have explicitly asked for --cc, not -c), we showed "--cc" output anyway. 0fe7c1d (built-in diff: assorted updates, 2006-04-29) claimed to be careful about doing this, but its breakage was hidden because back then "git diff" was still a shell script that did not use the codepath it introduced fully. Signed-off-by: Junio C Hamano --- builtin-diff-files.c | 7 ++++++- builtin-diff.c | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/builtin-diff-files.c b/builtin-diff-files.c index 9bf10bb37e..2b578c714d 100644 --- a/builtin-diff-files.c +++ b/builtin-diff-files.c @@ -50,7 +50,12 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix) 3 < rev.max_count) usage(diff_files_usage); - if (rev.max_count == -1 && + /* + * "diff-files --base -p" should not combine merges because it + * was not asked to. "diff-files -c -p" should not densify + * (the user should ask with "diff-files --cc" explicitly). + */ + if (rev.max_count == -1 && !rev.combine_merges && (rev.diffopt.output_format & DIFF_FORMAT_PATCH)) rev.combine_merges = rev.dense_combined_merges = 1; diff --git a/builtin-diff.c b/builtin-diff.c index 037c3039a4..d5fe775fc1 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -223,7 +223,13 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv argv++; argc--; } - if (revs->max_count == -1 && + /* + * "diff --base" should not combine merges because it was not + * asked to. "diff -c" should not densify (if the user wants + * dense one, --cc can be explicitly asked for, or just rely + * on the default). + */ + if (revs->max_count == -1 && !revs->combine_merges && (revs->diffopt.output_format & DIFF_FORMAT_PATCH)) revs->combine_merges = revs->dense_combined_merges = 1; From dd9da51fe261f723d206fdd5e4874c25937d1b87 Mon Sep 17 00:00:00 2001 From: Alec Berryman Date: Sun, 14 Sep 2008 17:14:15 -0400 Subject: [PATCH 10/41] git-svn: factor out svnserve test code for later use Signed-off-by: Alec Berryman Acked-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 17 +++++++++++++++++ t/t9113-git-svn-dcommit-new-file.sh | 14 +------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index a841df2a9e..5b5f288809 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -135,3 +135,20 @@ close $wr or die $!; close $rd or die $!; EOF } + +require_svnserve () { + if test -z "$SVNSERVE_PORT" + then + say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)' + test_done + exit + fi +} + +start_svnserve () { + svnserve --listen-port $SVNSERVE_PORT \ + --root "$rawsvnrepo" \ + --listen-once \ + --listen-host 127.0.0.1 & +} + diff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh index ae78e334ac..c2b24a439d 100755 --- a/t/t9113-git-svn-dcommit-new-file.sh +++ b/t/t9113-git-svn-dcommit-new-file.sh @@ -12,19 +12,7 @@ test_description='git-svn dcommit new files over svn:// test' . ./lib-git-svn.sh -if test -z "$SVNSERVE_PORT" -then - say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)' - test_done - exit -fi - -start_svnserve () { - svnserve --listen-port $SVNSERVE_PORT \ - --root "$rawsvnrepo" \ - --listen-once \ - --listen-host 127.0.0.1 & -} +require_svnserve test_expect_success 'start tracking an empty repo' ' svn mkdir -m "empty dir" "$svnrepo"/empty-dir && From ad0a82bae0e08819520ab7442dd3a7eb7532bbe6 Mon Sep 17 00:00:00 2001 From: Alec Berryman Date: Sun, 14 Sep 2008 17:14:16 -0400 Subject: [PATCH 11/41] git-svn: Always create a new RA when calling do_switch for svn:// Not doing so caused the "Malformed network data" error when a directoy was deleted and replaced with a copy from an older version. Signed-off-by: Alec Berryman Acked-by: Eric Wong Signed-off-by: Junio C Hamano --- git-svn.perl | 25 ++- ...it-svn-follow-deleted-readded-directory.sh | 22 ++ t/t9126/follow-deleted-readded.dump | 201 ++++++++++++++++++ 3 files changed, 235 insertions(+), 13 deletions(-) create mode 100755 t/t9126-git-svn-follow-deleted-readded-directory.sh create mode 100644 t/t9126/follow-deleted-readded.dump diff --git a/git-svn.perl b/git-svn.perl index 237895c236..4e9d755066 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -3969,20 +3969,19 @@ sub gs_do_switch { my $old_url = $full_url; $full_url .= '/' . escape_uri_only($path) if length $path; my ($ra, $reparented); - if ($old_url ne $full_url) { - if ($old_url !~ m#^svn(\+ssh)?://#) { - SVN::_Ra::svn_ra_reparent($self->{session}, $full_url, - $pool); - $self->{url} = $full_url; - $reparented = 1; - } else { - $_[0] = undef; - $self = undef; - $RA = undef; - $ra = Git::SVN::Ra->new($full_url); - $ra_invalid = 1; - } + + if ($old_url =~ m#^svn(\+ssh)?://#) { + $_[0] = undef; + $self = undef; + $RA = undef; + $ra = Git::SVN::Ra->new($full_url); + $ra_invalid = 1; + } elsif ($old_url ne $full_url) { + SVN::_Ra::svn_ra_reparent($self->{session}, $full_url, $pool); + $self->{url} = $full_url; + $reparented = 1; } + $ra ||= $self; my $reporter = $ra->do_switch($rev_b, '', 1, $url_b, $editor, $pool); my @lock = $SVN::Core::VERSION ge '1.2.0' ? (undef) : (); diff --git a/t/t9126-git-svn-follow-deleted-readded-directory.sh b/t/t9126-git-svn-follow-deleted-readded-directory.sh new file mode 100755 index 0000000000..edec640e97 --- /dev/null +++ b/t/t9126-git-svn-follow-deleted-readded-directory.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Copyright (c) 2008 Alec Berryman + +test_description='git svn fetch repository with deleted and readded directory' + +. ./lib-git-svn.sh + +# Don't run this by default; it opens up a port. +require_svnserve + +test_expect_success 'load repository' ' + svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9126/follow-deleted-readded.dump + ' + +test_expect_success 'fetch repository' ' + start_svnserve && + git svn init svn://127.0.0.1:$SVNSERVE_PORT && + git svn fetch + ' + +test_done diff --git a/t/t9126/follow-deleted-readded.dump b/t/t9126/follow-deleted-readded.dump new file mode 100644 index 0000000000..19da5d1ddc --- /dev/null +++ b/t/t9126/follow-deleted-readded.dump @@ -0,0 +1,201 @@ +SVN-fs-dump-format-version: 2 + +UUID: 1807dc6f-c693-4cda-9710-00e1be8c1f21 + +Revision-number: 0 +Prop-content-length: 56 +Content-length: 56 + +K 8 +svn:date +V 27 +2008-09-14T19:53:13.006748Z +PROPS-END + +Revision-number: 1 +Prop-content-length: 111 +Content-length: 111 + +K 7 +svn:log +V 12 +Create trunk +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:13.239689Z +PROPS-END + +Node-path: trunk +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Revision-number: 2 +Prop-content-length: 119 +Content-length: 119 + +K 7 +svn:log +V 20 +Create trunk/project +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:13.548860Z +PROPS-END + +Node-path: trunk/project +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Revision-number: 3 +Prop-content-length: 111 +Content-length: 111 + +K 7 +svn:log +V 12 +add new file +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:15.433630Z +PROPS-END + +Node-path: trunk/project/foo +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 4 +Text-content-md5: d3b07384d113edec49eaa6238ad5ff00 +Content-length: 14 + +PROPS-END +foo + + +Revision-number: 4 +Prop-content-length: 116 +Content-length: 116 + +K 7 +svn:log +V 17 +change foo to bar +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:17.339884Z +PROPS-END + +Node-path: trunk/project/foo +Node-kind: file +Node-action: change +Text-content-length: 4 +Text-content-md5: c157a79031e1c40f85931829bc5fc552 +Content-length: 4 + +bar + + +Revision-number: 5 +Prop-content-length: 114 +Content-length: 114 + +K 7 +svn:log +V 15 +don't like that +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:19.335001Z +PROPS-END + +Node-path: trunk/project +Node-action: delete + + +Revision-number: 6 +Prop-content-length: 110 +Content-length: 110 + +K 7 +svn:log +V 11 +reset trunk +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:19.845897Z +PROPS-END + +Node-path: trunk/project +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 4 +Node-copyfrom-path: trunk/project + + +Revision-number: 7 +Prop-content-length: 113 +Content-length: 113 + +K 7 +svn:log +V 14 +change to quux +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:21.367947Z +PROPS-END + +Node-path: trunk/project/foo +Node-kind: file +Node-action: change +Text-content-length: 5 +Text-content-md5: d3b07a382ec010c01889250fce66fb13 +Content-length: 5 + +quux + + From 61aeeefd296249b4a78421048adbd78d9fab474a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 6 Sep 2008 20:18:18 -0700 Subject: [PATCH 12/41] git-svn: fix handling of even funkier branch names Apparently do_switch() tolerates the lack of escaping in less funky branch names. For the really strange and scary ones, we need to escape them properly. It strangely maintains compatible with the existing handling of branch names with spaces and exclamation marks. Reported-by: m.skoric@web.de ($gmane/94677) Signed-off-by: Eric Wong --- git-svn.perl | 1 + t/t9118-git-svn-funky-branch-names.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/git-svn.perl b/git-svn.perl index 4e9d755066..7c7fc39483 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -3983,6 +3983,7 @@ sub gs_do_switch { } $ra ||= $self; + $url_b = escape_url($url_b); my $reporter = $ra->do_switch($rev_b, '', 1, $url_b, $editor, $pool); my @lock = $SVN::Core::VERSION ge '1.2.0' ? (undef) : (); $reporter->set_path('', $rev_a, 0, @lock, $pool); diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh index 3281cbd347..43ceb75d59 100755 --- a/t/t9118-git-svn-funky-branch-names.sh +++ b/t/t9118-git-svn-funky-branch-names.sh @@ -6,6 +6,10 @@ test_description='git-svn funky branch names' . ./lib-git-svn.sh +# Abo-Uebernahme (Bug #994) +scary_uri='Abo-Uebernahme%20%28Bug%20%23994%29' +scary_ref='Abo-Uebernahme%20(Bug%20#994)' + test_expect_success 'setup svnrepo' ' mkdir project project/trunk project/branches project/tags && echo foo > project/trunk/foo && @@ -15,6 +19,8 @@ test_expect_success 'setup svnrepo' ' "$svnrepo/pr ject/branches/fun plugin" && svn cp -m "more fun!" "$svnrepo/pr ject/branches/fun plugin" \ "$svnrepo/pr ject/branches/more fun plugin!" && + svn cp -m "scary" "$svnrepo/pr ject/branches/fun plugin" \ + "$svnrepo/pr ject/branches/$scary_uri" && start_httpd ' @@ -23,6 +29,7 @@ test_expect_success 'test clone with funky branch names' ' cd project && git rev-parse "refs/remotes/fun%20plugin" && git rev-parse "refs/remotes/more%20fun%20plugin!" && + git rev-parse "refs/remotes/$scary_ref" && cd .. ' @@ -35,6 +42,15 @@ test_expect_success 'test dcommit to funky branch' " cd .. " +test_expect_success 'test dcommit to scary branch' ' + cd project && + git reset --hard "refs/remotes/$scary_ref" && + echo urls are scary >> foo && + git commit -m "eep" -- foo && + git svn dcommit && + cd .. + ' + stop_httpd test_done From c882c01ef9c5a82c1282fd1cb094bb8f97472d7d Mon Sep 17 00:00:00 2001 From: Garry Dolley Date: Tue, 16 Sep 2008 23:20:39 -0700 Subject: [PATCH 13/41] Clarified gitattributes documentation regarding custom hunk header. The only part of the hunk header that we can change is the "TEXT" portion. Additionally, a few grammatical errors have been corrected. Signed-off-by: Garry Dolley Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 94e6752aa2..89627688b8 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -270,27 +270,27 @@ See linkgit:git[1] for details. Defining a custom hunk-header ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Each group of changes (called "hunk") in the textual diff output +Each group of changes (called a "hunk") in the textual diff output is prefixed with a line of the form: @@ -k,l +n,m @@ TEXT -The text is called 'hunk header', and by default a line that -begins with an alphabet, an underscore or a dollar sign is used, -which matches what GNU 'diff -p' output uses. This default -selection however is not suited for some contents, and you can -use customized pattern to make a selection. +This is called a 'hunk header'. The "TEXT" portion is by default a line +that begins with an alphabet, an underscore or a dollar sign; this +matches what GNU 'diff -p' output uses. This default selection however +is not suited for some contents, and you can use a customized pattern +to make a selection. -First in .gitattributes, you would assign the `diff` attribute +First, in .gitattributes, you would assign the `diff` attribute for paths. ------------------------ *.tex diff=tex ------------------------ -Then, you would define "diff.tex.funcname" configuration to +Then, you would define a "diff.tex.funcname" configuration to specify a regular expression that matches a line that you would -want to appear as the hunk header, like this: +want to appear as the hunk header "TEXT", like this: ------------------------ [diff "tex"] From 53c3967647f79f1563d028d442f81cabba451ca6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 5 Sep 2008 14:26:29 -0400 Subject: [PATCH 14/41] gitweb: avoid warnings for commits without body In the unusual case when there is no commit message, gitweb would output an uninitialized value warning. Signed-off-by: Joey Hess Acked-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 90cd99bf91..269f1125d9 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2092,7 +2092,7 @@ sub parse_commit_text { last; } } - if ($co{'title'} eq "") { + if (! defined $co{'title'} || $co{'title'} eq "") { $co{'title'} = $co{'title_short'} = '(no commit message)'; } # remove added spaces From f1265cc9ff977b497d805245dbd2454e46ef2710 Mon Sep 17 00:00:00 2001 From: Charles Bailey Date: Thu, 18 Sep 2008 21:01:13 +0100 Subject: [PATCH 15/41] Add new test to demonstrate git archive core.autocrlf inconsistency Signed-off-by: Charles Bailey Signed-off-by: Junio C Hamano --- t/t0024-crlf-archive.sh | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 t/t0024-crlf-archive.sh diff --git a/t/t0024-crlf-archive.sh b/t/t0024-crlf-archive.sh new file mode 100644 index 0000000000..35114396c6 --- /dev/null +++ b/t/t0024-crlf-archive.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +test_description='respect crlf in git archive' + +. ./test-lib.sh +UNZIP=${UNZIP:-unzip} + +test_expect_success setup ' + + git config core.autocrlf true + + printf "CRLF line ending\r\nAnd another\r\n" > sample && + git add sample && + + test_tick && + git commit -m Initial + +' + +test_expect_success 'tar archive' ' + + git archive --format=tar HEAD | + ( mkdir untarred && cd untarred && "$TAR" -xf - ) + + test_cmp sample untarred/sample + +' + +"$UNZIP" -v >/dev/null 2>&1 +if [ $? -eq 127 ]; then + echo "Skipping ZIP test, because unzip was not found" + test_done + exit +fi + +test_expect_failure 'zip archive' ' + + git archive --format=zip HEAD >test.zip && + + ( mkdir unzipped && cd unzipped && unzip ../test.zip ) && + + test_cmp sample unzipped/sample + +' + +test_done From b99b5b40cffb5269e4aa38b6b60391b55039e27d Mon Sep 17 00:00:00 2001 From: Charles Bailey Date: Thu, 18 Sep 2008 21:01:20 +0100 Subject: [PATCH 16/41] Make git archive respect core.autocrlf when creating zip format archives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is currently no call to git_config at the start of cmd_archive. When creating tar archives the core config is read as a side-effect of reading the tar specific config, but this doesn't happen for zip archives. The consequence is that in a configuration with core.autocrlf set, although files in a tar archive are created with crlf line endings, files in a zip archive retain unix line endings. Signed-off-by: Charles Bailey Acked-by: René Scharfe Signed-off-by: Junio C Hamano --- builtin-archive.c | 2 ++ t/t0024-crlf-archive.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/builtin-archive.c b/builtin-archive.c index 5ceec433fd..432ce2acc6 100644 --- a/builtin-archive.c +++ b/builtin-archive.c @@ -111,6 +111,8 @@ int cmd_archive(int argc, const char **argv, const char *prefix) { const char *remote = NULL; + git_config(git_default_config, NULL); + remote = extract_remote_arg(&argc, argv); if (remote) return run_remote_archiver(remote, argc, argv); diff --git a/t/t0024-crlf-archive.sh b/t/t0024-crlf-archive.sh index 35114396c6..e5330395fc 100644 --- a/t/t0024-crlf-archive.sh +++ b/t/t0024-crlf-archive.sh @@ -33,7 +33,7 @@ if [ $? -eq 127 ]; then exit fi -test_expect_failure 'zip archive' ' +test_expect_success 'zip archive' ' git archive --format=zip HEAD >test.zip && From e32c0a9c38a126c9eb8ff8f2fdc1fb8875400bbe Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Fri, 19 Sep 2008 00:24:46 +0200 Subject: [PATCH 17/41] sha1_file: link() returns -1 on failure, not errno 5723fe7 (Avoid cross-directory renames and linking on object creation, 2008-06-14) changed the call to use link() directly instead of through a custom wrapper, but forgot that it returns 0 or -1, not 0 or errno. Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- sha1_file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sha1_file.c b/sha1_file.c index 477d3fb4b0..e2cb342a32 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2136,7 +2136,9 @@ static void write_sha1_file_prepare(const void *buf, unsigned long len, */ int move_temp_to_file(const char *tmpfile, const char *filename) { - int ret = link(tmpfile, filename); + int ret = 0; + if (link(tmpfile, filename)) + ret = errno; /* * Coda hack - coda doesn't like cross-directory links, From aa5735bed459be71473b4fda1a9a026f798acf76 Mon Sep 17 00:00:00 2001 From: Eric Raible Date: Wed, 10 Sep 2008 17:40:20 -0700 Subject: [PATCH 18/41] completion: git commit should list --interactive Signed-off-by: Eric Raible Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1154ae1ac8..3bc45f6b47 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -750,7 +750,7 @@ _git_commit () --*) __gitcomp " --all --author= --signoff --verify --no-verify - --edit --amend --include --only + --edit --amend --include --only --interactive " return esac From 264e0b9a3c090930eec8dd16ecacf551dc685ac1 Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Fri, 19 Sep 2008 22:12:53 +0200 Subject: [PATCH 19/41] Bust the ghost of long-defunct diffcore-pathspec. This concept was retired by 77882f6 (Retire diffcore-pathspec., 2006-04-10), more than 2 years ago. Signed-off-by: Yann Dirson Signed-off-by: Junio C Hamano --- Documentation/gitdiffcore.txt | 55 ++++++++++++++--------------------- diffcore.h | 1 - 2 files changed, 22 insertions(+), 34 deletions(-) diff --git a/Documentation/gitdiffcore.txt b/Documentation/gitdiffcore.txt index 2bdbc3d4f6..e8041bc08f 100644 --- a/Documentation/gitdiffcore.txt +++ b/Documentation/gitdiffcore.txt @@ -36,11 +36,25 @@ files: - 'git-diff-tree' compares contents of two "tree" objects; -In all of these cases, the commands themselves compare -corresponding paths in the two sets of files. The result of -comparison is passed from these commands to what is internally -called "diffcore", in a format similar to what is output when -the -p option is not used. E.g. +In all of these cases, the commands themselves first optionally limit +the two sets of files by any pathspecs given on their command-lines, +and compare corresponding paths in the two resulting sets of files. + +The pathspecs are used to limit the world diff operates in. They remove +the filepairs outside the specified sets of pathnames. E.g. If the +input set of filepairs included: + +------------------------------------------------ +:100644 100644 bcd1234... 0123456... M junkfile +------------------------------------------------ + +but the command invocation was `git diff-files myfile`, then the +junkfile entry would be removed from the list because only "myfile" +is under consideration. + +The result of comparison is passed from these commands to what is +internally called "diffcore", in a format similar to what is output +when the -p option is not used. E.g. ------------------------------------------------ in-place edit :100644 100644 bcd1234... 0123456... M file0 @@ -52,9 +66,8 @@ unmerged :000000 000000 0000000... 0000000... U file6 The diffcore mechanism is fed a list of such comparison results (each of which is called "filepair", although at this point each of them talks about a single file), and transforms such a list -into another list. There are currently 6 such transformations: +into another list. There are currently 5 such transformations: -- diffcore-pathspec - diffcore-break - diffcore-rename - diffcore-merge-broken @@ -62,38 +75,14 @@ into another list. There are currently 6 such transformations: - diffcore-order These are applied in sequence. The set of filepairs 'git-diff-{asterisk}' -commands find are used as the input to diffcore-pathspec, and -the output from diffcore-pathspec is used as the input to the +commands find are used as the input to diffcore-break, and +the output from diffcore-break is used as the input to the next transformation. The final result is then passed to the output routine and generates either diff-raw format (see Output format sections of the manual for 'git-diff-{asterisk}' commands) or diff-patch format. -diffcore-pathspec: For Ignoring Files Outside Our Consideration ---------------------------------------------------------------- - -The first transformation in the chain is diffcore-pathspec, and -is controlled by giving the pathname parameters to the -'git-diff-{asterisk}' commands on the command line. The pathspec is used -to limit the world diff operates in. It removes the filepairs -outside the specified set of pathnames. E.g. If the input set -of filepairs included: - ------------------------------------------------- -:100644 100644 bcd1234... 0123456... M junkfile ------------------------------------------------- - -but the command invocation was `git diff-files myfile`, then the -junkfile entry would be removed from the list because only "myfile" -is under consideration. - -Implementation note. For performance reasons, 'git-diff-tree' -uses the pathname parameters on the command line to cull set of -filepairs it feeds the diffcore mechanism itself, and does not -use diffcore-pathspec, but the end result is the same. - - diffcore-break: For Splitting Up "Complete Rewrites" ---------------------------------------------------- diff --git a/diffcore.h b/diffcore.h index cc96c20734..8ae35785fd 100644 --- a/diffcore.h +++ b/diffcore.h @@ -92,7 +92,6 @@ extern struct diff_filepair *diff_queue(struct diff_queue_struct *, struct diff_filespec *); extern void diff_q(struct diff_queue_struct *, struct diff_filepair *); -extern void diffcore_pathspec(const char **pathspec); extern void diffcore_break(int); extern void diffcore_rename(struct diff_options *); extern void diffcore_merge_broken(void); From 02ed24580eeb03cb6e68967bd55457d9ab978b7c Mon Sep 17 00:00:00 2001 From: Fabrizio Chiarello Date: Fri, 19 Sep 2008 14:07:26 +0200 Subject: [PATCH 20/41] builtin-clone: fix typo Signed-off-by: Fabrizio Chiarello Signed-off-by: Junio C Hamano --- builtin-clone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin-clone.c b/builtin-clone.c index c8435295ce..5b40e07ba7 100644 --- a/builtin-clone.c +++ b/builtin-clone.c @@ -58,7 +58,7 @@ static struct option builtin_clone_options[] = { OPT_STRING(0, "reference", &option_reference, "repo", "reference repository"), OPT_STRING('o', "origin", &option_origin, "branch", - "use instead or 'origin' to track upstream"), + "use instead of 'origin' to track upstream"), OPT_STRING('u', "upload-pack", &option_upload_pack, "path", "path to git-upload-pack on the remote"), OPT_STRING(0, "depth", &option_depth, "depth", From 597faa00fdf69491c331f748fc62453726354629 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 19 Sep 2008 15:42:30 +0200 Subject: [PATCH 21/41] Typo "bogos" in format-patch error message. Signed-off-by: Junio C Hamano --- builtin-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin-log.c b/builtin-log.c index 911fd65990..2efe593734 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -835,7 +835,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) committer = git_committer_info(IDENT_ERROR_ON_NO_NAME); endpos = strchr(committer, '>'); if (!endpos) - die("bogos committer info %s\n", committer); + die("bogus committer info %s\n", committer); add_signoff = xmemdupz(committer, endpos - committer + 1); } else if (!strcmp(argv[i], "--attach")) { From 8d11fdeaf6735163e4af3fff699293e8250c07c3 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 19 Sep 2008 15:43:48 +0200 Subject: [PATCH 22/41] git-repack uses --no-repack-object, not --no-repack-delta. Signed-off-by: Junio C Hamano --- Documentation/git-repack.txt | 2 +- git-repack.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt index 38ac60947b..bbe1485a97 100644 --- a/Documentation/git-repack.txt +++ b/Documentation/git-repack.txt @@ -60,7 +60,7 @@ OPTIONS linkgit:git-pack-objects[1]. -f:: - Pass the `--no-reuse-delta` option to 'git-pack-objects'. See + Pass the `--no-reuse-object` option to `git-pack-objects`, see linkgit:git-pack-objects[1]. -q:: diff --git a/git-repack.sh b/git-repack.sh index 683960b04d..d39eb6cea6 100755 --- a/git-repack.sh +++ b/git-repack.sh @@ -10,7 +10,7 @@ git repack [options] a pack everything in a single pack A same as -a, and turn unreachable objects loose d remove redundant packs, and run git-prune-packed -f pass --no-reuse-delta to git-pack-objects +f pass --no-reuse-object to git-pack-objects n do not run git-update-server-info q,quiet be quiet l pass --local to git-pack-objects From cc185a6a8ac24737a26ec4b40cc401c2db8b2e97 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 19 Sep 2008 23:15:13 -0700 Subject: [PATCH 23/41] Start draft release notes for 1.6.0.3 Signed-off-by: Junio C Hamano --- Documentation/RelNotes-1.6.0.3.txt | 29 +++++++++++++++++++++++++++++ RelNotes | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 Documentation/RelNotes-1.6.0.3.txt diff --git a/Documentation/RelNotes-1.6.0.3.txt b/Documentation/RelNotes-1.6.0.3.txt new file mode 100644 index 0000000000..ea1420d77a --- /dev/null +++ b/Documentation/RelNotes-1.6.0.3.txt @@ -0,0 +1,29 @@ +GIT v1.6.0.3 Release Notes +========================== + +Fixes since v1.6.0.2 +-------------------- + +* "git archive --format=zip" did not honor core.autocrlf while + --format=tar did. + +* Continuing "git rebase -i" was very confused when the user left modified + files in the working tree while resolving conflicts. + +* Continuing "git rebase -i" was also very confused when the user left + some staged changes in the index after "edit". + +* Behaviour of "git diff --quiet" was inconsistent with "diff --exit-code" + with the output redirected to /dev/null. + +* "Git.pm" tests relied on unnecessarily more recent version of Perl. + +* "gitweb" triggered undef warning on commits without log messages. + +Many other documentation updates. + +-- +exec >/var/tmp/1 +O=v1.6.0.2-32-g8d11fde +echo O=$(git describe maint) +git shortlog --no-merges $O..maint diff --git a/RelNotes b/RelNotes index 726bff6d9f..a677737b90 120000 --- a/RelNotes +++ b/RelNotes @@ -1 +1 @@ -Documentation/RelNotes-1.6.0.2.txt \ No newline at end of file +Documentation/RelNotes-1.6.0.3.txt \ No newline at end of file From 7d20e2189e19f51662353ea853891e00882d29cc Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Mon, 22 Sep 2008 10:57:51 +0200 Subject: [PATCH 24/41] make "git remote" report multiple URLs This patch makes "git remote -v" and "git remote show" report multiple URLs rather than warn about them. Multiple URLs are OK for pushing into multiple repos simultaneously. Without "-v" each repo is shown once only. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- builtin-remote.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/builtin-remote.c b/builtin-remote.c index 01945a8651..1e2edc2050 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -652,10 +652,13 @@ static int get_one_entry(struct remote *remote, void *priv) { struct string_list *list = priv; - string_list_append(remote->name, list)->util = remote->url_nr ? - (void *)remote->url[0] : NULL; - if (remote->url_nr > 1) - warning("Remote %s has more than one URL", remote->name); + if (remote->url_nr > 0) { + int i; + + for (i = 0; i < remote->url_nr; i++) + string_list_append(remote->name, list)->util = (void *)remote->url[i]; + } else + string_list_append(remote->name, list)->util = NULL; return 0; } @@ -671,10 +674,14 @@ static int show_all(void) sort_string_list(&list); for (i = 0; i < list.nr; i++) { struct string_list_item *item = list.items + i; - printf("%s%s%s\n", item->string, - verbose ? "\t" : "", - verbose && item->util ? - (const char *)item->util : ""); + if (verbose) + printf("%s\t%s\n", item->string, + item->util ? (const char *)item->util : ""); + else { + if (i && !strcmp((item - 1)->string, item->string)) + continue; + printf("%s\n", item->string); + } } } return result; From 79bbc7fb078f8cabe04020c4619be9b571371398 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Mon, 22 Sep 2008 13:03:25 +0200 Subject: [PATCH 25/41] git-remote: do not use user input in a printf format string 'git remote show' substituted the remote name into a string that was later used as a printf format string. If a remote name contains a printf format specifier like this: $ git remote add foo%sbar . then the command $ git remote show foo%sbar would print garbage (if you are lucky) or crash. This fixes it. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- builtin-remote.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/builtin-remote.c b/builtin-remote.c index 01945a8651..4cb763f989 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -407,14 +407,15 @@ static int rm(int argc, const char **argv) return i; } -static void show_list(const char *title, struct string_list *list) +static void show_list(const char *title, struct string_list *list, + const char *extra_arg) { int i; if (!list->nr) return; - printf(title, list->nr > 1 ? "es" : ""); + printf(title, list->nr > 1 ? "es" : "", extra_arg); printf("\n "); for (i = 0; i < list->nr; i++) printf("%s%s", i ? " " : "", list->items[i].string); @@ -477,7 +478,6 @@ static int show(int argc, const char **argv) memset(&states, 0, sizeof(states)); for (; argc; argc--, argv++) { - struct strbuf buf; int i; get_remote_ref_states(*argv, &states, !no_query); @@ -503,18 +503,16 @@ static int show(int argc, const char **argv) } if (!no_query) { - strbuf_init(&buf, 0); - strbuf_addf(&buf, " New remote branch%%s (next fetch " - "will store in remotes/%s)", states.remote->name); - show_list(buf.buf, &states.new); - strbuf_release(&buf); + show_list(" New remote branch%s (next fetch " + "will store in remotes/%s)", + &states.new, states.remote->name); show_list(" Stale tracking branch%s (use 'git remote " - "prune')", &states.stale); + "prune')", &states.stale, ""); } if (no_query) for_each_ref(append_ref_to_tracked_list, &states); - show_list(" Tracked remote branch%s", &states.tracked); + show_list(" Tracked remote branch%s", &states.tracked, ""); if (states.remote->push_refspec_nr) { printf(" Local branch%s pushed with 'git push'\n ", From 18309f4c3e00886660f15e18c1aaab2f5bc25715 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Mon, 22 Sep 2008 07:30:08 -0400 Subject: [PATCH 26/41] Use dashless git commands in setgitperms.perl Signed-off-by: Todd Zullinger Signed-off-by: Junio C Hamano --- contrib/hooks/setgitperms.perl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/hooks/setgitperms.perl b/contrib/hooks/setgitperms.perl index dab7c8e3a1..a577ad095f 100644 --- a/contrib/hooks/setgitperms.perl +++ b/contrib/hooks/setgitperms.perl @@ -50,7 +50,7 @@ )) { die $usage; } die $usage unless ($read_mode xor $write_mode); -my $topdir = `git-rev-parse --show-cdup` or die "\n"; chomp $topdir; +my $topdir = `git rev-parse --show-cdup` or die "\n"; chomp $topdir; my $gitdir = $topdir . '.git'; my $gitmeta = $topdir . '.gitmeta'; @@ -155,7 +155,7 @@ open (OUT, ">$gitmeta.tmp") or die "Could not open $gitmeta.tmp for writing: $!\n"; } - my @files = `git-ls-files`; + my @files = `git ls-files`; my %dirs; foreach my $path (@files) { From 8b4eb6b6cd65042c6ecb4f06f19c1f2441899ed6 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Mon, 22 Sep 2008 19:20:21 +0200 Subject: [PATCH 27/41] Do not perform cross-directory renames when creating packs A comment on top of create_tmpfile() describes caveats ('can have problems on various systems (FAT, NFS, Coda)') that should apply in this situation as well. This in the end did not end up solving any of my personal problems, but it might be a useful cleanup patch nevertheless. Signed-off-by: Petr Baudis Acked-by: Linus Torvalds Signed-off-by: Junio C Hamano --- builtin-pack-objects.c | 2 +- fast-import.c | 4 ++-- index-pack.c | 2 +- pack-write.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 217fd49da9..4004e73e40 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -465,7 +465,7 @@ static void write_pack_file(void) char tmpname[PATH_MAX]; int fd; snprintf(tmpname, sizeof(tmpname), - "%s/tmp_pack_XXXXXX", get_object_directory()); + "%s/pack/tmp_pack_XXXXXX", get_object_directory()); fd = xmkstemp(tmpname); pack_tmp_name = xstrdup(tmpname); f = sha1fd(fd, pack_tmp_name); diff --git a/fast-import.c b/fast-import.c index d85b3a561f..5473cd4d62 100644 --- a/fast-import.c +++ b/fast-import.c @@ -816,7 +816,7 @@ static void start_packfile(void) int pack_fd; snprintf(tmpfile, sizeof(tmpfile), - "%s/tmp_pack_XXXXXX", get_object_directory()); + "%s/pack/tmp_pack_XXXXXX", get_object_directory()); pack_fd = xmkstemp(tmpfile); p = xcalloc(1, sizeof(*p) + strlen(tmpfile) + 2); strcpy(p->pack_name, tmpfile); @@ -878,7 +878,7 @@ static char *create_index(void) } snprintf(tmpfile, sizeof(tmpfile), - "%s/tmp_idx_XXXXXX", get_object_directory()); + "%s/pack/tmp_idx_XXXXXX", get_object_directory()); idx_fd = xmkstemp(tmpfile); f = sha1fd(idx_fd, tmpfile); sha1write(f, array, 256 * sizeof(int)); diff --git a/index-pack.c b/index-pack.c index a6e91fe3ba..530d820370 100644 --- a/index-pack.c +++ b/index-pack.c @@ -172,7 +172,7 @@ static char *open_pack_file(char *pack_name) if (!pack_name) { static char tmpfile[PATH_MAX]; snprintf(tmpfile, sizeof(tmpfile), - "%s/tmp_pack_XXXXXX", get_object_directory()); + "%s/pack/tmp_pack_XXXXXX", get_object_directory()); output_fd = xmkstemp(tmpfile); pack_name = xstrdup(tmpfile); } else diff --git a/pack-write.c b/pack-write.c index 939ed56362..3621f1dd32 100644 --- a/pack-write.c +++ b/pack-write.c @@ -45,7 +45,7 @@ char *write_idx_file(char *index_name, struct pack_idx_entry **objects, if (!index_name) { static char tmpfile[PATH_MAX]; snprintf(tmpfile, sizeof(tmpfile), - "%s/tmp_idx_XXXXXX", get_object_directory()); + "%s/pack/tmp_idx_XXXXXX", get_object_directory()); fd = xmkstemp(tmpfile); index_name = xstrdup(tmpfile); } else { From db87e3960c5a770db13c9ba9602b5e88848e2d1a Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Mon, 22 Sep 2008 18:34:26 -0500 Subject: [PATCH 28/41] builtin-prune.c: prune temporary packs in /pack directory Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano --- builtin-prune.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/builtin-prune.c b/builtin-prune.c index c767a0ac89..1663f8bdb1 100644 --- a/builtin-prune.c +++ b/builtin-prune.c @@ -13,7 +13,7 @@ static const char * const prune_usage[] = { static int show_only; static unsigned long expire; -static int prune_tmp_object(char *path, const char *filename) +static int prune_tmp_object(const char *path, const char *filename) { const char *fullpath = mkpath("%s/%s", path, filename); if (expire) { @@ -110,24 +110,22 @@ static void prune_object_dir(const char *path) /* * Write errors (particularly out of space) can result in * failed temporary packs (and more rarely indexes and other - * files begining with "tmp_") accumulating in the - * object directory. + * files begining with "tmp_") accumulating in the object + * and the pack directories. */ -static void remove_temporary_files(void) +static void remove_temporary_files(const char *path) { DIR *dir; struct dirent *de; - char* dirname=get_object_directory(); - dir = opendir(dirname); + dir = opendir(path); if (!dir) { - fprintf(stderr, "Unable to open object directory %s\n", - dirname); + fprintf(stderr, "Unable to open directory %s\n", path); return; } while ((de = readdir(dir)) != NULL) if (!prefixcmp(de->d_name, "tmp_")) - prune_tmp_object(dirname, de->d_name); + prune_tmp_object(path, de->d_name); closedir(dir); } @@ -141,6 +139,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix) "expire objects older than