{"thread":{"id":"24125","subject":"[PATCH] am: gather GIT_AUTHOR_* from original commit when rebasing","startedAt":"2010-06-15T22:18:12Z","lastAt":"2010-06-15T22:24:19Z","messageCount":2,"participants":["Jay Soffian"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"143791","messageId":"1276640292-78522-1-git-send-email-jaysoffian@gmail.com","threadId":"24125","inReplyTo":null,"subject":"[PATCH] am: gather GIT_AUTHOR_* from original commit when rebasing","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-06-15T22:18:12Z","receivedAt":"2010-06-15T22:18:12Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"In certain situations, commit authorship can contain an invalid\ne-mail address. For example, this is the case when working with git\nsvn repos where the author email has the svn repo UUID appended such\nas:\n\n author@example.com <author@example.com@deadbeef-dead-beef-dead-beefdeadbeef>\n\nIn such situations, mailinfo extracts the authorship incorrectly\nas it assumes a valid email address.\n\nRegardless, when rebasing the original authorship should be\npreserved irrespective of its validity as an email address.\n\nThis commit teaches am to gather the GIT_AUTHOR_* variables\nfrom the original commit, bypassing any of mailinfo's assumptions.\n\nSigned-off-by: Jay Soffian <jaysoffian@gmail.com>\n---\n git-am.sh         |   10 ++++++----\n t/t3400-rebase.sh |    9 +++++++--\n 2 files changed, 13 insertions(+), 6 deletions(-)\n\nThis is a second take at \nhttp://article.gmane.org/gmane.comp.version-control.git/148568\n\ndiff --git a/git-am.sh b/git-am.sh\nindex 87ffae2..d009d84 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -602,6 +602,9 @@ do\n \t\t\tgit cat-file commit \"$commit\" |\n \t\t\tsed -e '1,/^$/d' >\"$dotest/msg-clean\"\n \t\t\techo \"$commit\" > \"$dotest/original-commit\"\n+\t\t\tGIT_AUTHOR_NAME=\"$(GIT_PAGER='' git log --format=%an -1 \"$commit\")\"\n+\t\t\tGIT_AUTHOR_EMAIL=\"$(GIT_PAGER='' git log --format=%ae -1 \"$commit\")\"\n+\t\t\tGIT_AUTHOR_DATE=\"$(GIT_PAGER='' git log --format=%aD -1 \"$commit\")\"\n \t\telse\n \t\t\t{\n \t\t\t\tsed -n '/^Subject/ s/Subject: //p' \"$dotest/info\"\n@@ -609,14 +612,13 @@ do\n \t\t\t\tcat \"$dotest/msg\"\n \t\t\t} |\n \t\t\tgit stripspace > \"$dotest/msg-clean\"\n+\t\t\tGIT_AUTHOR_NAME=\"$(sed -n '/^Author/ s/Author: //p' \"$dotest/info\")\"\n+\t\t\tGIT_AUTHOR_EMAIL=\"$(sed -n '/^Email/ s/Email: //p' \"$dotest/info\")\"\n+\t\t\tGIT_AUTHOR_DATE=\"$(sed -n '/^Date/ s/Date: //p' \"$dotest/info\")\"\n \t\tfi\n \t\t;;\n \tesac\n \n-\tGIT_AUTHOR_NAME=\"$(sed -n '/^Author/ s/Author: //p' \"$dotest/info\")\"\n-\tGIT_AUTHOR_EMAIL=\"$(sed -n '/^Email/ s/Email: //p' \"$dotest/info\")\"\n-\tGIT_AUTHOR_DATE=\"$(sed -n '/^Date/ s/Date: //p' \"$dotest/info\")\"\n-\n \tif test -z \"$GIT_AUTHOR_EMAIL\"\n \tthen\n \t\techo \"Patch does not have a valid e-mail address.\"\ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex dbf7dfb..c41bcc7 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -10,8 +10,9 @@ among other things.\n '\n . ./test-lib.sh\n \n-GIT_AUTHOR_EMAIL=bogus_email_address\n-export GIT_AUTHOR_EMAIL\n+GIT_AUTHOR_NAME=author@name\n+GIT_AUTHOR_EMAIL=bogus@email@address\n+export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL\n \n test_expect_success \\\n     'prepare repository with topic branches' \\\n@@ -80,6 +81,10 @@ test_expect_success \\\n     'the rebase operation should not have destroyed author information' \\\n     '! (git log | grep \"Author:\" | grep \"<>\")'\n \n+test_expect_success \\\n+    'the rebase operation should not have destroyed author information (2)' \\\n+    \"git log -1 | grep 'Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>'\"\n+\n test_expect_success 'HEAD was detached during rebase' '\n      test $(git rev-parse HEAD@{1}) != $(git rev-parse my-topic-branch@{1})\n '\n-- \n1.7.1\n"},{"id":"143792","messageId":"AANLkTilyPkaQsW-Qe6BiCOFJXNJjBUmz5sAsUThKmM_H@mail.gmail.com","threadId":"24125","inReplyTo":"1276640292-78522-1-git-send-email-jaysoffian@gmail.com","subject":"Re: [PATCH] am: gather GIT_AUTHOR_* from original commit when rebasing","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-06-15T22:24:19Z","receivedAt":"2010-06-15T22:24:19Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Jun 15, 2010 at 6:18 PM, Jay Soffian <jaysoffian@gmail.com> wrote:\n> In certain situations, commit authorship can contain an invalid\n> e-mail address. For example, this is the case when working with git\n> svn repos where the author email has the svn repo UUID appended such\n> as:\n\nGrrr, ignore this one. Sorry, sending a v2 shortly.\n\nj.\n"}]}