diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-01-30 11:07:24 -0500 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-01-30 11:07:24 -0500 |
commit | 76db9dec8132d4377f6c32e4d45eb75fa0cc7a9a (patch) | |
tree | 80a6b54d21978b5c3879662bdc4f5951f804b808 /git-revert.sh | |
parent | b715cfbba4083d25ec0d0f94e440ad734607ddb0 (diff) | |
parent | 73a2acc0a09829f887fdf2dbcfba217102227932 (diff) | |
download | git-76db9dec8132d4377f6c32e4d45eb75fa0cc7a9a.tar.gz |
Merge branch 'master' into sp/gfi
git-fast-import requires use of inttypes.h, but the master branch has
added it to git-compat-util differently than git-fast-import originally
had used it. This merge back of master to the fast-import topic is to
get (and use) inttypes.h the way master is using it.
This is a partially evil merge to remove the call to setup_ident(),
as the master branch now contains a change which makes this implicit
and therefore removed the function declaration. (commit 01754769).
Conflicts:
git-compat-util.h
Diffstat (limited to 'git-revert.sh')
-rwxr-xr-x | git-revert.sh | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/git-revert.sh b/git-revert.sh index fcca3ebb90..866d622d23 100755 --- a/git-revert.sh +++ b/git-revert.sh @@ -19,8 +19,11 @@ case "$0" in echo >&2 "What are you talking about?" exit 1 ;; esac + +SUBDIRECTORY_OK=Yes ;# we will cd up . git-sh-setup require_work_tree +cd_to_toplevel no_commit= while case "$#" in 0) break ;; esac @@ -78,6 +81,8 @@ prev=$(git-rev-parse --verify "$commit^1" 2>/dev/null) || git-rev-parse --verify "$commit^2" >/dev/null 2>&1 && die "Cannot run $me a multi-parent commit." +encoding=$(git config i18n.commitencoding || echo UTF-8) + # "commit" is an existing commit. We would want to apply # the difference it introduces since its first parent "prev" # on top of the current HEAD if we are cherry-pick. Or the @@ -85,10 +90,11 @@ git-rev-parse --verify "$commit^2" >/dev/null 2>&1 && case "$me" in revert) - git-rev-list --pretty=oneline --max-count=1 $commit | + git show -s --pretty=oneline --encoding="$encoding" $commit | sed -e ' s/^[^ ]* /Revert "/ - s/$/"/' + s/$/"/ + ' echo echo "This reverts commit $commit." test "$rev" = "$commit" || @@ -117,14 +123,17 @@ cherry-pick) q }' - set_author_env=`git-cat-file commit "$commit" | + + logmsg=`git show -s --pretty=raw --encoding="$encoding" "$commit"` + set_author_env=`echo "$logmsg" | LANG=C LC_ALL=C sed -ne "$pick_author_script"` eval "$set_author_env" export GIT_AUTHOR_NAME export GIT_AUTHOR_EMAIL export GIT_AUTHOR_DATE - git-cat-file commit $commit | sed -e '1,/^$/d' + echo "$logmsg" | + sed -e '1,/^$/d' -e 's/^ //' case "$replay" in '') echo "(cherry picked from commit $commit)" @@ -137,37 +146,38 @@ cherry-pick) esac >.msg +eval GITHEAD_$head=HEAD +eval GITHEAD_$next='`git show -s \ + --pretty=oneline --encoding="$encoding" "$commit" | + sed -e "s/^[^ ]* //"`' +export GITHEAD_$head GITHEAD_$next + # This three way merge is an interesting one. We are at # $head, and would want to apply the change between $commit # and $prev on top of us (when reverting), or the change between # $prev and $commit on top of us (when cherry-picking or replaying). -echo >&2 "First trying simple merge strategy to $me." -git-read-tree -m -u --aggressive $base $head $next && +git-merge-recursive $base -- $head $next && result=$(git-write-tree 2>/dev/null) || { - echo >&2 "Simple $me fails; trying Automatic $me." - git-merge-index -o git-merge-one-file -a || { - mv -f .msg "$GIT_DIR/MERGE_MSG" - { - echo ' + mv -f .msg "$GIT_DIR/MERGE_MSG" + { + echo ' Conflicts: ' git ls-files --unmerged | sed -e 's/^[^ ]* / /' | uniq - } >>"$GIT_DIR/MERGE_MSG" - echo >&2 "Automatic $me failed. After resolving the conflicts," - echo >&2 "mark the corrected paths with 'git-add <paths>'" - echo >&2 "and commit the result." - case "$me" in - cherry-pick) + } >>"$GIT_DIR/MERGE_MSG" + echo >&2 "Automatic $me failed. After resolving the conflicts," + echo >&2 "mark the corrected paths with 'git-add <paths>'" + echo >&2 "and commit the result." + case "$me" in + cherry-pick) echo >&2 "You may choose to use the following when making" echo >&2 "the commit:" echo >&2 "$set_author_env" - esac - exit 1 - } - result=$(git-write-tree) || exit + esac + exit 1 } echo >&2 "Finished one $me." |