From 8ff99e7417fcbff67d2c31445671fa97e44c95e7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 11 Jul 2006 12:01:54 -0700 Subject: [PATCH 1/9] tests: Set EDITOR=: and VISUAL=: globally This way we don't have to remember to set it for each test; and if we forget, we won't cause interactive editors to be spawned for non-interactive tests. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/annotate-tests.sh | 2 +- t/t1400-update-ref.sh | 1 - t/t4013-diff-various.sh | 2 +- t/test-lib.sh | 3 +++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh index 1148b0257d..b6a2edd887 100644 --- a/t/annotate-tests.sh +++ b/t/annotate-tests.sh @@ -94,7 +94,7 @@ test_expect_success \ test_expect_success \ 'merge-setup part 4' \ 'echo "evil merge." >>file && - EDITOR=: VISUAL=: git commit -a --amend' + git commit -a --amend' test_expect_success \ 'Two lines blamed on A, one on B, two on B1, one on B2, one on A U Thor' \ diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 6a3515dd71..04fab26621 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -190,7 +190,6 @@ test_expect_success \ GIT_COMMITTER_DATE="2005-05-26 23:41" git-commit -F M -a && h_OTHER=$(git-rev-parse --verify HEAD) && echo FIXED >F && - EDITOR=true \ GIT_AUTHOR_DATE="2005-05-26 23:44" \ GIT_COMMITTER_DATE="2005-05-26 23:44" git-commit --amend && h_FIXED=$(git-rev-parse --verify HEAD) && diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 06837d1c7c..36658fb17d 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -70,7 +70,7 @@ test_expect_success setup ' for i in 1 2; do echo $i; done >>dir/sub && git update-index file0 dir/sub && - EDITOR=: VISUAL=: git commit --amend && + git commit --amend && git show-branch ' diff --git a/t/test-lib.sh b/t/test-lib.sh index 05f6e79560..b0d7990a66 100755 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -9,6 +9,8 @@ LC_ALL=C PAGER=cat TZ=UTC export LANG LC_ALL PAGER TZ +EDITOR=: +VISUAL=: unset AUTHOR_DATE unset AUTHOR_EMAIL unset AUTHOR_NAME @@ -30,6 +32,7 @@ unset SHA1_FILE_DIRECTORIES unset SHA1_FILE_DIRECTORY export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME +export EDITOR VISUAL # Each test should start with something like this, after copyright notices: # From c3f17061be95de3498449a548e93883aebff23d6 Mon Sep 17 00:00:00 2001 From: Yakov Lerner Date: Tue, 11 Jul 2006 21:02:00 +0000 Subject: [PATCH 2/9] Mention the [user@] part in documentation of ssh:// urls. Signed-off-by: Yakov Lerner Signed-off-by: Junio C Hamano --- Documentation/urls.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/urls.txt b/Documentation/urls.txt index d60b37147a..9abec806d9 100644 --- a/Documentation/urls.txt +++ b/Documentation/urls.txt @@ -10,9 +10,9 @@ to name the remote repository: - https://host.xz/path/to/repo.git/ - git://host.xz/path/to/repo.git/ - git://host.xz/~user/path/to/repo.git/ -- ssh://host.xz/path/to/repo.git/ -- ssh://host.xz/~user/path/to/repo.git/ -- ssh://host.xz/~/path/to/repo.git +- ssh://[user@]host.xz/path/to/repo.git/ +- ssh://[user@]host.xz/~user/path/to/repo.git/ +- ssh://[user@]host.xz/~/path/to/repo.git =============================================================== SSH Is the default transport protocol and also supports an From 2a75848edd49b1c4e26ac58df40b989e7dad33e3 Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Tue, 11 Jul 2006 11:19:33 +0100 Subject: [PATCH 3/9] typofix (git-name-rev documentation) Signed-off-by: Alp Toker Signed-off-by: Junio C Hamano --- Documentation/git-name-rev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-name-rev.txt b/Documentation/git-name-rev.txt index 43f8c2593d..37fbf66efb 100644 --- a/Documentation/git-name-rev.txt +++ b/Documentation/git-name-rev.txt @@ -33,7 +33,7 @@ EXAMPLE ------- Given a commit, find out where it is relative to the local refs. Say somebody -wrote you about that phantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a. +wrote you about that fantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a. Of course, you look into the commit, but that only tells you what happened, but not the context. From d2216f231782b37c6379a533d4d845534651e93b Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Tue, 11 Jul 2006 11:19:37 +0100 Subject: [PATCH 4/9] git-send-email: Remove redundant Reply-To header There is no sense in duplicating the sender address in Reply-To as it's already provided in the From header. Signed-off-by: Alp Toker Signed-off-by: Junio C Hamano --- git-send-email.perl | 1 - 1 file changed, 1 deletion(-) diff --git a/git-send-email.perl b/git-send-email.perl index d7f5dce489..a83c7e9094 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -435,7 +435,6 @@ sub send_message To: $to Cc: $cc Subject: $subject -Reply-To: $from Date: $date Message-Id: $message_id X-Mailer: git-send-email $gitversion From 38d3874ddc5c15120c7fbbdcad26bf5478f58e98 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 11 Jul 2006 10:10:29 -0700 Subject: [PATCH 5/9] Make the unpacked object header functions static to sha1_file.c Nobody else uses them, and I'm going to start changing them. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- cache.h | 2 -- sha1_file.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cache.h b/cache.h index b5e3f8fa21..d433d46f23 100644 --- a/cache.h +++ b/cache.h @@ -219,8 +219,6 @@ int safe_create_leading_directories(char *path); char *enter_repo(char *path, int strict); /* Read and unpack a sha1 file into memory, write memory to a sha1 file */ -extern int unpack_sha1_header(z_stream *stream, void *map, unsigned long mapsize, void *buffer, unsigned long size); -extern int parse_sha1_header(char *hdr, char *type, unsigned long *sizep); extern int sha1_object_info(const unsigned char *, char *, unsigned long *); extern void * unpack_sha1_file(void *map, unsigned long mapsize, char *type, unsigned long *size); extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size); diff --git a/sha1_file.c b/sha1_file.c index 459430a56c..8734d501fe 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -684,7 +684,7 @@ static void *map_sha1_file_internal(const unsigned char *sha1, return map; } -int unpack_sha1_header(z_stream *stream, void *map, unsigned long mapsize, void *buffer, unsigned long size) +static int unpack_sha1_header(z_stream *stream, void *map, unsigned long mapsize, void *buffer, unsigned long size) { /* Get the data stream */ memset(stream, 0, sizeof(*stream)); @@ -720,7 +720,7 @@ static void *unpack_sha1_rest(z_stream *stream, void *buffer, unsigned long size * too permissive for what we want to check. So do an anal * object header parse by hand. */ -int parse_sha1_header(char *hdr, char *type, unsigned long *sizep) +static int parse_sha1_header(char *hdr, char *type, unsigned long *sizep) { int i; unsigned long size; From ed0e078f96a96ffe515899ef42051a568be4693a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 11 Jul 2006 14:06:39 -0700 Subject: [PATCH 6/9] git-fetch: fix a bashism (==) Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- git-fetch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-fetch.sh b/git-fetch.sh index c0d256c98b..ff1769952b 100755 --- a/git-fetch.sh +++ b/git-fetch.sh @@ -80,7 +80,7 @@ rref= rsync_slurped_objects= rloga="$rloga $remote_nick" -test "$remote_nick" == "$remote" || rloga="$rloga $remote" +test "$remote_nick" = "$remote" || rloga="$rloga $remote" if test "" = "$append" then From e1447e38c00bdc1904458cfabb4bb3ffb678a271 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Tue, 11 Jul 2006 01:52:54 -0400 Subject: [PATCH 7/9] Log ref changes made by git-merge and git-pull. When git-merge updates HEAD as a result of a merge record what happened during the merge into the reflog associated with HEAD (if any). The log reports who caused the update (git-merge or git-pull, by invoking git-merge), what the remote ref names were and the type of merge process used. The merge information can be useful when reviewing a reflog for a branch such as `master` where fast forward and trivial in index merges might be common as the user tracks an upstream. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- git-merge.sh | 17 ++++++++++++++--- git-pull.sh | 3 ++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/git-merge.sh b/git-merge.sh index 24e3b507ef..a9cfafb1df 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -58,7 +58,13 @@ squash_message () { } finish () { - test '' = "$2" || echo "$2" + if test '' = "$2" + then + rlogm="$rloga" + else + echo "$2" + rlogm="$rloga: $2" + fi case "$squash" in t) echo "Squash commit -- not updating HEAD" @@ -70,7 +76,7 @@ finish () { echo "No merge message -- not updating HEAD" ;; *) - git-update-ref HEAD "$1" "$head" || exit 1 + git-update-ref -m "$rlogm" HEAD "$1" "$head" || exit 1 ;; esac ;; @@ -88,6 +94,7 @@ finish () { esac } +rloga= while case "$#" in 0) break ;; esac do case "$1" in @@ -117,6 +124,9 @@ do die "available strategies are: $all_strategies" ;; esac ;; + --reflog-action=*) + rloga=`expr "z$1" : 'z-[^=]*=\(.*\)'` + ;; -*) usage ;; *) break ;; esac @@ -131,6 +141,7 @@ shift # All the rest are remote heads test "$#" = 0 && usage ;# we need at least one remote head. +test "$rloga" = '' && rloga="merge: $@" remoteheads= for remote @@ -316,7 +327,7 @@ if test '' != "$result_tree" then parents=$(git-show-branch --independent "$head" "$@" | sed -e 's/^/-p /') result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree $parents) || exit - finish "$result_commit" "Merge $result_commit, made by $wt_strategy." + finish "$result_commit" "Merge made by $wt_strategy." dropsave exit 0 fi diff --git a/git-pull.sh b/git-pull.sh index d337bf4da3..f380437997 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -102,5 +102,6 @@ case "$strategy_args" in esac merge_name=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") || exit -git-merge $no_summary $no_commit $squash $strategy_args \ +git-merge "--reflog-action=pull $*" \ + $no_summary $no_commit $squash $strategy_args \ "$merge_name" HEAD $merge_head From 09a28eccce58d349d93280fd3ac08c5ad0eaa3c5 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Tue, 11 Jul 2006 02:10:19 -0400 Subject: [PATCH 8/9] Log ref changes made by quiltimport. When importing a quilt patch to a branch which has a reflog record the update to HEAD with a log message indicating the change was made by quiltimport and what patch caused the change. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- git-quiltimport.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-quiltimport.sh b/git-quiltimport.sh index 364baff806..10135da3ac 100755 --- a/git-quiltimport.sh +++ b/git-quiltimport.sh @@ -112,7 +112,7 @@ for patch_name in $(cat "$QUILT_PATCHES/series" | grep -v '^#'); do git-apply --index -C1 "$tmp_patch" && tree=$(git-write-tree) && commit=$((echo "$SUBJECT"; echo; cat "$tmp_msg") | git-commit-tree $tree -p $commit) && - git-update-ref HEAD $commit || exit 4 + git-update-ref -m "quiltimport: $patch_name" HEAD $commit || exit 4 fi done rm -rf $tmp_dir || exit 5 From 5a6852fef1d76369d6dfcad1a40ca5287bb781a6 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Tue, 11 Jul 2006 02:25:09 -0400 Subject: [PATCH 9/9] Log ref changes made by resolve. Since git-resolve is essentially a form of git-merge record any ref updates it makes similiar to how git-merge would record them. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- git-resolve.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git-resolve.sh b/git-resolve.sh index 1c7aaefa25..a7bc680d90 100755 --- a/git-resolve.sh +++ b/git-resolve.sh @@ -15,6 +15,7 @@ dropheads() { head=$(git-rev-parse --verify "$1"^0) && merge=$(git-rev-parse --verify "$2"^0) && +merge_name="$2" && merge_msg="$3" || usage # @@ -43,7 +44,8 @@ case "$common" in "$head") echo "Updating from $head to $merge" git-read-tree -u -m $head $merge || exit 1 - git-update-ref HEAD "$merge" "$head" + git-update-ref -m "resolve $merge_name: Fast forward" \ + HEAD "$merge" "$head" git-diff-tree -p $head $merge | git-apply --stat dropheads exit 0 @@ -100,6 +102,7 @@ if [ $? -ne 0 ]; then fi result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree -p $head -p $merge) echo "Committed merge $result_commit" -git-update-ref HEAD "$result_commit" "$head" +git-update-ref -m "resolve $merge_name: In-index merge" \ + HEAD "$result_commit" "$head" git-diff-tree -p $head $result_commit | git-apply --stat dropheads