From 3e03aaf523331d4f3e92e680f75e6053d1813b64 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 28 Sep 2005 12:56:18 -0700 Subject: [PATCH 1/7] Update the case table in t/t1000. It still talked about "the proposed alternative semantics" but we have used those alternative semantics for quite some time. Update them to avoid confusion. Signed-off-by: Junio C Hamano --- t/t1000-read-tree-m-3way.sh | 43 +++++++++++-------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh index c387e9ea08..d0af8c3d52 100755 --- a/t/t1000-read-tree-m-3way.sh +++ b/t/t1000-read-tree-m-3way.sh @@ -158,49 +158,33 @@ test_expect_success \ We have so far tested only empty index and clean-and-matching-A index case which are trivial. Make sure index requirements are also -checked. The table also lists alternative semantics which is not -currently implemented. +checked. -"git-diff-tree -m O A B" +"git-read-tree -m O A B" O A B result index requirements ------------------------------------------------------------------- 1 missing missing missing - must not exist. ------------------------------------------------------------------ - 2 missing missing exists no merge must not exist. - ------------------------------------ - (ALT) take B* must match B, if exists. + 2 missing missing exists take B* must match B, if exists. ------------------------------------------------------------------ - 3 missing exists missing no merge must match A and be - up-to-date, if exists. - ------------------------------------ - (ALT) take A* must match A, if exists. + 3 missing exists missing take A* must match A, if exists. ------------------------------------------------------------------ 4 missing exists A!=B no merge must match A and be up-to-date, if exists. ------------------------------------------------------------------ - 5 missing exists A==B no merge must match A and be - up-to-date, if exists. - ------------------------------------ - (ALT) take A must match A, if exists. + 5 missing exists A==B take A must match A, if exists. ------------------------------------------------------------------ - 6 exists missing missing no merge must not exist. - ------------------------------------ - (ALT) remove must not exist. + 6 exists missing missing remove must not exist. ------------------------------------------------------------------ 7 exists missing O!=B no merge must not exist. ------------------------------------------------------------------ - 8 exists missing O==B no merge must not exist. - ------------------------------------ - (ALT) remove must not exist. + 8 exists missing O==B remove must not exist. ------------------------------------------------------------------ 9 exists O!=A missing no merge must match A and be up-to-date, if exists. ------------------------------------------------------------------ - 10 exists O==A missing no merge must match A and be - up-to-date, if exists. - ------------------------------------ - (ALT) remove ditto + 10 exists O==A missing remove ditto ------------------------------------------------------------------ 11 exists O!=A O!=B no merge must match A and be A!=B up-to-date, if exists. @@ -210,10 +194,7 @@ currently implemented. ------------------------------------------------------------------ 13 exists O!=A O==B take A must match A, if exists. ------------------------------------------------------------------ - 14 exists O==A O!=B take B must match A and be - be up-to-date, if exists. - ------------------------------------ - (ALT) take B if exists, must either (1) + 14 exists O==A O!=B take B if exists, must either (1) match A and be up-to-date, or (2) match B. ------------------------------------------------------------------ @@ -223,9 +204,9 @@ currently implemented. *multi* in one in another ------------------------------------------------------------------- -Note: if we want to implement 2ALT and 3ALT we need to be careful. -The tree A may contain DF (file) when tree B require DF to be a -directory by having DF/DF (file). +Note: we need to be careful in case 2 and 3. The tree A may contain +DF (file) when tree B require DF to be a directory by having DF/DF +(file). END_OF_CASE_TABLE From 05dd8e2ee2ecba1b4ef1dbbde5c81281152604b4 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 25 Sep 2005 22:54:23 -0700 Subject: [PATCH 2/7] Fix default pull not to do an unintended Octopus. The refspecs specified in the .git/remotes/ on the "Pull: " lines are for fetching multiple heads in one go, but most of the time making an Octopus out of them is not what is wanted. Make git-fetch leave the marker in .git/FETCH_HEAD file so that later stages can tell which heads are for merging and which are not. Tom Prince made me realize how stupid the original behaviour was. Signed-off-by: Junio C Hamano --- git-fetch.sh | 32 ++++++++++++++++++++++++++++---- git-fmt-merge-msg.perl | 4 +++- git-parse-remote.sh | 11 +++++++++-- git-pull.sh | 4 +++- 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/git-fetch.sh b/git-fetch.sh index e4a6a68057..82d897231a 100755 --- a/git-fetch.sh +++ b/git-fetch.sh @@ -54,6 +54,10 @@ append_fetch_head () { remote_name_="$3" remote_nick_="$4" local_name_="$5" + case "$6" in + t) not_for_merge_='not-for-merge' ;; + '') not_for_merge_= ;; + esac # remote-nick is the URL given on the command line (or a shorthand) # remote-name is the $GIT_DIR relative refs/ path we computed @@ -78,10 +82,11 @@ append_fetch_head () { if git-cat-file commit "$head_" >/dev/null 2>&1 then headc_=$(git-rev-parse --verify "$head_^0") || exit - echo "$headc_ $note_" >>$GIT_DIR/FETCH_HEAD + echo "$headc_ $not_for_merge_ $note_" >>$GIT_DIR/FETCH_HEAD echo >&2 "* committish: $head_" echo >&2 " $note_" else + echo "$head_ not-for-merge $note_" >>$GIT_DIR/FETCH_HEAD echo >&2 "* non-commit: $head_" echo >&2 " $note_" fi @@ -157,6 +162,13 @@ do # These are relative path from $GIT_DIR, typically starting at refs/ # but may be HEAD + if expr "$ref" : '\.' >/dev/null + then + not_for_merge=t + ref=$(expr "$ref" : '\.\(.*\)') + else + not_for_merge= + fi if expr "$ref" : '\+' >/dev/null then single_force=t @@ -216,7 +228,8 @@ do continue ;; esac - append_fetch_head "$head" "$remote" "$remote_name" "$remote_nick" "$local_name" + append_fetch_head "$head" "$remote" \ + "$remote_name" "$remote_nick" "$local_name" "$not_for_merge" done @@ -241,16 +254,27 @@ http://* | https://* | rsync://* ) case "$ref" in +$remote_name:*) single_force=t + not_for_merge= + found="$ref" + break ;; + .+$remote_name:*) + single_force=t + not_for_merge=t + found="$ref" + break ;; + .$remote_name:*) + not_for_merge=t found="$ref" break ;; $remote_name:*) + not_for_merge= found="$ref" break ;; esac done - local_name=$(expr "$found" : '[^:]*:\(.*\)') - append_fetch_head "$sha1" "$remote" "$remote_name" "$remote_nick" "$local_name" + append_fetch_head "$sha1" "$remote" \ + "$remote_name" "$remote_nick" "$local_name" "$not_for_merge" done || exit ;; esac diff --git a/git-fmt-merge-msg.perl b/git-fmt-merge-msg.perl index f0f3100eb1..778388e254 100755 --- a/git-fmt-merge-msg.perl +++ b/git-fmt-merge-msg.perl @@ -31,6 +31,8 @@ sub andjoin { my ($bname, $tname, $gname, $src); chomp; s/^[0-9a-f]* //; + next if (/^not-for-merge/); + s/^ //; if (s/ of (.*)$//) { $src = $1; } else { @@ -86,7 +88,7 @@ sub andjoin { $src{$src}{GENERIC}); my $this = join(', ', @this); if ($src ne '.') { - $this .= " from $src"; + $this .= " of $src"; } push @msg, $this; } diff --git a/git-parse-remote.sh b/git-parse-remote.sh index a9db0cd825..4d8a572a99 100755 --- a/git-parse-remote.sh +++ b/git-parse-remote.sh @@ -65,8 +65,11 @@ get_remote_default_refs_for_push () { esac } -# Subroutine to canonicalize remote:local notation +# Subroutine to canonicalize remote:local notation. canon_refs_list_for_fetch () { + # Leave only the first one alone; add prefix . to the rest + # to prevent the secondary branches to be merged by default. + dot_prefix= for ref do force= @@ -91,7 +94,8 @@ canon_refs_list_for_fetch () { heads/* | tags/* ) local="refs/$local" ;; *) local="refs/heads/$local" ;; esac - echo "${force}${remote}:${local}" + echo "${dot_prefix}${force}${remote}:${local}" + dot_prefix=. done } @@ -107,6 +111,9 @@ get_remote_default_refs_for_fetch () { echo "refs/heads/${remote_branch}:refs/heads/$1" ;; remotes) + # This prefixes the second and later default refspecs + # with a '.', to signal git-fetch to mark them + # not-for-merge. canon_refs_list_for_fetch $(sed -ne '/^Pull: */{ s///p }' "$GIT_DIR/remotes/$1") diff --git a/git-pull.sh b/git-pull.sh index e3d11961b0..67c7f9562b 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -24,7 +24,9 @@ then die "You need to first update your working tree." fi -merge_head=$(sed -e 's/ .*//' "$GIT_DIR"/FETCH_HEAD | tr '\012' ' ') +merge_head=$(sed -e '/ not-for-merge /d' \ + -e 's/ .*//' "$GIT_DIR"/FETCH_HEAD | \ + tr '\012' ' ') case "$merge_head" in '') From 60fa056052b8233c22098a711ab780679d0c5b7e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 28 Sep 2005 16:29:11 -0700 Subject: [PATCH 3/7] Fastpath the normal case by not checking that index matches HEAD. The merge strategy would check this itself and typically does it by using git-read-tree -m -u 3-way merge. Signed-off-by: Junio C Hamano --- git-merge.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/git-merge.sh b/git-merge.sh index 7607e819c3..5890c7b1c0 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -24,7 +24,9 @@ dropsave() { } savestate() { - git diff -r -z --name-only $head | cpio -0 -o >"$GIR_DIR/MERGE_SAVE" + # Stash away any local modifications. + git-diff-index -r -z --name-only $head | + cpio -0 -o >"$GIR_DIR/MERGE_SAVE" } restorestate() { @@ -149,12 +151,7 @@ esac # we use, it would operate on the index, possibly affecting the # working tree, and when resolved cleanly, have the desired tree # in the index -- this means that the index must be in sync with -# the $head commit. -files=$(git-diff-index --cached --name-only $head) || exit -if [ "$files" ]; then - echo >&2 "Dirty index: cannot merge (dirty: $files)" - exit 1 -fi +# the $head commit. The strategies are responsible to ensure this. case "$use_strategies" in ?*' '?*) From 49c188fa8ff599cb6863eb5d86bfdbe22f2b8496 Mon Sep 17 00:00:00 2001 From: Tom Prince Date: Tue, 27 Sep 2005 01:06:05 -0600 Subject: [PATCH 4/7] [PATCH] Add new programs to .gitignore. Signed-off-by: Tom Prince Signed-off-by: Junio C Hamano --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 145690f622..c3eb9543ff 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ git-diff-stages git-diff-tree git-fetch git-fetch-pack +git-fmt-merge-msg git-format-patch git-fsck-objects git-get-tar-commit-id @@ -86,6 +87,7 @@ git-tar-tree git-unpack-file git-unpack-objects git-update-index +git-update-ref git-update-server-info git-upload-pack git-var From 5acb6de13d7af33abcfcbdc885ec365e6a51c486 Mon Sep 17 00:00:00 2001 From: Nick Hengeveld Date: Tue, 27 Sep 2005 10:45:27 -0700 Subject: [PATCH 5/7] [PATCH] Support for more CURL SSL settings via environment variables Added support for additional CURL SSL settings via environment variables. Client certificate/key files can be specified as well as alternate CA information. Signed-off-by: Nick Hengeveld Signed-off-by: Junio C Hamano --- http-fetch.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/http-fetch.c b/http-fetch.c index 0caec10468..7fc363f8ea 100644 --- a/http-fetch.c +++ b/http-fetch.c @@ -36,6 +36,10 @@ static int local; static int zret; static int curl_ssl_verify; +static char *ssl_cert; +static char *ssl_key; +static char *ssl_capath; +static char *ssl_cainfo; struct buffer { @@ -522,6 +526,21 @@ int main(int argc, char **argv) curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL); #endif + if ((ssl_cert = getenv("GIT_SSL_CERT")) != NULL) { + curl_easy_setopt(curl, CURLOPT_SSLCERT, ssl_cert); + } + if ((ssl_key = getenv("GIT_SSL_KEY")) != NULL) { + curl_easy_setopt(curl, CURLOPT_SSLKEY, ssl_key); + } +#if LIBCURL_VERSION_NUM >= 0x070908 + if ((ssl_capath = getenv("GIT_SSL_CAPATH")) != NULL) { + curl_easy_setopt(curl, CURLOPT_CAPATH, ssl_capath); + } +#endif + if ((ssl_cainfo = getenv("GIT_SSL_CAINFO")) != NULL) { + curl_easy_setopt(curl, CURLOPT_CAINFO, ssl_cainfo); + } + alt = xmalloc(sizeof(*alt)); alt->base = url; alt->got_indices = 0; From a7928f8ec7fb3c368e6086ab48f41e33a22e1b94 Mon Sep 17 00:00:00 2001 From: Peter Hagervall Date: Wed, 28 Sep 2005 14:04:54 +0200 Subject: [PATCH 6/7] [PATCH] Make some needlessly global stuff static Insert 'static' where appropriate. Signed-off-by: Peter Hagervall Signed-off-by: Junio C Hamano --- fsck-objects.c | 4 ++-- http-fetch.c | 4 ++-- update-ref.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fsck-objects.c b/fsck-objects.c index b82685fd71..247edf0529 100644 --- a/fsck-objects.c +++ b/fsck-objects.c @@ -30,7 +30,7 @@ static void objreport(struct object *obj, const char *severity, fputs("\n", stderr); } -int objerror(struct object *obj, const char *err, ...) +static int objerror(struct object *obj, const char *err, ...) { va_list params; va_start(params, err); @@ -39,7 +39,7 @@ int objerror(struct object *obj, const char *err, ...) return -1; } -int objwarning(struct object *obj, const char *err, ...) +static int objwarning(struct object *obj, const char *err, ...) { va_list params; va_start(params, err); diff --git a/http-fetch.c b/http-fetch.c index 7fc363f8ea..33f3949252 100644 --- a/http-fetch.c +++ b/http-fetch.c @@ -27,7 +27,7 @@ struct alt_base struct alt_base *next; }; -struct alt_base *alt = NULL; +static struct alt_base *alt = NULL; static SHA_CTX c; static z_stream stream; @@ -354,7 +354,7 @@ static int fetch_pack(struct alt_base *repo, unsigned char *sha1) return 0; } -int fetch_object(struct alt_base *repo, unsigned char *sha1) +static int fetch_object(struct alt_base *repo, unsigned char *sha1) { char *hex = sha1_to_hex(sha1); char *filename = sha1_file_name(sha1); diff --git a/update-ref.c b/update-ref.c index 01496f6a92..1863b82324 100644 --- a/update-ref.c +++ b/update-ref.c @@ -6,7 +6,7 @@ static const char git_update_ref_usage[] = "git-update-ref [ Date: Tue, 27 Sep 2005 18:14:27 -0700 Subject: [PATCH 7/7] Use git-update-ref in scripts. This uses the git-update-ref command in scripts for safer updates. Also places where we used to read HEAD ref by using "cat" were fixed to use git-rev-parse. This will matter when we start using symbolic references. Signed-off-by: Junio C Hamano --- git-applypatch.sh | 5 +++-- git-commit.sh | 4 +++- git-fetch.sh | 34 ++++++++++++++++++---------------- git-merge.sh | 9 +++++---- git-octopus.sh | 2 +- git-pull.sh | 6 +++--- git-rebase.sh | 5 +++-- git-reset.sh | 2 +- git-resolve.sh | 4 ++-- 9 files changed, 39 insertions(+), 32 deletions(-) diff --git a/git-applypatch.sh b/git-applypatch.sh index fd594ed4e4..9f5a45bb2b 100755 --- a/git-applypatch.sh +++ b/git-applypatch.sh @@ -108,9 +108,10 @@ fi tree=$(git-write-tree) || exit 1 echo Wrote tree $tree -commit=$(git-commit-tree $tree -p $(cat "$GIT_DIR"/HEAD) < "$final") || exit 1 +parent=$(git-rev-parse --verify HEAD) && +commit=$(git-commit-tree $tree -p $parent <"$final") || exit 1 echo Committed: $commit -echo $commit > "$GIT_DIR"/HEAD +git-update-ref HEAD $commit $parent || exit if test -x "$GIT_DIR"/hooks/post-applypatch then diff --git a/git-commit.sh b/git-commit.sh index 18ad36158d..18b259c708 100755 --- a/git-commit.sh +++ b/git-commit.sh @@ -159,7 +159,9 @@ if [ ! -r "$GIT_DIR/HEAD" ]; then exit 1 fi PARENTS="" + current= else + current=$(git-rev-parse --verify HEAD) if [ -f "$GIT_DIR/MERGE_HEAD" ]; then PARENTS="-p HEAD "`sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD"` fi @@ -220,7 +222,7 @@ if test -s .cmitchk then tree=$(git-write-tree) && commit=$(cat .cmitmsg | git-commit-tree $tree $PARENTS) && - echo $commit > "$GIT_DIR/HEAD" && + git-update-ref HEAD $commit $current && rm -f -- "$GIT_DIR/MERGE_HEAD" else echo >&2 "* no commit message? aborting commit." diff --git a/git-fetch.sh b/git-fetch.sh index 82d897231a..27407c1d35 100755 --- a/git-fetch.sh +++ b/git-fetch.sh @@ -110,14 +110,16 @@ fast_forward_local () { else echo >&2 "* $1: storing $3" fi - echo "$2" >"$GIT_DIR/$1" ;; + git-update-ref "$1" "$2" + ;; refs/heads/*) - # NEEDSWORK: use the same cmpxchg protocol here. - echo "$2" >"$GIT_DIR/$1.lock" - if test -f "$GIT_DIR/$1" + # $1 is the ref being updated. + # $2 is the new value for the ref. + local=$(git-rev-parse --verify "$1^0" 2>/dev/null) + if test "$local" then - local=$(git-rev-parse --verify "$1^0") && + # Require fast-forward. mb=$(git-merge-base "$local" "$2") && case "$2,$mb" in $local,*) @@ -125,34 +127,34 @@ fast_forward_local () { ;; *,$local) echo >&2 "* $1: fast forward to $3" + git-update-ref "$1" "$2" "$local" ;; *) false ;; esac || { echo >&2 "* $1: does not fast forward to $3;" - case "$force,$single_force" in - t,* | *,t) + case ",$force,$single_force," in + *,t,*) echo >&2 " forcing update." + git-update-ref "$1" "$2" "$local" ;; *) - mv "$GIT_DIR/$1.lock" "$GIT_DIR/$1.remote" - echo >&2 " leaving it in '$1.remote'" + echo >&2 " not updating." ;; esac } else - echo >&2 "* $1: storing $3" + echo >&2 "* $1: storing $3" + git-update-ref "$1" "$2" fi - test -f "$GIT_DIR/$1.lock" && - mv "$GIT_DIR/$1.lock" "$GIT_DIR/$1" ;; esac } case "$update_head_ok" in '') - orig_head=$(cat "$GIT_DIR/HEAD" 2>/dev/null) + orig_head=$(git-rev-parse --verify HEAD 2>/dev/null) ;; esac @@ -196,7 +198,7 @@ do rsync://*) TMP_HEAD="$GIT_DIR/TMP_HEAD" rsync -L -q "$remote/$remote_name" "$TMP_HEAD" || exit 1 - head=$(git-rev-parse TMP_HEAD) + head=$(git-rev-parse --verify TMP_HEAD) rm -f "$TMP_HEAD" test "$rsync_slurped_objects" || { rsync -av --ignore-existing --exclude info \ @@ -285,10 +287,10 @@ case ",$update_head_ok,$orig_head," in *,, | t,* ) ;; *) - curr_head=$(cat "$GIT_DIR/HEAD" 2>/dev/null) + curr_head=$(git-rev-parse --verify HEAD 2>/dev/null) if test "$curr_head" != "$orig_head" then - echo "$orig_head" >$GIT_DIR/HEAD + git-update-ref HEAD "$orig_head" die "Cannot fetch into the current branch." fi ;; diff --git a/git-merge.sh b/git-merge.sh index 5890c7b1c0..29e86c6953 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -116,8 +116,9 @@ case "$#,$common" in # Again the most common case of merging one remote. echo "Updating from $head to $1." git-update-index --refresh 2>/dev/null - git-read-tree -u -m $head "$1" || exit 1 - git-rev-parse --verify "$1^0" > "$GIT_DIR/HEAD" + git-read-tree -u -m $head "$1" && + new_head=$(git-rev-parse --verify "$1^0") && + git-update-ref HEAD "$new_head" "$head" || exit 1 summary "$1" dropsave exit 0 @@ -215,9 +216,9 @@ then do parents="$parents -p $remote" done - result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree $parents) + result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree $parents) || exit echo "Committed merge $result_commit, made by $wt_strategy." - echo $result_commit >"$GIT_DIR/HEAD" + git-update-ref HEAD $result_commit $head summary $result_commit dropsave exit 0 diff --git a/git-octopus.sh b/git-octopus.sh index abc682025e..d2471af3c8 100755 --- a/git-octopus.sh +++ b/git-octopus.sh @@ -86,5 +86,5 @@ esac result_commit=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD" | git-commit-tree $MRT $PARENT) echo "Committed merge $result_commit" -echo $result_commit >"$GIT_DIR"/HEAD +git-update-ref HEAD $result_commit $head git-diff-tree -p $head $result_commit | git-apply --stat diff --git a/git-pull.sh b/git-pull.sh index 67c7f9562b..1f4a05d09e 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -6,10 +6,10 @@ . git-sh-setup || die "Not a git archive" -orig_head=$(cat "$GIT_DIR/HEAD") || die "Pulling into a black hole?" +orig_head=$(git-rev-parse --verify HEAD) || die "Pulling into a black hole?" git-fetch --update-head-ok "$@" || exit 1 -curr_head=$(cat "$GIT_DIR/HEAD") +curr_head=$(git-rev-parse --verify HEAD) if test "$curr_head" != "$orig_head" then # The fetch involved updating the current branch. @@ -40,4 +40,4 @@ case "$merge_head" in esac merge_name=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") -git-resolve "$(cat "$GIT_DIR"/HEAD)" $merge_head "$merge_name" +git-resolve "$curr_head" $merge_head "$merge_name" diff --git a/git-rebase.sh b/git-rebase.sh index 49c8f12e51..fa95009091 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -33,7 +33,8 @@ test "$different1$different2" = "" || die "Your working tree does not match $ours_symbolic." git-read-tree -m -u $ours $upstream && -git-rev-parse --verify "$upstream^0" >"$GIT_DIR/HEAD" || exit +new_head=$(git-rev-parse --verify "$upstream^0") && +git-update-ref HEAD "$new_head" || exit tmp=.rebase-tmp$$ fail=$tmp-fail @@ -50,7 +51,7 @@ do continue ;; esac echo >&2 "* Applying: $msg" - S=`cat "$GIT_DIR/HEAD"` && + S=$(git-rev-parse --verify HEAD) && git-cherry-pick --replay $commit || { echo >&2 "* Not applying the patch and continuing." echo $commit >>$fail diff --git a/git-reset.sh b/git-reset.sh index dfa9cb8bb1..f9995cadf5 100755 --- a/git-reset.sh +++ b/git-reset.sh @@ -60,7 +60,7 @@ then else rm -f "$GIT_DIR/ORIG_HEAD" fi -echo "$rev" >"$GIT_DIR/HEAD" +git-update-ref HEAD "$rev" case "$reset_type" in --hard ) diff --git a/git-resolve.sh b/git-resolve.sh index 1f559d8cb9..7d8fb54f95 100755 --- a/git-resolve.sh +++ b/git-resolve.sh @@ -45,7 +45,7 @@ case "$common" in "$head") echo "Updating from $head to $merge." git-read-tree -u -m $head $merge || exit 1 - echo $merge > "$GIT_DIR"/HEAD + git-update-ref HEAD "$merge" "$head" git-diff-tree -p $head $merge | git-apply --stat dropheads exit 0 @@ -99,6 +99,6 @@ if [ $? -ne 0 ]; then fi result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree -p $head -p $merge) echo "Committed merge $result_commit" -echo $result_commit > "$GIT_DIR"/HEAD +git-update-ref HEAD "$result_commit" "$head" git-diff-tree -p $head $result_commit | git-apply --stat dropheads