{"thread":{"id":"29094","subject":"Query on git commit amend","startedAt":"2011-12-06T08:23:00Z","lastAt":"2011-12-09T04:49:28Z","messageCount":27,"participants":["Viresh Kumar","Konstantin Khomoutov","Johannes Sixt","Vijay Lakshminarayanan","Jeff King","Dirk Süsserott","Junio C Hamano","Björn Steinbrink","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"180361","messageId":"4EDDD0E4.6040003@st.com","threadId":"29094","inReplyTo":null,"subject":"Query on git commit amend","fromName":"Viresh Kumar","fromEmail":"viresh.kumar@st.com","sentAt":"2011-12-06T08:23:00Z","receivedAt":"2011-12-06T08:23:00Z","isPatch":false,"sender":{"key":"viresh.kumar@st.com","avatar":null},"body":"\nHello,\n\nSuppose i want to add few new changes to my last commit (HEAD).\nThe way i do it is\n$ git add all_changed_files\n$ git commit --amend\n\nOR\n$ git commit --amend -a\n\nWith both these ways, i get a screen to edit the message too.\n\nI want to know if there is a way to skip this screen.\n\ni.e.\n$ git commit --amend -a -some_other_option\n\nwhich simply adds new changes to existing commit, without asking to change\nmessage.\n\nIf there is no such way, then can we add a patch for this, if it looks a valid\ncase.\n\n-- \nviresh\n"},{"id":"180362","messageId":"20111206130138.119db519.kostix@domain007.com","threadId":"29094","inReplyTo":"4EDDD0E4.6040003@st.com","subject":"Re: Query on git commit amend","fromName":"Konstantin Khomoutov","fromEmail":"flatworm@users.sourceforge.net","sentAt":"2011-12-06T09:01:38Z","receivedAt":"2011-12-06T09:01:38Z","isPatch":false,"sender":{"key":"flatworm@users.sourceforge.net","avatar":null},"body":"On Tue, 6 Dec 2011 13:53:00 +0530\nViresh Kumar <viresh.kumar@st.com> wrote:\n\n> Suppose i want to add few new changes to my last commit (HEAD).\n> The way i do it is\n> $ git add all_changed_files\n> $ git commit --amend\n> \n> OR\n> $ git commit --amend -a\n> \n> With both these ways, i get a screen to edit the message too.\n> \n> I want to know if there is a way to skip this screen.\n> \n> i.e.\n> $ git commit --amend -a -some_other_option\n> \n> which simply adds new changes to existing commit, without asking to\n> change message.\n> \n> If there is no such way, then can we add a patch for this, if it\n> looks a valid case.\ngit commit --amend -C HEAD\n"},{"id":"180363","messageId":"4EDDDC38.8080108@viscovery.net","threadId":"29094","inReplyTo":"4EDDD0E4.6040003@st.com","subject":"Re: Query on git commit amend","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2011-12-06T09:11:20Z","receivedAt":"2011-12-06T09:11:20Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 12/6/2011 9:23, schrieb Viresh Kumar:\n> \n> Hello,\n> \n> Suppose i want to add few new changes to my last commit (HEAD).\n> The way i do it is\n> $ git add all_changed_files\n> $ git commit --amend\n> \n> OR\n> $ git commit --amend -a\n> \n> With both these ways, i get a screen to edit the message too.\n> \n> I want to know if there is a way to skip this screen.\n> \n> i.e.\n> $ git commit --amend -a -some_other_option\n> \n> which simply adds new changes to existing commit, without asking to change\n> message.\n\n$ git commit --amend -a -C HEAD\n\nBut let's count keystrokes (after -a):\n\n<BLANK>-<SHIFT>C<BLANK>HEAD<ENTER>\n10 keystrokes (more if you release SHIFT before D)\n\nBut if vi pops up you have:\n\n<ENTER><SHIFT>ZZ\n4 keystrokes\n\nWhere is the advantage of the option?\n\n-- Hannes\n"},{"id":"180364","messageId":"4EDDDE5C.6040200@st.com","threadId":"29094","inReplyTo":"4EDDDC38.8080108@viscovery.net","subject":"Re: Query on git commit amend","fromName":"Viresh Kumar","fromEmail":"viresh.kumar@st.com","sentAt":"2011-12-06T09:20:28Z","receivedAt":"2011-12-06T09:20:28Z","isPatch":false,"sender":{"key":"viresh.kumar@st.com","avatar":null},"body":"On 12/6/2011 2:41 PM, Johannes Sixt wrote:\n> Am 12/6/2011 9:23, schrieb Viresh Kumar:\n> $ git commit --amend -a -C HEAD\n> \n> But let's count keystrokes (after -a):\n> \n> <BLANK>-<SHIFT>C<BLANK>HEAD<ENTER>\n> 10 keystrokes (more if you release SHIFT before D)\n> \n> But if vi pops up you have:\n> \n> <ENTER><SHIFT>ZZ\n> 4 keystrokes\n> \n> Where is the advantage of the option?\n> \n\nThanks guys.\n\n@Johannes: You are right but, i will make an alias for the entire command.\nSo keystrokes are same for me. :)\n\n-- \nviresh\n"},{"id":"180365","messageId":"4EDDDEF0.6030405@st.com","threadId":"29094","inReplyTo":"4EDDDE5C.6040200@st.com","subject":"Re: Query on git commit amend","fromName":"Viresh Kumar","fromEmail":"viresh.kumar@st.com","sentAt":"2011-12-06T09:22:56Z","receivedAt":"2011-12-06T09:22:56Z","isPatch":false,"sender":{"key":"viresh.kumar@st.com","avatar":null},"body":"On 12/6/2011 2:50 PM, Viresh Kumar wrote:\n> On 12/6/2011 2:41 PM, Johannes Sixt wrote:\n>> Am 12/6/2011 9:23, schrieb Viresh Kumar:\n>> $ git commit --amend -a -C HEAD\n>>\n>> But let's count keystrokes (after -a):\n>>\n>> <BLANK>-<SHIFT>C<BLANK>HEAD<ENTER>\n>> 10 keystrokes (more if you release SHIFT before D)\n>>\n>> But if vi pops up you have:\n>>\n>> <ENTER><SHIFT>ZZ\n>> 4 keystrokes\n>>\n>> Where is the advantage of the option?\n>>\n> \n> Thanks guys.\n> \n> @Johannes: You are right but, i will make an alias for the entire command.\n> So keystrokes are same for me. :)\n> \n\nThere is one more benefit, we don't have to wait for git. We can simply switch to\nsome other window and work. And can write further command on the same window, in\nthe time git processes commit --amend.\n\n-- \nviresh\n"},{"id":"180379","messageId":"87fwgxwvn9.fsf@gmail.com","threadId":"29094","inReplyTo":"4EDDD0E4.6040003@st.com","subject":"Re: Query on git commit amend","fromName":"Vijay Lakshminarayanan","fromEmail":"laksvij@gmail.com","sentAt":"2011-12-06T15:46:18Z","receivedAt":"2011-12-06T15:46:18Z","isPatch":false,"sender":{"key":"laksvij@gmail.com","avatar":null},"body":"Viresh Kumar <viresh.kumar@st.com> writes:\n\n> Hello,\n>\n> Suppose i want to add few new changes to my last commit (HEAD).\n> The way i do it is\n> $ git add all_changed_files\n> $ git commit --amend\n>\n> OR\n> $ git commit --amend -a\n>\n> With both these ways, i get a screen to edit the message too.\n>\n> I want to know if there is a way to skip this screen.\n>\n> i.e.\n> $ git commit --amend -a -some_other_option\n>\n> which simply adds new changes to existing commit, without asking to change\n> message.\n>\n> If there is no such way, then can we add a patch for this, if it looks a valid\n> case.\n\nI've found \n\n$ GIT_EDITOR=cat git commit --amend\n\nuseful.\n\nThe benefit of this technique is that it even works for git-rebase -i.\n\nIn my typical git usage, I do a lot of git-commit --fixup's.  After\nreaching a level of stability, I change the history with:\n\nGIT_EDITOR=cat git rebase -i --autosquash\n\nand my history is adjusted without requiring manual intervention.\n\n-- \nCheers\n~vijay\n\nGnus should be more complicated.\n"},{"id":"180398","messageId":"4EDE687E.7020604@dirk.my1.cc","threadId":"29094","inReplyTo":"20111206130138.119db519.kostix@domain007.com","subject":"Re: Query on git commit amend","fromName":"Dirk Süsserott","fromEmail":"newsletter@dirk.my1.cc","sentAt":"2011-12-06T19:09:50Z","receivedAt":"2011-12-06T19:09:50Z","isPatch":false,"sender":{"key":"newsletter@dirk.my1.cc","avatar":null},"body":"Am 06.12.2011 10:01 schrieb Konstantin Khomoutov:\n> On Tue, 6 Dec 2011 13:53:00 +0530\n> Viresh Kumar <viresh.kumar@st.com> wrote:\n> \n>> Suppose i want to add few new changes to my last commit (HEAD).\n>> The way i do it is\n>> $ git add all_changed_files\n>> $ git commit --amend\n>>\n>> OR\n>> $ git commit --amend -a\n>>\n>> With both these ways, i get a screen to edit the message too.\n>>\n>> I want to know if there is a way to skip this screen.\n>>\n>> i.e.\n>> $ git commit --amend -a -some_other_option\n>>\n>> which simply adds new changes to existing commit, without asking to\n>> change message.\n>>\n>> If there is no such way, then can we add a patch for this, if it\n>> looks a valid case.\n> git commit --amend -C HEAD\n\n$ git commit --amend -C HEAD\n\nworks fine but will keep the authorship (name _and_ date). To change the\ndate to the current timestamp, use\n\n$ git commit --amend -C HEAD --reset-author\n\nNote that this will also change the author's name to yours, so it\ndepends on your case. The commiter's name and timestamp are always\nupdated to \"you/now\", independently of that option. To change only the\nauthor's date, use --date=<date>.\n\nCheers,\n    Dirk\n"},{"id":"180397","messageId":"20111206191124.GE9492@sigill.intra.peff.net","threadId":"29094","inReplyTo":"87fwgxwvn9.fsf@gmail.com","subject":"Re: Query on git commit amend","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-12-06T19:11:24Z","receivedAt":"2011-12-06T19:11:24Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Dec 06, 2011 at 09:16:18PM +0530, Vijay Lakshminarayanan wrote:\n\n> I've found \n> \n> $ GIT_EDITOR=cat git commit --amend\n> \n> useful.\n> \n> The benefit of this technique is that it even works for git-rebase -i.\n\nI sometimes do a similar thing, but I don't use \"cat\". That will dump\nall of the log message (including the generated template) to stdout\n(i.e., the terminal), which is quite noisy. Instead, I use:\n\n  GIT_EDITOR=true git commit --amend\n\nwhich silently leaves the file untouched.\n\n-Peff\n"},{"id":"180401","messageId":"7vobvlfowk.fsf@alter.siamese.dyndns.org","threadId":"29094","inReplyTo":"87fwgxwvn9.fsf@gmail.com","subject":"Re: Query on git commit amend","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-12-06T20:03:55Z","receivedAt":"2011-12-06T20:03:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vijay Lakshminarayanan <laksvij@gmail.com> writes:\n\n> I've found \n>\n> $ GIT_EDITOR=cat git commit --amend\n>\n> useful.\n\nAre you sure it is a cat?\n\nI almost always use\n\n    $ EDITOR=: git commit --amend\n\nwhen rewriting the contents without updating the message, but I think\nwe should allow people to say:\n\n    $ git commit --amend --no-edit\n\nwhich is accepted from the command line but is not honoured.\n"},{"id":"180407","messageId":"7vk469fm9j.fsf@alter.siamese.dyndns.org","threadId":"29094","inReplyTo":"7vobvlfowk.fsf@alter.siamese.dyndns.org","subject":"Re: Query on git commit amend","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-12-06T21:00:56Z","receivedAt":"2011-12-06T21:00:56Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> I almost always use\n>\n>     $ EDITOR=: git commit --amend\n>\n> when rewriting the contents without updating the message, but I think\n> we should allow people to say:\n>\n>     $ git commit --amend --no-edit\n>\n> which is accepted from the command line but is not honoured.\n\nAnd this should fix it (only lightly tested).\n\n-- >8 --\nSubject: [PATCH] commit: honor --no-edit\n\nAfter making fixes to the contents to be committed, it is not unusual to\nupdate the current commit without rewording the message. Idioms to do\ntell \"commit --amend\" that we do not need an editor have been:\n\n    $ EDITOR=: git commit --amend\n    $ git commit --amend -C HEAD\n\nbut that was only because a more natural\n\n    $ git commit --amend --no-edit\n\ndid not honour \"--no-edit\" option.    \n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/commit.c |    9 +++++----\n 1 files changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 8f2bebe..48bea8f 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -81,7 +81,8 @@ static const char *template_file;\n static const char *author_message, *author_message_buffer;\n static char *edit_message, *use_message;\n static char *fixup_message, *squash_message;\n-static int all, edit_flag, also, interactive, patch_interactive, only, amend, signoff;\n+static int all, also, interactive, patch_interactive, only, amend, signoff;\n+static int edit_flag = -1; /* unspecified */\n static int quiet, verbose, no_verify, allow_empty, dry_run, renew_authorship;\n static int no_post_rewrite, allow_empty_message;\n static char *untracked_files_arg, *force_date, *ignore_submodule_arg;\n@@ -141,7 +142,7 @@ static struct option builtin_commit_options[] = {\n \tOPT_BOOLEAN(0, \"reset-author\", &renew_authorship, \"the commit is authored by me now (used with -C-c/--amend)\"),\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+\tOPT_BOOL('e', \"edit\", &edit_flag, \"force edit of commit\"),\n \tOPT_STRING(0, \"cleanup\", &cleanup_arg, \"default\", \"how to strip spaces and #comments from message\"),\n \tOPT_BOOLEAN(0, \"status\", &include_status, \"include status in commit message template\"),\n \t/* end commit message options */\n@@ -1020,8 +1021,8 @@ static int parse_and_validate_options(int argc, const char *argv[],\n \n \tif (logfile || message.len || use_message || fixup_message)\n \t\tuse_editor = 0;\n-\tif (edit_flag)\n-\t\tuse_editor = 1;\n+\tif (0 <= edit_flag)\n+\t\tuse_editor = edit_flag;\n \tif (!use_editor)\n \t\tsetenv(\"GIT_EDITOR\", \":\", 1);\n \n-- \n1.7.8.157.g03e55\n"},{"id":"180439","messageId":"8739cxw2e6.fsf@gmail.com","threadId":"29094","inReplyTo":"20111206191124.GE9492@sigill.intra.peff.net","subject":"Re: Query on git commit amend","fromName":"Vijay Lakshminarayanan","fromEmail":"laksvij@gmail.com","sentAt":"2011-12-07T02:18:09Z","receivedAt":"2011-12-07T02:18:09Z","isPatch":false,"sender":{"key":"laksvij@gmail.com","avatar":null},"body":"Jeff King <peff@peff.net> writes:\n\n> On Tue, Dec 06, 2011 at 09:16:18PM +0530, Vijay Lakshminarayanan wrote:\n>\n>> I've found \n>> \n>> $ GIT_EDITOR=cat git commit --amend\n>> \n>> useful.\n>> \n>> The benefit of this technique is that it even works for git-rebase -i.\n>\n> I sometimes do a similar thing, but I don't use \"cat\". That will dump\n> all of the log message (including the generated template) to stdout\n> (i.e., the terminal), which is quite noisy. Instead, I use:\n>\n>   GIT_EDITOR=true git commit --amend\n>\n> which silently leaves the file untouched.\n\nThanks Peff.  I didn't know about true.  I will use it when rebasing.\ncat's noisiness is useful as a review of the output.\n\n> -Peff\n\n-- \nCheers\n~vijay\n\nGnus should be more complicated.\n"},{"id":"180441","messageId":"87wra9und4.fsf@gmail.com","threadId":"29094","inReplyTo":"7vobvlfowk.fsf@alter.siamese.dyndns.org","subject":"Re: Query on git commit amend","fromName":"Vijay Lakshminarayanan","fromEmail":"laksvij@gmail.com","sentAt":"2011-12-07T02:28:07Z","receivedAt":"2011-12-07T02:28:07Z","isPatch":false,"sender":{"key":"laksvij@gmail.com","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Vijay Lakshminarayanan <laksvij@gmail.com> writes:\n>\n>> I've found \n>>\n>> $ GIT_EDITOR=cat git commit --amend\n>>\n>> useful.\n>\n> Are you sure it is a cat?\n\nYes.\n\nDid you mean something else by your question?\n\n> I almost always use\n>\n>     $ EDITOR=: git commit --amend\n\nI just tried this out.  This and Peff's GIT_EDITOR=true silently dwiw\nbut cat is useful to review the commit.\n\n-- \nCheers\n~vijay\n\nGnus should be more complicated.\n"},{"id":"180444","messageId":"4EDEE988.2070902@st.com","threadId":"29094","inReplyTo":"87wra9und4.fsf@gmail.com","subject":"Re: Query on git commit amend","fromName":"Viresh Kumar","fromEmail":"viresh.kumar@st.com","sentAt":"2011-12-07T04:20:24Z","receivedAt":"2011-12-07T04:20:24Z","isPatch":false,"sender":{"key":"viresh.kumar@st.com","avatar":null},"body":"\nThanks guys. This whole session was new to me.\n\nOn 12/7/2011 7:58 AM, Vijay Lakshminarayanan wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n>> > Vijay Lakshminarayanan <laksvij@gmail.com> writes:\n>> >\n>>> >> I've found \n>>> >>\n>>> >> $ GIT_EDITOR=cat git commit --amend\n>>> >>\n>>> >> useful.\n>> >\n>> > Are you sure it is a cat?\n> Yes.\n\nThis didn't worked for me. Got following error:\n\ncat: unrecognized option `--amend'\nTry `cat --help' for more information.\nerror: There was a problem with the editor 'cat git commit --amend'.\nPlease supply the message using either -m or -F option.\nCould not commit staged changes.\n\n>> > I almost always use\n>> >\n>> >     $ EDITOR=: git commit --amend\n\nEven this didn't worked for me:\n\nerror: pathspec '.git/COMMIT_EDITMSG' did not match any file(s) known to git.\nerror: There was a problem with the editor 'git commit --amend'.\nPlease supply the message using either -m or -F option.\nCould not commit staged changes.\n\nOnly \"true\" worked for me.\n\nProbably, i have an older version of git (version 1.7.2.2)\n\nOne more thing. I couldn't get completely how this worked. Maybe any pointers to\nearlier discussions.\n\nThe way i am testing it is:\n- Stop after a commit in middle of rebase using \"edit\" or \"e\" option\n- set EDITOR or GIT_EDITOR\n- change files\n- git add changed_files\n- git rebase --continue\n\n-- \nviresh\n"},{"id":"180447","messageId":"20111207045325.GA22990@atjola.homenet","threadId":"29094","inReplyTo":"4EDEE988.2070902@st.com","subject":"Re: Query on git commit amend","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2011-12-07T04:53:25Z","receivedAt":"2011-12-07T04:53:25Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2011.12.07 09:50:24 +0530, Viresh Kumar wrote:\n> \n> Thanks guys. This whole session was new to me.\n> \n> On 12/7/2011 7:58 AM, Vijay Lakshminarayanan wrote:\n> > Junio C Hamano <gitster@pobox.com> writes:\n> > \n> >> > Vijay Lakshminarayanan <laksvij@gmail.com> writes:\n> >> >\n> >>> >> I've found \n> >>> >>\n> >>> >> $ GIT_EDITOR=cat git commit --amend\n> >>> >>\n> >>> >> useful.\n> >> >\n> >> > Are you sure it is a cat?\n> > Yes.\n> \n> This didn't worked for me. Got following error:\n> \n> cat: unrecognized option `--amend'\n> Try `cat --help' for more information.\n> error: There was a problem with the editor 'cat git commit --amend'.\n> Please supply the message using either -m or -F option.\n> Could not commit staged changes.\n\nThat looks like you did something like:\nexport GIT_EDITOR=\"cat git commit --amend\"\n\nBut the original command was:\n  GIT_EDITOR=cat git commit --amend\n\nNotice that there are no quotes and no escaped spaces. This is a\nshortcut to set GIT_EDITOR to \"cat\" for just this one command (git\ncommit --amend).\n\nIf you want to set the editor in the environment, use just \"export\nGIT_EDITOR=cat\" or something like that.\n\nHTH\nBjörn\n"},{"id":"180448","messageId":"4EDEFD66.4020404@st.com","threadId":"29094","inReplyTo":"20111207045325.GA22990@atjola.homenet","subject":"Re: Query on git commit amend","fromName":"Viresh Kumar","fromEmail":"viresh.kumar@st.com","sentAt":"2011-12-07T05:45:10Z","receivedAt":"2011-12-07T05:45:10Z","isPatch":false,"sender":{"key":"viresh.kumar@st.com","avatar":null},"body":"On 12/7/2011 10:23 AM, Björn Steinbrink wrote:\n> That looks like you did something like:\n> export GIT_EDITOR=\"cat git commit --amend\"\n> \n> But the original command was:\n>   GIT_EDITOR=cat git commit --amend\n> \n> Notice that there are no quotes and no escaped spaces. This is a\n> shortcut to set GIT_EDITOR to \"cat\" for just this one command (git\n> commit --amend).\n> \n> If you want to set the editor in the environment, use just \"export\n> GIT_EDITOR=cat\" or something like that.\n\nOk. Got it now.\n\nNow, whats the benefit of \n\nGIT_EDITOR=cat git commit --amend\n\nover\n\ngit commit --amend -C HEAD\n\n?\n\nObviously if we have more than one commit to handle during a rebase then,\nsetting editor to cat once, would be good. As now we don't really need to\ndo git commit --amend. We can add commits and continue rebase.\nBut for single commit probably second one looks easier. Isn't it?\nOr maybe the latest patch from Junio is even better.\n\n-- \nviresh\n"},{"id":"180480","messageId":"20111207144217.GA30157@elie.hsd1.il.comcast.net","threadId":"29094","inReplyTo":"7vk469fm9j.fsf@alter.siamese.dyndns.org","subject":"[PATCH/RFC 0/4] Re: commit: honor --no-edit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-12-07T14:42:17Z","receivedAt":"2011-12-07T14:42:17Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> And this should fix it (only lightly tested).\n>\n> -- >8 --\n> Subject: [PATCH] commit: honor --no-edit\n>\n> After making fixes to the contents to be committed, it is not unusual to\n> update the current commit without rewording the message. Idioms to do\n> tell \"commit --amend\" that we do not need an editor have been:\n>\n>     $ EDITOR=: git commit --amend\n>     $ git commit --amend -C HEAD\n>\n> but that was only because a more natural\n>\n>     $ git commit --amend --no-edit\n>\n> did not honour \"--no-edit\" option.    \n\nI like it.\n\nHere are a couple of tests.  The three patches before are just to make\nit less frightening to add to the relevant test script.\n\nJonathan Nieder (4):\n  test: add missing \"&&\" after echo command\n  test: remove a test of porcelain that hardcodes commit ids\n  t7501 (commit): modernize style\n  test: commit --amend should honor --no-edit\n\n t/t7501-commit.sh |  335 ++++++++++++++++++++++++++++-------------------------\n 1 files changed, 175 insertions(+), 160 deletions(-)\n"},{"id":"180482","messageId":"20111207144540.GB30157@elie.hsd1.il.comcast.net","threadId":"29094","inReplyTo":"20111207144217.GA30157@elie.hsd1.il.comcast.net","subject":"[PATCH 1/4] test: add missing \"&&\" after echo command","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-12-07T14:45:40Z","receivedAt":"2011-12-07T14:45:40Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"This test wants to modify a file and commit the change, but because of\na missing separator between commands it is parsed as a single \"echo\"\ncommand.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t7501-commit.sh |   13 +++++++------\n 1 files changed, 7 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t7501-commit.sh b/t/t7501-commit.sh\nindex 3ad04363..da75abc1 100755\n--- a/t/t7501-commit.sh\n+++ b/t/t7501-commit.sh\n@@ -60,7 +60,7 @@ test_expect_success \\\n \n test_expect_success \\\n \t\"next commit\" \\\n-\t\"echo 'bongo bongo bongo' >file \\\n+\t\"echo 'bongo bongo bongo' >file && \\\n \t git commit -m next -a\"\n \n test_expect_success \\\n@@ -172,11 +172,12 @@ test_expect_success \\\n # easier to isolate bugs.\n \n cat >expected <<\\EOF\n-72c0dc9855b0c9dadcbfd5a31cab072e0cb774ca\n-9b88fc14ce6b32e3d9ee021531a54f18a5cf38a2\n-3536bbb352c3a1ef9a420f5b4242d48578b92aa7\n-d381ac431806e53f3dd7ac2f1ae0534f36d738b9\n-4fd44095ad6334f3ef72e4c5ec8ddf108174b54a\n+285fcf7ec0d61b14249dfdb4c1e1fe03eaf15ee0\n+0b8148b9afce917b87d71199b900466dc8ea8b6e\n+43fb8826314939ce79a856face7953557fdca3d1\n+eaa04bc3ae0f0b003f7f1d86bf869ec5d73eaf3e\n+ee1963b250ee0f02a3fe37be0e4a02bb5af6a1ad\n+b49f306003c627361a0304d151a6b4c8b26af6a1\n 402702b49136e7587daa9280e91e4bb7cb2179f7\n EOF\n \n-- \n1.7.8.rc3\n"},{"id":"180483","messageId":"20111207144929.GC30157@elie.hsd1.il.comcast.net","threadId":"29094","inReplyTo":"20111207144217.GA30157@elie.hsd1.il.comcast.net","subject":"[PATCH 2/4] test: remove a porcelain test that hard-codes commit names","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-12-07T14:49:29Z","receivedAt":"2011-12-07T14:49:29Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"The rev-list output in this test depends on the details of test_tick's\ndummy dates and the choice of hash function.  Worse, it depends on the\norder and nature of commits made in the earlier tests, so adding new\ntests or rearranging existing ones breaks it.\n\nIt would be nice to check that \"git commit\" and commit-tree name\nobjects consistently and that commit objects' text is as documented,\nbut this particular test checks everything at once and hence is not a\nrobust test for that.  Remove it.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nHence the odd hunk in the previous patch.\n\nMaybe this doesn't belong in this series, but it's the kind of thing\nthat drives me batty when writing new tests.\n\n t/t7501-commit.sh |   20 --------------------\n 1 files changed, 0 insertions(+), 20 deletions(-)\n\ndiff --git a/t/t7501-commit.sh b/t/t7501-commit.sh\nindex da75abc1..9c507b08 100755\n--- a/t/t7501-commit.sh\n+++ b/t/t7501-commit.sh\n@@ -144,10 +144,6 @@ test_expect_success PERL \\\n \tgit diff >diff2 &&\n \ttest_cmp diff1 diff2\"\n \n-test_expect_success \\\n-\t\"showing committed revisions\" \\\n-\t\"git rev-list HEAD >current\"\n-\n cat >editor <<\\EOF\n #!/bin/sh\n sed -e \"s/good/bad/g\" < \"$1\" > \"$1-\"\n@@ -168,22 +164,6 @@ test_expect_success \\\n \t echo \"Another good message.\" | EDITOR=./editor git commit -a -F - &&\n \t git show -s --pretty=format:\"%s\" | grep -q good\n \t '\n-# We could just check the head sha1, but checking each commit makes it\n-# easier to isolate bugs.\n-\n-cat >expected <<\\EOF\n-285fcf7ec0d61b14249dfdb4c1e1fe03eaf15ee0\n-0b8148b9afce917b87d71199b900466dc8ea8b6e\n-43fb8826314939ce79a856face7953557fdca3d1\n-eaa04bc3ae0f0b003f7f1d86bf869ec5d73eaf3e\n-ee1963b250ee0f02a3fe37be0e4a02bb5af6a1ad\n-b49f306003c627361a0304d151a6b4c8b26af6a1\n-402702b49136e7587daa9280e91e4bb7cb2179f7\n-EOF\n-\n-test_expect_success \\\n-    'validate git rev-list output.' \\\n-    'test_cmp expected current'\n \n test_expect_success 'partial commit that involves removal (1)' '\n \n-- \n1.7.8.rc3\n"},{"id":"180484","messageId":"20111207145022.GD30157@elie.hsd1.il.comcast.net","threadId":"29094","inReplyTo":"20111207144217.GA30157@elie.hsd1.il.comcast.net","subject":"[PATCH 3/4] t7501 (commit): modernize style","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-12-07T14:50:23Z","receivedAt":"2011-12-07T14:50:23Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Put the opening quote starting each test on the same line as the\ntest_expect_* invocation.  While at it:\n\n- guard commands that prepare test input for individual tests in\n  the same test_expect_success, so their scope is clearer and\n  errors at that stage can be caught;\n- use the compare_diff_patch helper function when comparing patches;\n- use single-quotes in preference to double-quotes and <<\\EOF in\n  preference to <<EOF, to save readers the trouble of looking for\n  variable interpolations;\n- lift the setting of the $author variable used throughout the\n  test script to the top of the test script;\n- include \"setup\" in the titles of test assertions that prepare for\n  later ones to make it more obvious which tests can be skipped;\n- use test_must_fail instead of \"if ...; then:; else false; fi\",\n  for clarity and to catch segfaults when they happen;\n- break up some pipelines into separate commands that read and write\n  to ordinary files, and test the exit status at each stage;\n- chain commands with &&.  Breaks in a test assertion's && chain can\n  potentially hide failures from earlier commands in the chain;\n- combine two initial tests that do not make as much sense alone.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nMiscellaneous cleanups.\n\n t/t7501-commit.sh |  278 ++++++++++++++++++++++++++---------------------------\n 1 files changed, 136 insertions(+), 142 deletions(-)\n\ndiff --git a/t/t7501-commit.sh b/t/t7501-commit.sh\nindex 9c507b08..bf025df6 100755\n--- a/t/t7501-commit.sh\n+++ b/t/t7501-commit.sh\n@@ -8,39 +8,39 @@\n \n test_description='git commit'\n . ./test-lib.sh\n+. \"$TEST_DIRECTORY/diff-lib.sh\"\n+\n+author='The Real Author <someguy@his.email.org>'\n \n test_tick\n \n-test_expect_success \\\n-\t\"initial status\" \\\n-\t\"echo 'bongo bongo' >file &&\n-\t git add file\"\n-\n-test_expect_success \"Constructing initial commit\" '\n+test_expect_success 'initial status' '\n+\techo bongo bongo >file &&\n+\tgit add file &&\n \tgit status >actual &&\n \ttest_i18ngrep \"Initial commit\" actual\n '\n \n-test_expect_success \\\n-\t\"fail initial amend\" \\\n-\t\"test_must_fail git commit --amend\"\n+test_expect_success 'fail initial amend' '\n+\ttest_must_fail git commit --amend\n+'\n \n-test_expect_success \\\n-\t\"initial commit\" \\\n-\t\"git commit -m initial\"\n+test_expect_success 'setup: initial commit' '\n+\tgit commit -m initial\n+'\n \n-test_expect_success \\\n-\t\"invalid options 1\" \\\n-\t\"test_must_fail git commit -m foo -m bar -F file\"\n+test_expect_success '-m and -F do not mix' '\n+\ttest_must_fail git commit -m foo -m bar -F file\n+'\n \n-test_expect_success \\\n-\t\"invalid options 2\" \\\n-\t\"test_must_fail git commit -C HEAD -m illegal\"\n+test_expect_success '-m and -C do not mix' '\n+\ttest_must_fail git commit -C HEAD -m illegal\n+'\n \n-test_expect_success \\\n-\t\"using paths with -a\" \\\n-\t\"echo King of the bongo >file &&\n-\ttest_must_fail git commit -m foo -a file\"\n+test_expect_success 'paths and -a do not mix' '\n+\techo King of the bongo >file &&\n+\ttest_must_fail git commit -m foo -a file\n+'\n \n test_expect_success PERL 'can use paths with --interactive' '\n \techo bong-o-bong >file &&\n@@ -50,120 +50,123 @@ test_expect_success PERL 'can use paths with --interactive' '\n \tgit reset --hard HEAD^\n '\n \n-test_expect_success \\\n-\t\"using invalid commit with -C\" \\\n-\t\"test_must_fail git commit -C bogus\"\n-\n-test_expect_success \\\n-\t\"testing nothing to commit\" \\\n-\t\"test_must_fail git commit -m initial\"\n-\n-test_expect_success \\\n-\t\"next commit\" \\\n-\t\"echo 'bongo bongo bongo' >file && \\\n-\t git commit -m next -a\"\n-\n-test_expect_success \\\n-\t\"commit message from non-existing file\" \\\n-\t\"echo 'more bongo: bongo bongo bongo bongo' >file && \\\n-\t test_must_fail git commit -F gah -a\"\n-\n-# Empty except stray tabs and spaces on a few lines.\n-sed -e 's/@$//' >msg <<EOF\n-\t\t@\n-\n-  @\n-Signed-off-by: hula\n-EOF\n-test_expect_success \\\n-\t\"empty commit message\" \\\n-\t\"test_must_fail git commit -F msg -a\"\n-\n-test_expect_success \\\n-\t\"commit message from file\" \\\n-\t\"echo 'this is the commit message, coming from a file' >msg && \\\n-\t git commit -F msg -a\"\n-\n-cat >editor <<\\EOF\n-#!/bin/sh\n-sed -e \"s/a file/an amend commit/g\" < \"$1\" > \"$1-\"\n-mv \"$1-\" \"$1\"\n-EOF\n-chmod 755 editor\n-\n-test_expect_success \\\n-\t\"amend commit\" \\\n-\t\"EDITOR=./editor git commit --amend\"\n-\n-test_expect_success \\\n-\t\"passing -m and -F\" \\\n-\t\"echo 'enough with the bongos' >file && \\\n-\t test_must_fail git commit -F msg -m amending .\"\n-\n-test_expect_success \\\n-\t\"using message from other commit\" \\\n-\t\"git commit -C HEAD^ .\"\n-\n-cat >editor <<\\EOF\n-#!/bin/sh\n-sed -e \"s/amend/older/g\"  < \"$1\" > \"$1-\"\n-mv \"$1-\" \"$1\"\n-EOF\n-chmod 755 editor\n-\n-test_expect_success \\\n-\t\"editing message from other commit\" \\\n-\t\"echo 'hula hula' >file && \\\n-\t EDITOR=./editor git commit -c HEAD^ -a\"\n-\n-test_expect_success \\\n-\t\"message from stdin\" \\\n-\t\"echo 'silly new contents' >file && \\\n-\t echo commit message from stdin | git commit -F - -a\"\n-\n-test_expect_success \\\n-\t\"overriding author from command line\" \\\n-\t\"echo 'gak' >file && \\\n-\t git commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a >output 2>&1\"\n-\n-test_expect_success \\\n-\t\"commit --author output mentions author\" \\\n-\t\"grep Rubber.Duck output\"\n-\n-test_expect_success PERL \\\n-\t\"interactive add\" \\\n-\t\"echo 7 | git commit --interactive | grep 'What now'\"\n-\n-test_expect_success PERL \\\n-\t\"commit --interactive doesn't change index if editor aborts\" \\\n-\t\"echo zoo >file &&\n+test_expect_success 'using invalid commit with -C' '\n+\ttest_must_fail git commit -C bogus\n+'\n+\n+test_expect_success 'nothing to commit' '\n+\ttest_must_fail git commit -m initial\n+'\n+\n+test_expect_success 'setup: non-initial commit' '\n+\techo bongo bongo bongo >file &&\n+\tgit commit -m next -a\n+'\n+\n+test_expect_success 'commit message from non-existing file' '\n+\techo more bongo: bongo bongo bongo bongo >file &&\n+\ttest_must_fail git commit -F gah -a\n+'\n+\n+test_expect_success 'empty commit message' '\n+\t# Empty except stray tabs and spaces on a few lines.\n+\tsed -e \"s/@//g\" >msg <<-\\EOF &&\n+\t\t@\t\t@\n+\t\t@@\n+\t\t@  @\n+\t\t@Signed-off-by: hula@\n+\tEOF\n+\ttest_must_fail git commit -F msg -a\n+'\n+\n+test_expect_success 'setup: commit message from file' '\n+\techo this is the commit message, coming from a file >msg &&\n+\tgit commit -F msg -a\n+'\n+\n+test_expect_success 'amend commit' '\n+\tcat >editor <<-\\EOF &&\n+\t#!/bin/sh\n+\tsed -e \"s/a file/an amend commit/g\" < \"$1\" > \"$1-\"\n+\tmv \"$1-\" \"$1\"\n+\tEOF\n+\tchmod 755 editor &&\n+\tEDITOR=./editor git commit --amend\n+'\n+\n+test_expect_success '-m and -F do not mix' '\n+\techo enough with the bongos >file &&\n+\ttest_must_fail git commit -F msg -m amending .\n+'\n+\n+test_expect_success 'using message from other commit' '\n+\tgit commit -C HEAD^ .\n+'\n+\n+test_expect_success 'editing message from other commit' '\n+\tcat >editor <<-\\EOF &&\n+\t#!/bin/sh\n+\tsed -e \"s/amend/older/g\"  < \"$1\" > \"$1-\"\n+\tmv \"$1-\" \"$1\"\n+\tEOF\n+\tchmod 755 editor &&\n+\techo hula hula >file &&\n+\tEDITOR=./editor git commit -c HEAD^ -a\n+'\n+\n+test_expect_success 'message from stdin' '\n+\techo silly new contents >file &&\n+\techo commit message from stdin |\n+\tgit commit -F - -a\n+'\n+\n+test_expect_success 'overriding author from command line' '\n+\techo gak >file &&\n+\tgit commit -m author \\\n+\t\t--author \"Rubber Duck <rduck@convoy.org>\" -a >output 2>&1 &&\n+\tgrep Rubber.Duck output\n+'\n+\n+test_expect_success PERL 'interactive add' '\n+\techo 7 |\n+\tgit commit --interactive |\n+\tgrep \"What now\"\n+'\n+\n+test_expect_success PERL \"commit --interactive doesn't change index if editor aborts\" '\n+\techo zoo >file &&\n \ttest_must_fail git diff --exit-code >diff1 &&\n-\t(echo u ; echo '*' ; echo q) |\n-\t(EDITOR=: && export EDITOR &&\n-\t test_must_fail git commit --interactive) &&\n+\t(echo u ; echo \"*\" ; echo q) |\n+\t(\n+\t\tEDITOR=: &&\n+\t\texport EDITOR &&\n+\t\ttest_must_fail git commit --interactive\n+\t) &&\n \tgit diff >diff2 &&\n-\ttest_cmp diff1 diff2\"\n+\tcompare_diff_patch diff1 diff2\n+'\n \n-cat >editor <<\\EOF\n-#!/bin/sh\n-sed -e \"s/good/bad/g\" < \"$1\" > \"$1-\"\n-mv \"$1-\" \"$1\"\n-EOF\n-chmod 755 editor\n+test_expect_success 'editor not invoked if -F is given' '\n+\tcat >editor <<-\\EOF &&\n+\t#!/bin/sh\n+\tsed -e s/good/bad/g <\"$1\" >\"$1-\"\n+\tmv \"$1-\" \"$1\"\n+\tEOF\n+\tchmod 755 editor &&\n \n-cat >msg <<EOF\n-A good commit message.\n-EOF\n+\techo A good commit message. >msg &&\n+\techo moo >file &&\n \n-test_expect_success \\\n-\t'editor not invoked if -F is given' '\n-\t echo \"moo\" >file &&\n-\t EDITOR=./editor git commit -a -F msg &&\n-\t git show -s --pretty=format:\"%s\" | grep -q good &&\n-\t echo \"quack\" >file &&\n-\t echo \"Another good message.\" | EDITOR=./editor git commit -a -F - &&\n-\t git show -s --pretty=format:\"%s\" | grep -q good\n-\t '\n+\tEDITOR=./editor git commit -a -F msg &&\n+\tgit show -s --pretty=format:%s >subject &&\n+\tgrep -q good subject &&\n+\n+\techo quack >file &&\n+\techo Another good message. |\n+\tEDITOR=./editor git commit -a -F - &&\n+\tgit show -s --pretty=format:%s >subject &&\n+\tgrep -q good subject\n+'\n \n test_expect_success 'partial commit that involves removal (1)' '\n \n@@ -197,7 +200,6 @@ test_expect_success 'partial commit that involves removal (3)' '\n \n '\n \n-author=\"The Real Author <someguy@his.email.org>\"\n test_expect_success 'amend commit to fix author' '\n \n \toldtick=$GIT_AUTHOR_DATE &&\n@@ -326,7 +328,6 @@ test_expect_success 'multiple -m' '\n \n '\n \n-author=\"The Real Author <someguy@his.email.org>\"\n test_expect_success 'amend commit to fix author' '\n \n \toldtick=$GIT_AUTHOR_DATE &&\n@@ -353,15 +354,8 @@ test_expect_success 'git commit <file> with dirty index' '\n \n test_expect_success 'same tree (single parent)' '\n \n-\tgit reset --hard\n-\n-\tif git commit -m empty\n-\tthen\n-\t\techo oops -- should have complained\n-\t\tfalse\n-\telse\n-\t\t: happy\n-\tfi\n+\tgit reset --hard &&\n+\ttest_must_fail git commit -m empty\n \n '\n \n-- \n1.7.8.rc3\n"},{"id":"180485","messageId":"20111207145414.GE30157@elie.hsd1.il.comcast.net","threadId":"29094","inReplyTo":"20111207144217.GA30157@elie.hsd1.il.comcast.net","subject":"[PATCH 4/4] test: commit --amend should honor --no-edit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-12-07T14:54:14Z","receivedAt":"2011-12-07T14:54:14Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"A quick test to make sure git doesn't lose the functionality added by\nthe recent patch \"commit: honor --no-edit\", plus another test to check\nthe classical --edit use case (use with \"-m\").\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t7501-commit.sh |   40 ++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 40 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7501-commit.sh b/t/t7501-commit.sh\nindex bf025df6..c462bf3b 100755\n--- a/t/t7501-commit.sh\n+++ b/t/t7501-commit.sh\n@@ -94,6 +94,46 @@ test_expect_success 'amend commit' '\n \tEDITOR=./editor git commit --amend\n '\n \n+test_expect_success 'set up editor' '\n+\tcat >editor <<-\\EOF &&\n+\t#!/bin/sh\n+\tsed -e \"s/unamended/amended/g\" <\"$1\" >\"$1-\"\n+\tmv \"$1-\" \"$1\"\n+\tEOF\n+\tchmod 755 editor\n+'\n+\n+test_expect_success 'amend without launching editor' '\n+\techo unamended >expect &&\n+\tgit commit --allow-empty -m \"unamended\" &&\n+\techo needs more bongo >file &&\n+\tgit add file &&\n+\tEDITOR=./editor git commit --no-edit --amend &&\n+\tgit diff --exit-code HEAD -- file &&\n+\tgit diff-tree -s --format=%s HEAD >msg &&\n+\ttest_cmp expect msg\n+'\n+\n+test_expect_success '--amend --edit' '\n+\techo amended >expect &&\n+\tgit commit --allow-empty -m \"unamended\" &&\n+\techo bongo again >file &&\n+\tgit add file &&\n+\tEDITOR=./editor git commit --edit --amend &&\n+\tgit diff-tree -s --format=%s HEAD >msg &&\n+\ttest_cmp expect msg\n+'\n+\n+test_expect_success '-m --edit' '\n+\techo amended >expect &&\n+\tgit commit --allow-empty -m buffer &&\n+\techo bongo bongo >file &&\n+\tgit add file &&\n+\tEDITOR=./editor git commit -m unamended --edit &&\n+\tgit diff-tree -s  --format=%s HEAD >msg &&\n+\ttest_cmp expect msg\n+'\n+\n test_expect_success '-m and -F do not mix' '\n \techo enough with the bongos >file &&\n \ttest_must_fail git commit -F msg -m amending .\n-- \n1.7.8.rc3\n"},{"id":"180486","messageId":"87ehwgv2uc.fsf@gmail.com","threadId":"29094","inReplyTo":"4EDEFD66.4020404@st.com","subject":"Re: Query on git commit amend","fromName":"Vijay Lakshminarayanan","fromEmail":"laksvij@gmail.com","sentAt":"2011-12-07T15:06:03Z","receivedAt":"2011-12-07T15:06:03Z","isPatch":false,"sender":{"key":"laksvij@gmail.com","avatar":null},"body":"Viresh Kumar <viresh.kumar@st.com> writes:\n\n[snip]\n\n> Now, whats the benefit of \n>\n> GIT_EDITOR=cat git commit --amend\n>\n> over\n>\n> git commit --amend -C HEAD\n>\n> ?\n\nThe latter preserves the original timestamp of the commit and other\nenvironment variables like GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL\nwhereas GIT_EDITOR=cat (or true or :) are equivalent to opening up the\ncommit in an editor and so consider these variables during execution.\n\nFor instance, you could say\n\n$ GIT_EDITOR=cat GIT_COMMITTER_EMAIL=foo@bar.baz git commit --amend\n\nand the commiter email would be set to foo@bar.baz\n\n-- \nCheers\n~vijay\n\nGnus should be more complicated.\n"},{"id":"180544","messageId":"20111207231002.GD21852@sigill.intra.peff.net","threadId":"29094","inReplyTo":"20111207144540.GB30157@elie.hsd1.il.comcast.net","subject":"Re: [PATCH 1/4] test: add missing \"&&\" after echo command","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-12-07T23:10:03Z","receivedAt":"2011-12-07T23:10:03Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Dec 07, 2011 at 08:45:40AM -0600, Jonathan Nieder wrote:\n\n> diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh\n> index 3ad04363..da75abc1 100755\n> --- a/t/t7501-commit.sh\n> +++ b/t/t7501-commit.sh\n> @@ -60,7 +60,7 @@ test_expect_success \\\n>  \n>  test_expect_success \\\n>  \t\"next commit\" \\\n> -\t\"echo 'bongo bongo bongo' >file \\\n> +\t\"echo 'bongo bongo bongo' >file && \\\n>  \t git commit -m next -a\"\n\nPatch is obviously correct, but isn't the \"\\\" here just superfluous and\nerror-prone? Maybe it should just be dropped from the new version (and\npossibly from other tests in t7501).\n\n-Peff\n"},{"id":"180545","messageId":"20111207231140.GE21852@sigill.intra.peff.net","threadId":"29094","inReplyTo":"20111207231002.GD21852@sigill.intra.peff.net","subject":"Re: [PATCH 1/4] test: add missing \"&&\" after echo command","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-12-07T23:11:40Z","receivedAt":"2011-12-07T23:11:40Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Dec 07, 2011 at 06:10:03PM -0500, Jeff King wrote:\n\n> On Wed, Dec 07, 2011 at 08:45:40AM -0600, Jonathan Nieder wrote:\n> \n> > diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh\n> > index 3ad04363..da75abc1 100755\n> > --- a/t/t7501-commit.sh\n> > +++ b/t/t7501-commit.sh\n> > @@ -60,7 +60,7 @@ test_expect_success \\\n> >  \n> >  test_expect_success \\\n> >  \t\"next commit\" \\\n> > -\t\"echo 'bongo bongo bongo' >file \\\n> > +\t\"echo 'bongo bongo bongo' >file && \\\n> >  \t git commit -m next -a\"\n> \n> Patch is obviously correct, but isn't the \"\\\" here just superfluous and\n> error-prone? Maybe it should just be dropped from the new version (and\n> possibly from other tests in t7501).\n\nOh, nevermind. I just read your patch 3, which does that and much more.\nI approve.\n\n-Peff\n"},{"id":"180557","messageId":"4EE04A6D.5020503@st.com","threadId":"29094","inReplyTo":"87fwgxwvn9.fsf@gmail.com","subject":"Re: Query on git commit amend","fromName":"Viresh Kumar","fromEmail":"viresh.kumar@st.com","sentAt":"2011-12-08T05:26:05Z","receivedAt":"2011-12-08T05:26:05Z","isPatch":false,"sender":{"key":"viresh.kumar@st.com","avatar":null},"body":"On 12/6/2011 9:16 PM, Vijay Lakshminarayanan wrote:\n> I've found \n> \n> $ GIT_EDITOR=cat git commit --amend\n> \n> useful.\n> \n> The benefit of this technique is that it even works for git-rebase -i.\n> \n> In my typical git usage, I do a lot of git-commit --fixup's.  After\n> reaching a level of stability, I change the history with:\n> \n> GIT_EDITOR=cat git rebase -i --autosquash\n> \n> and my history is adjusted without requiring manual intervention.\n\nHi Junio,\n\nAfter going through autosquash option for rebase, i was wondering\nif there is a way to create a new commit easily for autosquash.\n\nFor autosquash to work, we need to keep the same commit log/title,\nprefixed with squash! or Fixup! etc. What about adding another option\nin commit amend which adds squash! or Fixup! automatically. So, manual\nintervention at all. :)\n\nI don't know if it already exist.\n\n-- \nviresh\n"},{"id":"180558","messageId":"4EE04B73.8080102@st.com","threadId":"29094","inReplyTo":"4EE04A6D.5020503@st.com","subject":"Re: Query on git commit amend","fromName":"Viresh Kumar","fromEmail":"viresh.kumar@st.com","sentAt":"2011-12-08T05:30:27Z","receivedAt":"2011-12-08T05:30:27Z","isPatch":false,"sender":{"key":"viresh.kumar@st.com","avatar":null},"body":"On 12/8/2011 10:56 AM, Viresh Kumar wrote:\n> For autosquash to work, we need to keep the same commit log/title,\n> prefixed with squash! or Fixup! etc. What about adding another option\n> in commit amend which adds squash! or Fixup! automatically. So, manual\n> intervention at all. :)\n\nDone. It is already there in git commit.\n\n-- \nviresh\n"},{"id":"180602","messageId":"7vvcprar3v.fsf@alter.siamese.dyndns.org","threadId":"29094","inReplyTo":"4EDEFD66.4020404@st.com","subject":"Re: Query on git commit amend","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-12-08T17:52:04Z","receivedAt":"2011-12-08T17:52:04Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Viresh Kumar <viresh.kumar@st.com> writes:\n\n> GIT_EDITOR=cat git commit --amend\n>\n> over\n>\n> git commit --amend -C HEAD\n>\n> ?\n>\n> ...\n> But for single commit probably second one looks easier. Isn't it?\n\nI saw \"--amend -C HEAD\" mentioned in some newbie-guide webpages, and I\nthink you just copy/learned from one of them, so it is not entirely your\nfault, but the combination of --amend and \"-C HEAD\" is an idiotic thing\nthat happens to work, if you think about what exactly you are telling to\nthe command.\n\nThe point of --amend is twofold. One is to let you tweak the contents of\nwhat is committed, which is not the topic of this thread, and the other is\nto allow the user to reuse the log message from the commit being amended,\ninstead of typing the message from scratch.\n\nThe \"-c <commit>\" and its cousin \"-C <commit>\" options are about telling\nGit that the user does _not_ want the other usual logic to come up with\nthe initial commit template (e.g. when committing anew, it may read the\nlog template file, when committing a merge, it may read the MERGE_MSG\nprepared by fmt-merge-msg, and most importantly in this context, when\namending, the one that is prepared by the --amend logic is used) kick in\nat all, and instead wants to start from the log message of the named\ncommit.\n\nSo by saying \"--amend -C HEAD\" you are saying \"I want to reuse the log\nmessage of the commit I am amending,... eh, scratch that, I instead want\nto use the log message of the HEAD commit\", as if the commit you are\namending and HEAD are two different things. That is idiotic.\n\nAnd you say that only for the side effect that capital \"-C\" stops the\neditor.\n\nCompared to that idiotic statement, \"EDITOR=: git commit --amend\" is a lot\nsaner way to say the same thing in a more direct and straightforward\nway. \"I want to reuse the log message of the commit I am amending, and the\neditor to use it while running that commit is the command 'true', i.e. the\none that does not really touch any line in the text file and successfully\nexits, because I am not going to change anything\".\n\nOf course, if \"git commit --amend\" honoured \"--no-edit\", that is even more\ndirect, straightforward and intuitive way to say so ;-)\n"},{"id":"180628","messageId":"4EE19358.8080600@st.com","threadId":"29094","inReplyTo":"7vvcprar3v.fsf@alter.siamese.dyndns.org","subject":"Re: Query on git commit amend","fromName":"Viresh Kumar","fromEmail":"viresh.kumar@st.com","sentAt":"2011-12-09T04:49:28Z","receivedAt":"2011-12-09T04:49:28Z","isPatch":false,"sender":{"key":"viresh.kumar@st.com","avatar":null},"body":"On 12/8/2011 11:22 PM, Junio C Hamano wrote:\n> So by saying \"--amend -C HEAD\" you are saying \"I want to reuse the log\n> message of the commit I am amending,... eh, scratch that, I instead want\n> to use the log message of the HEAD commit\", as if the commit you are\n> amending and HEAD are two different things. That is idiotic.\n> \n> Of course, if \"git commit --amend\" honoured \"--no-edit\", that is even more\n> direct, straightforward and intuitive way to say so ;-)\n\nGot your point. That's correct.\n\n-- \nviresh\n"}]}