{"thread":{"id":"21476","subject":"[PATCH v2] commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-author","startedAt":"2009-11-04T03:20:11Z","lastAt":"2009-11-05T19:11:18Z","messageCount":6,"participants":["Erick Mattos","Junio C Hamano","Nanako Shiraishi"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"126709","messageId":"1257304811-26812-1-git-send-email-erick.mattos@gmail.com","threadId":"21476","inReplyTo":null,"subject":"[PATCH v2] commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-author","fromName":"Erick Mattos","fromEmail":"erick.mattos@gmail.com","sentAt":"2009-11-04T03:20:11Z","receivedAt":"2009-11-04T03:20:11Z","isPatch":true,"sender":{"key":"erick.mattos@gmail.com","avatar":"https://avatars.githubusercontent.com/u/134001?v=4"},"body":"When we use -c, -C, or --amend, we are trying one of two things: using\nthe source as a template or modifying a commit with corrections.\n\nWhen these options are used, the authorship and timestamp recorded in\nthe newly created commit are always taken from the original commit.\nThis is inconvenient when we just want to borrow the commit log message\nor when our change to the code is so significant that we should take\nover the authorship (with the blame for bugs we introduce, of course).\n\nThe new --reset-author option is meant to solve this need by\nregenerating the timestamp and setting as the new author the committer\nor the one specified by --author option.\n\nSigned-off-by: Erick Mattos <erick.mattos@gmail.com>\n---\n\nI have remade the testing script to let it easier for people to understand and\nto make it do all reasonable tests.\n\nI have made minor message log changes and as you can see by the third paragraph\nI am showing a different approach to option --author.  Please read the following\ntext:\n\n--author text says: \"override author for commit\".\n\nAs I see, something that OVERRIDES supersedes everything else.\n\nIMHO --author shouldn't be blocked by the new option.\n\nCutting --author away would make impossible for someone to force a new author\nwith a new timestamp in case he is templating.  As an example he can be using\nthe --author because he is doing a change in a computer not his own or\nsomething alike.\n\nSo I would not wipe \"author\" out from the new option.\n\nPlease don't forget that I am just being a small contributor.  I am just\nsuggesting things.  You have the final word and if you want we can add your\nsmall test to block it:\n\n\tif (force_author && renew_authorship)\n\t\tdie(\"Using both --reset-author and --author does not make sense\");\n\n Documentation/git-commit.txt |    7 ++-\n builtin-commit.c             |    9 ++-\n t/t7509-commit.sh            |  123 ++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 135 insertions(+), 4 deletions(-)\n create mode 100755 t/t7509-commit.sh\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 0578a40..f89db9a 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -9,7 +9,7 @@ SYNOPSIS\n --------\n [verse]\n 'git commit' [-a | --interactive] [-s] [-v] [-u<mode>] [--amend] [--dry-run]\n-\t   [(-c | -C) <commit>] [-F <file> | -m <msg>]\n+\t   [(-c | -C) <commit>] [-F <file> | -m <msg>] [--reset-author]\n \t   [--allow-empty] [--no-verify] [-e] [--author=<author>]\n \t   [--cleanup=<mode>] [--] [[-i | -o ]<file>...]\n \n@@ -69,6 +69,11 @@ OPTIONS\n \tLike '-C', but with '-c' the editor is invoked, so that\n \tthe user can further edit the commit message.\n \n+--reset-author::\n+\tWhen used with -C/-c/--amend options, declare that the\n+\tauthorship of the resulting commit now belongs of the committer.\n+\tThis also renews the author timestamp.\n+\n -F <file>::\n --file=<file>::\n \tTake the commit message from the given file.  Use '-' to\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex beddf01..6b51a1b 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -51,7 +51,7 @@ static const char *template_file;\n static char *edit_message, *use_message;\n static char *author_name, *author_email, *author_date;\n static int all, edit_flag, also, interactive, only, amend, signoff;\n-static int quiet, verbose, no_verify, allow_empty, dry_run;\n+static int quiet, verbose, no_verify, allow_empty, dry_run, renew_authorship;\n static char *untracked_files_arg;\n /*\n  * The default commit message cleanup mode will remove the lines\n@@ -91,8 +91,9 @@ static struct option builtin_commit_options[] = {\n \tOPT_FILENAME('F', \"file\", &logfile, \"read log from file\"),\n \tOPT_STRING(0, \"author\", &force_author, \"AUTHOR\", \"override author for commit\"),\n \tOPT_CALLBACK('m', \"message\", &message, \"MESSAGE\", \"specify commit message\", opt_parse_m),\n-\tOPT_STRING('c', \"reedit-message\", &edit_message, \"COMMIT\", \"reuse and edit message from specified commit \"),\n+\tOPT_STRING('c', \"reedit-message\", &edit_message, \"COMMIT\", \"reuse and edit message from specified commit\"),\n \tOPT_STRING('C', \"reuse-message\", &use_message, \"COMMIT\", \"reuse message from specified commit\"),\n+\tOPT_BOOLEAN(0, \"reset-author\", &renew_authorship, \"reset timestamp and authorship to committer\"),\n \tOPT_BOOLEAN('s', \"signoff\", &signoff, \"add Signed-off-by:\"),\n \tOPT_FILENAME('t', \"template\", &template_file, \"use specified template file\"),\n \tOPT_BOOLEAN('e', \"edit\", &edit_flag, \"force edit of commit\"),\n@@ -381,7 +382,7 @@ static void determine_author_info(void)\n \temail = getenv(\"GIT_AUTHOR_EMAIL\");\n \tdate = getenv(\"GIT_AUTHOR_DATE\");\n \n-\tif (use_message) {\n+\tif (use_message && !renew_authorship) {\n \t\tconst char *a, *lb, *rb, *eol;\n \n \t\ta = strstr(use_message_buffer, \"\\nauthor \");\n@@ -780,6 +781,8 @@ static int parse_and_validate_options(int argc, const char *argv[],\n \t\tuse_message = edit_message;\n \tif (amend && !use_message)\n \t\tuse_message = \"HEAD\";\n+\tif (!use_message && renew_authorship)\n+\t\tdie(\"Option --reset-author is used only with -C/-c/--amend.\");\n \tif (use_message) {\n \t\tunsigned char sha1[20];\n \t\tstatic char utf8[] = \"UTF-8\";\ndiff --git a/t/t7509-commit.sh b/t/t7509-commit.sh\nnew file mode 100755\nindex 0000000..1c27de7\n--- /dev/null\n+++ b/t/t7509-commit.sh\n@@ -0,0 +1,123 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2009 Erick Mattos\n+#\n+\n+test_description='git commit\n+\n+Tests for --reset-author option on a commit.'\n+\n+. ./test-lib.sh\n+\n+TEST_FILE=foo\n+\n+author_id () {\n+\tgit cat-file -p \"$1\" | \\\n+\tgrep \"^author\" | \\\n+\tsed -e \"s/author //\" -e \"s/>.*/>/\"\n+}\n+\n+author_timestamp () {\n+\tgit cat-file -p \"$1\" | \\\n+\tgrep \"^author\" | \\\n+\tsed \"s/.*> //\"\n+}\n+\n+message_body () {\n+\tgit cat-file commit \"$1\" | \\\n+\tsed -e '1,/^$/d'\n+}\n+\n+initiate_test () {\n+\ttest_tick\n+\techo \"initial\" >> \"$TEST_FILE\"\n+\tgit add \"$TEST_FILE\"\n+\tgit commit -m \"Initial Commit\" --author \"Frigate <flying@over.world>\"\n+\ttest_tick\n+}\n+\n+make_files () {\n+\tauthor_id \"$1\" > \"aid$2\"\n+\tauthor_timestamp \"$1\" > \"atime$2\"\n+\tmessage_body \"$1\" > \"message$2\"\n+}\n+\n+get_committer_id () {\n+\techo \"$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\" > aid1\n+}\n+\n+test_expect_success '-C without --reset-author uses the author from the old commit' '\n+\tinitiate_test &&\n+\techo \"Test 1\" >> \"$TEST_FILE\" &&\n+\tgit add \"$TEST_FILE\" &&\n+\tgit commit -C HEAD &&\n+\tmake_files HEAD^ 1 &&\n+\tmake_files HEAD 2 &&\n+\ttest_cmp aid1 aid2 &&\n+\ttest_cmp atime1 atime2 &&\n+\ttest_cmp message1 message2\n+'\n+\n+test_expect_success '-C with --reset-author makes me the author' '\n+\ttest_tick &&\n+\techo \"Test 2\" >> \"$TEST_FILE\" &&\n+\tgit add \"$TEST_FILE\" &&\n+\tgit commit -C HEAD^ --reset-author &&\n+\tmake_files HEAD^ 1 &&\n+\tmake_files HEAD 2 &&\n+\tget_committer_id &&\n+\ttest_cmp aid1 aid2 &&\n+\ttest_must_fail cmp atime1 atime2 &&\n+\ttest_cmp message1 message2\n+'\n+\n+test_expect_success '-c without --reset-author uses the author from the old commit' '\n+\tinitiate_test &&\n+\techo \"Test 3\" >> \"$TEST_FILE\" &&\n+\tgit add \"$TEST_FILE\" &&\n+\tEDITOR=: VISUAL=: git commit -c HEAD &&\n+\tmake_files HEAD^ 1 &&\n+\tmake_files HEAD 2 &&\n+\ttest_cmp aid1 aid2 &&\n+\ttest_cmp atime1 atime2 &&\n+\ttest_cmp message1 message2\n+'\n+\n+test_expect_success '-c with --reset-author makes me the author' '\n+\ttest_tick &&\n+\techo \"Test 4\" >> \"$TEST_FILE\" &&\n+\tgit add \"$TEST_FILE\" &&\n+\tEDITOR=: VISUAL=: git commit -c HEAD^ --reset-author &&\n+\tmake_files HEAD^ 1 &&\n+\tmake_files HEAD 2 &&\n+\tget_committer_id &&\n+\ttest_cmp aid1 aid2 &&\n+\ttest_must_fail cmp atime1 atime2 &&\n+\ttest_cmp message1 message2\n+'\n+\n+test_expect_success '--amend without --reset-author uses the author from the old commit' '\n+\tinitiate_test &&\n+\tmake_files HEAD 2 &&\n+\techo \"Test 5\" >> \"$TEST_FILE\" &&\n+\tgit add \"$TEST_FILE\" &&\n+\tgit commit -m \"--amend test\" --amend &&\n+\tmake_files HEAD 1 &&\n+\ttest_cmp aid1 aid2 &&\n+\ttest_cmp atime1 atime2 &&\n+\ttest_must_fail cmp message1 message2\n+'\n+\n+test_expect_success '--amend with --reset-author makes me the author' '\n+\ttest_tick &&\n+\techo \"Test 6\" >> \"$TEST_FILE\" &&\n+\tgit add \"$TEST_FILE\" &&\n+\tgit commit -m \"Changed\" --amend --reset-author &&\n+\tmake_files HEAD 2 &&\n+\tget_committer_id &&\n+\ttest_cmp aid1 aid2 &&\n+\ttest_must_fail cmp atime1 atime2 &&\n+\ttest_must_fail cmp message1 message2\n+'\n+\n+test_done\n-- \n1.6.5.2.144.g27f8d.dirty\n"},{"id":"126728","messageId":"7vpr7ykbh8.fsf@alter.siamese.dyndns.org","threadId":"21476","inReplyTo":"1257304811-26812-1-git-send-email-erick.mattos@gmail.com","subject":"Re: [PATCH v2] commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-author","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-11-04T07:14:43Z","receivedAt":"2009-11-04T07:14:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Erick Mattos <erick.mattos@gmail.com> writes:\n\n> Cutting --author away would make impossible for someone to force a new author\n> with a new timestamp in case he is templating.  As an example he can be using\n> the --author because he is doing a change in a computer not his own or\n> something alike.\n\nSorry, but I cannot help feeling a bit frustrated and mildly irritated.\n\nI had an impression that we have already established that setting the\nauthor with --author=\"Somebody Else <s@b.e>\" and committing with the\ncurrent time does not make much sense from the workflow point of view long\ntime ago in this thread.\n\nThe mail transport might have mangled the name, and when using --amend (or\nread-tree followed by commit -c), it is handy to fix the mangled name by\nusing --author, but in such a case you would actively want to keep the\ntimestamp obtained from the e-mail via either --amend or -c.\n\nBut allowing this combination, even though it might not make much sense,\nis just giving extra length to the rope, so it may not be such a big deal.\n\nI didn't feel motivated enough to read the whole thing while other patches\nare in my inbox, so I instead ran diff between the previous one (without\nmy suggestion today) and this round.\n\nI see that you fixed a lot of grammar in the log message of my earlier\nsuggestion, all of which looked very good.  Also you added a check in the\nprogram to make sure that --renew is given only when -C/-c/--amend is\ngiven, which is also good.  Neither of our set of tests checks this\ncondition, though.  IOW, we would need to add something like this at the\nend of my version (adjust to --reset-author for your version):\n\n    test_expect_success '--mine should be rejected without -c/-C/--amend' '\n            git checkout Initial &&\n            echo \"Test 7\" >>foo &&\n            test_tick &&\n            test_must_fail git commit -a --mine -m done\n    '\n\nI am not sure why you insist to use your version of test script and keep\nchanging it, though.  It looks a lot worse even only after reviewing its\nearly part.\n\n - author_id runs an extra grep that is unnecessary.  The separation of\n   _id and _timestamp are unnecessary if you checked against an expected\n   author ident and timestamp as a single string, i.e.\n\n   FRIGATE='Frigate <flying@over.world>' ;# do this only once at the beginning\n   ...\n   git commit -C HEAD --reset-author --author=\"$FRIGATE\" &&\n   echo \"author $FRIGATE $GIT_AUTHOR_TIME\" >expect &&\n   author_header HEAD >actual &&\n   test_cmp expect actual\n\n   This becomes irrelevant if we don't support mixing --renew and\n   --author, of course.\n\n - message_body() now has a backslash whose sole purpose is to be an\n   eyesore.\n\n - initiate_test() does not string the commands together with &&\n\nI might change my mind after I take a break, review others' patches, and\nspend some time on my own hacking on other topics before revisiting this\npatch, but at this point I find that reviewing newer rounds of this series\nhas rather quickly diminishing value, and more time is being spent on\nteaching shell scripting to you rather than on polishing the end result.\n\nSorry, but I cannot help feeling a bit frustrated and mildly irritated.\nTime to take a break and attend other topics for a change.\n"},{"id":"126774","messageId":"55bacdd30911040845s6cec0873o2cccd7e0c3bf8f04@mail.gmail.com","threadId":"21476","inReplyTo":"7vpr7ykbh8.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2] commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-author","fromName":"Erick Mattos","fromEmail":"erick.mattos@gmail.com","sentAt":"2009-11-04T16:45:00Z","receivedAt":"2009-11-04T16:45:00Z","isPatch":true,"sender":{"key":"erick.mattos@gmail.com","avatar":"https://avatars.githubusercontent.com/u/134001?v=4"},"body":"2009/11/4 Junio C Hamano <gitster@pobox.com>:\n> Erick Mattos <erick.mattos@gmail.com> writes:\n>\n>> Cutting --author away would make impossible for someone to force a new author\n>> with a new timestamp in case he is templating.  As an example he can be using\n>> the --author because he is doing a change in a computer not his own or\n>> something alike.\n>\n> Sorry, but I cannot help feeling a bit frustrated and mildly irritated.\n>\n> I had an impression that we have already established that setting the\n> author with --author=\"Somebody Else <s@b.e>\" and committing with the\n> current time does not make much sense from the workflow point of view long\n> time ago in this thread.\n>\n> The mail transport might have mangled the name, and when using --amend (or\n> read-tree followed by commit -c), it is handy to fix the mangled name by\n> using --author, but in such a case you would actively want to keep the\n> timestamp obtained from the e-mail via either --amend or -c.\n>\n> But allowing this combination, even though it might not make much sense,\n> is just giving extra length to the rope, so it may not be such a big deal.\n\nI don't see a reason to be hassled by a suggestion, made because I\ndidn't really was confident you got it right from me from the previous\nemail flood.  No big deal.\n\n> I didn't feel motivated enough to read the whole thing while other patches\n> are in my inbox, so I instead ran diff between the previous one (without\n> my suggestion today) and this round.\n\nI really can't imagine all the work you have.  Probably very hard.\n\nAs we were doing before, you were saying what was wrong to you and I\nwas fixing it to your\ndemands.  So I imagine that you are doing the diffs over my versions.\n\nI haven't got a change in that way of working.\n\n> I see that you fixed a lot of grammar in the log message of my earlier\n> suggestion, all of which looked very good.  Also you added a check in the\n> program to make sure that --renew is given only when -C/-c/--amend is\n> given, which is also good.  Neither of our set of tests checks this\n> condition, though.  IOW, we would need to add something like this at the\n> end of my version (adjust to --reset-author for your version):\n>\n>    test_expect_success '--mine should be rejected without -c/-C/--amend' '\n>            git checkout Initial &&\n>            echo \"Test 7\" >>foo &&\n>            test_tick &&\n>            test_must_fail git commit -a --mine -m done\n>    '\n>\n> I am not sure why you insist to use your version of test script and keep\n> changing it, though.  It looks a lot worse even only after reviewing its\n> early part.\n\nAs I told you before I thought you were wanting me to do it.  I didn't\nget a change about me working under your supervision as the coder...\n\nI know anyone in this list is able to code those or any other change.\nIt is just about who is available to work at anything in particular.\n\n>  - author_id runs an extra grep that is unnecessary.  The separation of\n>   _id and _timestamp are unnecessary if you checked against an expected\n>   author ident and timestamp as a single string, i.e.\n\nauthor_id or author_timestamp could be changed independently and a\nsingle string would find it corrected in any case.  The new option\nought to change both as expected in the algorithm.\n\n>   FRIGATE='Frigate <flying@over.world>' ;# do this only once at the beginning\n>   ...\n>   git commit -C HEAD --reset-author --author=\"$FRIGATE\" &&\n>   echo \"author $FRIGATE $GIT_AUTHOR_TIME\" >expect &&\n>   author_header HEAD >actual &&\n>   test_cmp expect actual\n\nIf you make my script fail in any of the checks then you are going to\nhave \"trash...\" folder holding the full message log history and the\nfile foo with each step recorded on it with the \"initials\" separating\nthe -C, -c and --amend.  This way you can also check the differences\nin the author log timestamp among cited options because the \"initials\"\nmake a barrier in between.  I made it purposely to become easier to\naudit.\n\n>   This becomes irrelevant if we don't support mixing --renew and\n>   --author, of course.\n\nIt won't be supported.\n\n>  - message_body() now has a backslash whose sole purpose is to be an\n>   eyesore.\n\nNo backslash then.\n\n>  - initiate_test() does not string the commands together with &&\n\nIt is not something difficult to add.\n\n> I might change my mind after I take a break, review others' patches, and\n> spend some time on my own hacking on other topics before revisiting this\n> patch, but at this point I find that reviewing newer rounds of this series\n> has rather quickly diminishing value, and more time is being spent on\n> teaching shell scripting to you rather than on polishing the end result.\n\nNow you are being impolite and then I am not saying anything back.\n\n> Sorry, but I cannot help feeling a bit frustrated and mildly irritated.\n> Time to take a break and attend other topics for a change.\n>\n\nAgain:  I don't see a reason to be irritated by a suggestion...\n\nSorry fellow.  I just tried to help.  Let me know if you want my work anytime.\n\nAnd sorry for any communication problem we had, taking in account that\nI am not a native english speaker.\n\nBest regards.\n"},{"id":"126873","messageId":"20091105123456.6117@nanako3.lavabit.com","threadId":"21476","inReplyTo":"7vpr7ykbh8.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2] commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-author","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-11-05T03:34:56Z","receivedAt":"2009-11-05T03:34:56Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Junio C Hamano <gitster@pobox.com>\n\n> I had an impression that we have already established that setting the\n> author with --author=\"Somebody Else <s@b.e>\" and committing with the\n> current time does not make much sense from the workflow point of view long\n> time ago in this thread.\n> <snip>\n> But allowing this combination, even though it might not make much sense,\n> is just giving extra length to the rope, so it may not be such a big deal.\n\nIt may be wise to forbid a combination of options if it \nencourages mistakes or a wrong workflow, but I don't think \nusing --author and --reset-author with 'git commit --amend' \nis such a case.\n\nImagine somebody other than you (eg. me) were the maintainer, \nand a message by Szeder was sent with a good commit log message.\n\n http://article.gmane.org/gmane.comp.version-control.git/132029\n\nThen you sent a replacement patch that solves the same problem \nin a more elegant way, but without anything that is usable as the \ncommit log message.\n\n http://article.gmane.org/gmane.comp.version-control.git/132041\n\nIf I were the maintainer, I would find it very convenient if I can \nwork like this:\n\n % git am -s 132029   --- first I apply Szeder's version\n\nThen I see your message. Replace the code change but use Szeder's\nlog message.\n\n % git reset --hard HEAD^\n % git am 132041   --- your version with no usable log message\n % git commit --amend -s -c @{2} --author='Junio C Hamano <...>'\n\n> Sorry, but I cannot help feeling a bit frustrated and mildly irritated.\n\nDon't try to be perfect and feel stressed out, and please take \na good rest.\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"126877","messageId":"7vws25a5s2.fsf@alter.siamese.dyndns.org","threadId":"21476","inReplyTo":"20091105123456.6117@nanako3.lavabit.com","subject":"Re: [PATCH v2] commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-author","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-11-05T05:40:13Z","receivedAt":"2009-11-05T05:40:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n> It may be wise to forbid a combination of options if it \n> encourages mistakes or a wrong workflow, but I don't think \n> using --author and --reset-author with 'git commit --amend' \n> is such a case.\n>\n> Imagine somebody other than you (eg. me) were the maintainer, \n> and a message by Szeder was sent with a good commit log message.\n>\n>  http://article.gmane.org/gmane.comp.version-control.git/132029\n>\n> Then you sent a replacement patch that solves the same problem \n> in a more elegant way, but without anything that is usable as the \n> commit log message.\n>\n>  http://article.gmane.org/gmane.comp.version-control.git/132041\n>\n> If I were the maintainer, I would find it very convenient if I can \n> work like this:\n>\n>  % git am -s 132029   --- first I apply Szeder's version\n>\n> Then I see your message. Replace the code change but use Szeder's\n> log message.\n>\n>  % git reset --hard HEAD^\n>  % git am 132041   --- your version with no usable log message\n>  % git commit --amend -s -c @{2} --author='Junio C Hamano <...>'\n\nThanks.\n\nSo you commit Szeder's and then commit mine (make them independent), and\namend the log message of the latter using the message from the former, and\nassign the authorship of the latter to the resulting commit?\n\nThat is a much more understandable argument than just claiming \"--author\nshould be usable with --reset-author\" without clearly stating why that\nwould help.  I think you forgot to add --reset-author to the last command\nline, though.\n\nBut I think it is showing that --reset-author is actually suboptimal way\nto solve your scenario.  In the last command in your sequence, you don't\nwant to add \"--reset-author --author=X\" but want \"--reuse-only-message\"\noption.\n\nAnd I think it makes much more sense than the alternative semantics we\ncame up with during this discussion.  --mine (or --reset-author) to\ndeclare that \"I am the author\" was not what we wanted after all(yes, I am\nguilty for suggesting it).  What we want is \"I am using -C/-c/--amend and\nI want to borrow only the message part from the named commit (obviously\n\"amend\" names the HEAD commit implicitly).  Determine the authorship\ninformation (including author timestamp) as if I didn't use that option.\"\n"},{"id":"126912","messageId":"55bacdd30911051111x68539bf5i6ad91bd55dc23feb@mail.gmail.com","threadId":"21476","inReplyTo":"7vws25a5s2.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2] commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-author","fromName":"Erick Mattos","fromEmail":"erick.mattos@gmail.com","sentAt":"2009-11-05T19:11:18Z","receivedAt":"2009-11-05T19:11:18Z","isPatch":true,"sender":{"key":"erick.mattos@gmail.com","avatar":"https://avatars.githubusercontent.com/u/134001?v=4"},"body":"Hey, I do understand you can be very stressed.  It is a huge project.\nVery important for an uncountable group of people.  A lot of demands\nand argumentation from all over.\n\nI know too that it is human nature to ask other people to agree with\nthem completely.  Much more when they are in charge.\n\nSo, no problem.  It was just a big surprise when I read your email.\nYou had been so nice to me until that moment...\n\nBut let's keep talking about code.  I am not a big fan of human nature subjects.\n\nAlthough I have to be more personal for just a little.  I want to show\nyou my way of seeing things:\n\nI love defaults!  A command or an option already set for the most\ncommon scenario... It's wonderful.\n\nBut I like to have full control of any tool I use.  If I want to do\nany bizarre thing nobody has\never thought about... I think I should be able to.  Without any hacking.\n\nI can hammer a nail with a wrench.  But I would prefer a hammer for that.\n\nI think your suggestions which changed the path of this intended\nfunction since the beginning were very good for a default.  So I think\n--reset-author did it.  Normally 95% of the time its behavior is what\npeople will be needing.\n\nBut cutting off a remote possibility for no heavy and unbearable\nreason imho makes features incomplete.  That is why I had suggested\nnot cutting off --author functionality when using --reset-author.\n\nI did not try to conceive all possible uses for this combination but I\nknew someone could find some.  I have told you a simple case just to\npicture some figures.  Nanako showed you a case you agreed.  Thanks\nNanako.\n\nI was not defying your judgment or showing lack of respect to you.  My\ntext after \"---\" was very clear about that.  Thank you again Nanako\nfor showing me the importance of this little text.\n\nAbout scripting abilities: I don't see a way to compare scripting\n\"levels\".  Scripts are so easy that you just know or not.\n\nDifferent approaches could be compared.  At start I really did not get\nthe use of the \"t\" folder tests.  I thought it was just to show\nfunctionalities.\n\nNanako in her critics made me understand within her speach the\nimportance of those tests.  Then you clarified it much more later.  So\nI got those informations and made another script trying to test\n--reset-author completely.  Separating every bit of data that could\nshow a malfunctioning.  And taking also the care of letting auditing\nmore reliable and informational.\n\nSo I accepted your rough saying about \"teaching\" as an explosion of stress.\n\nI have to tell that our work-flow on that time was: you demanded and I\nmade a change.  The script you added was an example to me under this\nwork-flow.\n\nI am not a kid and I have a real and busy life but I do think spending\ntime sharing some changes I use to improve something which I value is\nnot a lost time.  As you can see by the time I had sent the emails, I\nwas doing them overtime.\n\nSo I would like to make clear that I did and do want to help as much\nas I can.  If it is not possible to use my work then just know you and\nevery free software coder has a big fan in me.  I will be transmitting\ngood energies to you all in any case.\n\nNo hard feelings.  :-)\n\nI hope you can continue doing the wonderful work you have been doing\nfor a very long future.\n\nBest regards.\n\n2009/11/5 Junio C Hamano <gitster@pobox.com>:\n> Nanako Shiraishi <nanako3@lavabit.com> writes:\n>\n>> It may be wise to forbid a combination of options if it\n>> encourages mistakes or a wrong workflow, but I don't think\n>> using --author and --reset-author with 'git commit --amend'\n>> is such a case.\n>>\n>> Imagine somebody other than you (eg. me) were the maintainer,\n>> and a message by Szeder was sent with a good commit log message.\n>>\n>>  http://article.gmane.org/gmane.comp.version-control.git/132029\n>>\n>> Then you sent a replacement patch that solves the same problem\n>> in a more elegant way, but without anything that is usable as the\n>> commit log message.\n>>\n>>  http://article.gmane.org/gmane.comp.version-control.git/132041\n>>\n>> If I were the maintainer, I would find it very convenient if I can\n>> work like this:\n>>\n>>  % git am -s 132029   --- first I apply Szeder's version\n>>\n>> Then I see your message. Replace the code change but use Szeder's\n>> log message.\n>>\n>>  % git reset --hard HEAD^\n>>  % git am 132041   --- your version with no usable log message\n>>  % git commit --amend -s -c @{2} --author='Junio C Hamano <...>'\n>\n> Thanks.\n>\n> So you commit Szeder's and then commit mine (make them independent), and\n> amend the log message of the latter using the message from the former, and\n> assign the authorship of the latter to the resulting commit?\n>\n> That is a much more understandable argument than just claiming \"--author\n> should be usable with --reset-author\" without clearly stating why that\n> would help.  I think you forgot to add --reset-author to the last command\n> line, though.\n>\n> But I think it is showing that --reset-author is actually suboptimal way\n> to solve your scenario.  In the last command in your sequence, you don't\n> want to add \"--reset-author --author=X\" but want \"--reuse-only-message\"\n> option.\n>\n> And I think it makes much more sense than the alternative semantics we\n> came up with during this discussion.  --mine (or --reset-author) to\n> declare that \"I am the author\" was not what we wanted after all(yes, I am\n> guilty for suggesting it).  What we want is \"I am using -C/-c/--amend and\n> I want to borrow only the message part from the named commit (obviously\n> \"amend\" names the HEAD commit implicitly).  Determine the authorship\n> information (including author timestamp) as if I didn't use that option.\"\n>\n"}]}