summaryrefslogtreecommitdiff
path: root/git-am.sh
diff options
context:
space:
mode:
authorJay Soffian <jaysoffian@gmail.com>2010-06-16 07:12:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-06-16 17:00:58 (GMT)
commit43c23251f924db4188cf74361cb7cc3257accce3 (patch)
treeccbd22fa90b8684d728b2984bc6aab042b7f5d6f /git-am.sh
parente0a9110176e3b17414b1b38fae8febd0791eaa0c (diff)
downloadgit-43c23251f924db4188cf74361cb7cc3257accce3.zip
git-43c23251f924db4188cf74361cb7cc3257accce3.tar.gz
git-43c23251f924db4188cf74361cb7cc3257accce3.tar.bz2
am: use get_author_ident_from_commit instead of mailinfo when rebasing
In certain situations, commit authorship can consist of an invalid e-mail address. For example, this is the case when working with git svn repos where the author email has had the svn repo UUID appended such as: author@example.com <author@example.com@deadbeef-dead-beef-dead-beefdeadbeef> Given such an address, mailinfo extracts the authorship incorrectly as it assumes a valid domain. However, when rebasing the original authorship should be preserved irrespective of its validity as an email address. Using get_author_ident_from_commit instead of mailinfo when rebasing preserves the original authorship. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-am.sh')
-rwxr-xr-xgit-am.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/git-am.sh b/git-am.sh
index 1056075..abcb05b 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -593,7 +593,7 @@ do
echo "Patch is empty. Was it split wrong?"
stop_here $this
}
- rm -f "$dotest/original-commit"
+ rm -f "$dotest/original-commit" "$dotest/author-script"
if test -f "$dotest/rebasing" &&
commit=$(sed -e 's/^From \([0-9a-f]*\) .*/\1/' \
-e q "$dotest/$msgnum") &&
@@ -602,6 +602,7 @@ do
git cat-file commit "$commit" |
sed -e '1,/^$/d' >"$dotest/msg-clean"
echo "$commit" > "$dotest/original-commit"
+ get_author_ident_from_commit "$commit" > "$dotest/author-script"
else
{
sed -n '/^Subject/ s/Subject: //p' "$dotest/info"
@@ -613,9 +614,14 @@ do
;;
esac
- GIT_AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' "$dotest/info")"
- GIT_AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' "$dotest/info")"
- GIT_AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' "$dotest/info")"
+ if test -f "$dotest/author-script"
+ then
+ eval $(cat "$dotest/author-script")
+ else
+ GIT_AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' "$dotest/info")"
+ GIT_AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' "$dotest/info")"
+ GIT_AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' "$dotest/info")"
+ fi
if test -z "$GIT_AUTHOR_EMAIL"
then