{"thread":{"id":"11847","subject":"[PATCH maint review] Fix \"git-commit -C $tag\"","startedAt":"2008-02-03T08:08:17Z","lastAt":"2008-02-03T08:08:17Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"67194","messageId":"7vtzkqxy1a.fsf@gitster.siamese.dyndns.org","threadId":"11847","inReplyTo":null,"subject":"[PATCH maint review] Fix \"git-commit -C $tag\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-03T08:08:17Z","receivedAt":"2008-02-03T08:08:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The scripted version might not have handled this correctly\neither, but the version rewritten in C definitely does not grok\nthis and complains $tag is not a commit object.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * This is meant for \"maint\" aka 1.5.4.X.  Working with new\n   stuff may be more fun, but we would need to first stabilize\n   the 'maint' branch a bit further.  Review comments and\n   similar bugfix patches meant for 'maint' branch are very much\n   appreciated.\n\n builtin-commit.c  |    2 +-\n t/t7501-commit.sh |   18 ++++++++++++++++++\n 2 files changed, 19 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex d8deb1a..c787bed 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -601,7 +601,7 @@ static int parse_and_validate_options(int argc, const char *argv[],\n \n \t\tif (get_sha1(use_message, sha1))\n \t\t\tdie(\"could not lookup commit %s\", use_message);\n-\t\tcommit = lookup_commit(sha1);\n+\t\tcommit = lookup_commit_reference(sha1);\n \t\tif (!commit || parse_commit(commit))\n \t\t\tdie(\"could not parse commit %s\", use_message);\n \ndiff --git a/t/t7501-commit.sh b/t/t7501-commit.sh\nindex d1a415a..55043d1 100755\n--- a/t/t7501-commit.sh\n+++ b/t/t7501-commit.sh\n@@ -327,4 +327,22 @@ test_expect_success 'amend using the message from another commit' '\n \n '\n \n+test_expect_success 'amend using the message from a commit named with tag' '\n+\n+\tgit reset --hard &&\n+\ttest_tick &&\n+\tgit commit --allow-empty -m \"old commit\" &&\n+\told=$(git rev-parse --verify HEAD) &&\n+\tgit tag -a -m \"tag on old\" tagged-old HEAD &&\n+\ttest_tick &&\n+\tgit commit --allow-empty -m \"new commit\" &&\n+\tnew=$(git rev-parse --verify HEAD) &&\n+\ttest_tick &&\n+\tgit commit --allow-empty --amend -C tagged-old &&\n+\tgit show --pretty=\"format:%ad %s\" \"$old\" >expected &&\n+\tgit show --pretty=\"format:%ad %s\" HEAD >actual &&\n+\tdiff -u expected actual\n+\n+'\n+\n test_done\n-- \n1.5.4.2.g41ac4\n"}]}