aboutsummaryrefslogtreecommitdiff
path: root/git-am.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-04-16 00:37:33 -0700
committerJunio C Hamano <gitster@pobox.com>2008-04-16 00:37:33 -0700
commit464509f790f409d95e0820364ef7296d82942d8c (patch)
tree5825102bb17963d3890c487d88f6d69703620947 /git-am.sh
parent2b6f0b0a78a713be51149f27c2c1172fe4afc9cd (diff)
parentd3e54c88291c2d880ff3a72167c5d3159aed8e97 (diff)
downloadgit-464509f790f409d95e0820364ef7296d82942d8c.tar.gz
git-464509f790f409d95e0820364ef7296d82942d8c.tar.xz
Merge branch 'maint-1.5.4' into maint
* maint-1.5.4: git-bisect: make "start", "good" and "skip" succeed or fail atomically git-am: cope better with an empty Subject: line Ignore leading empty lines while summarizing merges bisect: squelch "fatal: ref HEAD not a symref" misleading message builtin-apply: Show a more descriptive error on failure when opening a patch Clarify documentation of git-cvsserver, particularly in relation to git-shell
Diffstat (limited to 'git-am.sh')
-rwxr-xr-xgit-am.sh24
1 files changed, 10 insertions, 14 deletions
diff --git a/git-am.sh b/git-am.sh
index ac5c38806..245e1db1f 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -107,7 +107,7 @@ It does not apply to blobs recorded in its index."
# patch did not touch, so recursive ends up canceling them,
# saying that we reverted all those changes.
- eval GITHEAD_$his_tree='"$SUBJECT"'
+ eval GITHEAD_$his_tree='"$FIRSTLINE"'
export GITHEAD_$his_tree
git-merge-recursive $orig_tree -- HEAD $his_tree || {
git rerere
@@ -117,10 +117,6 @@ It does not apply to blobs recorded in its index."
unset GITHEAD_$his_tree
}
-reread_subject () {
- git stripspace <"$1" | sed -e 1q
-}
-
prec=4
dotest=".dotest"
sign= utf8=t keep= skip= interactive= resolved= binary= rebasing=
@@ -331,7 +327,11 @@ do
echo "Patch is empty. Was it split wrong?"
stop_here $this
}
- git stripspace < "$dotest/msg" > "$dotest/msg-clean"
+ SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$dotest/info")"
+ case "$keep_subject" in -k) SUBJECT="[PATCH] $SUBJECT" ;; esac
+
+ (echo "$SUBJECT" ; echo ; cat "$dotest/msg") |
+ git stripspace > "$dotest/msg-clean"
;;
esac
@@ -347,9 +347,6 @@ do
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
- SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$dotest/info")"
- case "$keep_subject" in -k) SUBJECT="[PATCH] $SUBJECT" ;; esac
-
case "$resume" in
'')
if test '' != "$SIGNOFF"
@@ -368,10 +365,8 @@ do
ADD_SIGNOFF=
fi
{
- printf '%s\n' "$SUBJECT"
if test -s "$dotest/msg-clean"
then
- echo
cat "$dotest/msg-clean"
fi
if test '' != "$ADD_SIGNOFF"
@@ -388,6 +383,7 @@ do
;;
esac
esac
+ FIRSTLINE=$(head -1 "$dotest/final-commit")
resume=
if test "$interactive" = t
@@ -408,7 +404,7 @@ do
[aA]*) action=yes interactive= ;;
[nN]*) action=skip ;;
[eE]*) git_editor "$dotest/final-commit"
- SUBJECT=$(reread_subject "$dotest/final-commit")
+ FIRSTLINE=$(head -1 "$dotest/final-commit")
action=again ;;
[vV]*) action=again
LESS=-S ${PAGER:-less} "$dotest/patch" ;;
@@ -431,7 +427,7 @@ do
stop_here $this
fi
- printf 'Applying %s\n' "$SUBJECT"
+ printf 'Applying %s\n' "$FIRSTLINE"
case "$resolved" in
'')
@@ -489,7 +485,7 @@ do
tree=$(git write-tree) &&
parent=$(git rev-parse --verify HEAD) &&
commit=$(git commit-tree $tree -p $parent <"$dotest/final-commit") &&
- git update-ref -m "$GIT_REFLOG_ACTION: $SUBJECT" HEAD $commit $parent ||
+ git update-ref -m "$GIT_REFLOG_ACTION: $FIRSTLINE" HEAD $commit $parent ||
stop_here $this
if test -x "$GIT_DIR"/hooks/post-applypatch