X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-am.sh;h=aa602618e6caedbfdd2d54ad4bb8375356cc55f6;hb=20f7a39825e30891056ab00ea620eaffda6aa451;hp=60aaa4a583d3e2466ea788d7047a9fc8252b1fe6;hpb=d1f2e1696ce168b3a70b59be7c58fa96c530d4fb;p=git.git diff --git a/git-am.sh b/git-am.sh index 60aaa4a58..aa602618e 100755 --- a/git-am.sh +++ b/git-am.sh @@ -6,12 +6,11 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= OPTIONS_SPEC="\ git am [options] [|...] -git am [options] --resolved -git am [options] --skip +git am [options] (--resolved | --skip | --abort) -- d,dotest= (removed -- do not use) i,interactive run interactively -b,binary pass --allow-binary-replacement to git-apply +b,binary (historical option -- no-op) 3,3way allow fall back on 3way merging if needed s,signoff add a Signed-off-by line to the commit message u,utf8 recode into utf8 (default) @@ -44,7 +43,7 @@ stop_here_user_resolve () { printf '%s\n' "$resolvemsg" stop_here $1 fi - cmdline=$(basename $0) + cmdline="git am" if test '' != "$interactive" then cmdline="$cmdline -i" @@ -88,7 +87,7 @@ fall_back_3way () { echo Using index info to reconstruct a base tree... if GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \ - git apply $binary --cached <"$dotest/patch" + git apply --cached <"$dotest/patch" then mv "$dotest/patch-merge-base+" "$dotest/patch-merge-base" mv "$dotest/patch-merge-tmp-index" "$dotest/patch-merge-index" @@ -121,8 +120,8 @@ It does not apply to blobs recorded in its index." } prec=4 -dotest="$GIT_DIR/rebase" -sign= utf8=t keep= skip= interactive= resolved= binary= rebasing= abort= +dotest="$GIT_DIR/rebase-apply" +sign= utf8=t keep= skip= interactive= resolved= rebasing= abort= resolvemsg= resume= git_apply_opt= @@ -132,7 +131,7 @@ do -i|--interactive) interactive=t ;; -b|--binary) - binary=t ;; + : ;; -3|--3way) threeway=t ;; -s|--signoff) @@ -150,7 +149,7 @@ do --abort) abort=t ;; --rebasing) - rebasing=t threeway=t keep=t binary=t ;; + rebasing=t threeway=t keep=t ;; -d|--dotest) die "-d option is no longer supported. Do not use." ;; @@ -202,8 +201,15 @@ then die "previous rebase directory $dotest still exists but mbox given." resume=yes - case "$abort" in - t) + case "$skip,$abort" in + t,) + git rerere clear + git read-tree --reset -u HEAD HEAD + orig_head=$(cat "$GIT_DIR/ORIG_HEAD") + git reset HEAD + git update-ref ORIG_HEAD $orig_head + ;; + ,t) git rerere clear git read-tree --reset -u HEAD ORIG_HEAD git reset ORIG_HEAD @@ -241,10 +247,9 @@ else exit 1 } - # -b, -s, -u, -k and --whitespace flags are kept for the + # -s, -u, -k and --whitespace flags are kept for the # resuming session after a patch failure. # -3 and -i can and must be given when resuming. - echo "$binary" >"$dotest/binary" echo " $ws" >"$dotest/whitespace" echo "$sign" >"$dotest/sign" echo "$utf8" >"$dotest/utf8" @@ -268,10 +273,6 @@ case "$resolved" in fi esac -if test "$(cat "$dotest/binary")" = t -then - binary=--allow-binary-replacement -fi if test "$(cat "$dotest/utf8")" = t then utf8=-u @@ -285,7 +286,7 @@ fi ws=`cat "$dotest/whitespace"` if test "$(cat "$dotest/sign")" = t then - SIGNOFF=`git-var GIT_COMMITTER_IDENT | sed -e ' + SIGNOFF=`git var GIT_COMMITTER_IDENT | sed -e ' s/>.*/>/ s/^/Signed-off-by: /' ` @@ -297,7 +298,6 @@ last=`cat "$dotest/last"` this=`cat "$dotest/next"` if test "$skip" = t then - git rerere clear this=`expr "$this" + 1` resume= fi @@ -450,11 +450,11 @@ do stop_here $this fi - printf 'Applying %s\n' "$FIRSTLINE" + printf 'Applying: %s\n' "$FIRSTLINE" case "$resolved" in '') - git apply $git_apply_opt $binary --index "$dotest/patch" + git apply $git_apply_opt --index "$dotest/patch" apply_status=$? ;; t)