{"thread":{"id":"9572","subject":"[PATCH] Correct documentation of 'reflog show' to explain it shows HEAD","startedAt":"2007-08-19T08:18:47Z","lastAt":"2007-08-20T23:42:30Z","messageCount":3,"participants":["Shawn O. Pearce","Matthew Gwynne","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"50995","messageId":"20070819081847.GA6166@spearce.org","threadId":"9572","inReplyTo":null,"subject":"[PATCH] Correct documentation of 'reflog show' to explain it shows HEAD","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-08-19T08:18:47Z","receivedAt":"2007-08-19T08:18:47Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"By default 'git reflog show' will show the reflog of 'HEAD' and not\nthe reflog of the current branch.  This is most likely due to the\nwork done a while ago as part of the detached HEAD series to allow\nHEAD to have its own reflog independent of each branch's reflog.\n\nSince 'git reflog show' is really just an obscure alias for 'git\nlog -g --abbrev-commit --pretty=oneline' it should behave the same\nway and its documentation should match.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n Documentation/git-reflog.txt |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt\nindex 89bc9c5..29b7d9f 100644\n--- a/Documentation/git-reflog.txt\n+++ b/Documentation/git-reflog.txt\n@@ -32,7 +32,8 @@ directly by the end users -- instead, see gitlink:git-gc[1].\n \n The subcommand \"show\" (which is also the default, in the absense of any\n subcommands) will take all the normal log options, and show the log of\n-the current branch. It is basically an alias for 'git log -g --abbrev-commit\n+`HEAD`, which will cover all recent actions, including branch switches.\n+It is basically an alias for 'git log -g --abbrev-commit\n --pretty=oneline', see gitlink:git-log[1].\n \n \n-- \n1.5.3.rc5.19.g0734d\n"},{"id":"51137","messageId":"20070820225323.GA25430@ares","threadId":"9572","inReplyTo":"20070819081847.GA6166@spearce.org","subject":"Issues with envelopesender and empty log messages using contrib/hooks/post-receive-email","fromName":"Matthew Gwynne","fromEmail":"mathew.gwynne@gmail.com","sentAt":"2007-08-20T22:53:23Z","receivedAt":"2007-08-20T22:53:23Z","isPatch":false,"sender":{"key":"mathew.gwynne@gmail.com","avatar":null},"body":"I've recently encountered 2 problems with use of the example\npost-receive-mail script in contrib/hooks/post-receive-email.\n\nFirstly I found that having set hooks.envelopesender, the script ended\nup sending mail with the envelope sender set to the email address\ngiven literally surrounded by single quotes which caused the mail\nserver to complain about invalid address syntax.\n\nThe offending lines appears to be - \n\nif [ -n \"$envelopesender\" ]; then\n   envelopesender=\"-f '$envelopesender'\"\nfi\n\nwhich when replaced with \n\nif [ -n \"$envelopesender\" ]; then\n   envelopesender=\"-f \\\"$envelopesender\\\"\"\nfi\n\nhave the desired effect of the script using the unaltered envelope\nsender when sending mail as set in hooks.envelopesender. I have\nattached a diff to this effect.\n\nThe second problem is that when using a branch that is derived from\nmaster, has some differences, but regularly has master merged into it\nto keep it up to date. If one makes some changes to master, merges\nthese into the other branch, then pushes these to the repository with\nthe mail hook, the email regarding the changes to master has an empty\nlog message.\n\nThe relevant lines seem to be in generate_update_branch_email(), line\n380 - \n\ngit rev-parse --not --branches | grep -v $(git rev-parse $refname) |\ngit rev-list --pretty --stdin $oldrev..$newrev\n\nI understand git-rev-parse will return the negation of the heads of\nboths branches (master and the other branch) and then the master\nbranch negation is grep outed. However that leaves essentially the\ncommand - \n\ngit rev-list --pretty --stdin $oldrev..$newrev ^$otherbranchhead\n\nwhich when $oldrev and $newrev are in the other branch as well seems\nto result in an empty list / no result as nothing before\n$otherbranchhead should be shown, and $oldrev and $newrev are both\nbefore $otherbranchhead in the stated case but have never been shown\nin any mails.\n\nSteps to reproduce :\n\n1) Create a repository (repo1) with just the master branch and make\nsome commits.  \n2) Copy contrib/hooks/post-receive-email to [.git/]hooks/post-receive\nand chmod +x it.  \n3) Create a branch (testbranch) in repo1 \n4) Clone repo1 creating repo2 \n5) Checkout repo1/testbranch in repo2 \n6) Make some commits to testbranch in repo2 \n7) Push from repo2 to repo1 \n8) Make some commits in repo2/master \n9) Merge repo2/master into repo2/testbranch \n10) Push repo2 to repo1 \n11) Notice an empty log message for the mail detailing changes to\nmaster.\n\nIf I have misunderstood some key concepts rather than there being bugs\nhere, I apologise in advance, and would just like to know what stupid\nthing I've done :) \n\nMatthew Gwynne\n\ndiff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email\nindex c589a39..a733d0c 100644\n--- a/contrib/hooks/post-receive-email\n+++ b/contrib/hooks/post-receive-email\n@@ -608,7 +608,7 @@ if [ -n \"$1\" -a -n \"$2\" -a -n \"$3\" ]; then\n \tPAGER= generate_email $2 $3 $1\n else\n \tif [ -n \"$envelopesender\" ]; then\n-\t\tenvelopesender=\"-f '$envelopesender'\"\n+\t\tenvelopesender=\"-f \\\"$envelopesender\\\"\"\n \tfi\n \n \twhile read oldrev newrev refname\n"},{"id":"51138","messageId":"7vsl6drcwp.fsf@gitster.siamese.dyndns.org","threadId":"9572","inReplyTo":"20070820225323.GA25430@ares","subject":"Re: Issues with envelopesender and empty log messages using contrib/hooks/post-receive-email","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-20T23:42:30Z","receivedAt":"2007-08-20T23:42:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthew Gwynne <mathew.gwynne@gmail.com> writes:\n\n> I've recently encountered 2 problems with use of the example\n> post-receive-mail script in contrib/hooks/post-receive-email.\n\nThe script's author Andy Parkins Cc'ed.\n\n> Firstly I found that having set hooks.envelopesender, the script ended\n> up sending mail with the envelope sender set to the email address\n> given literally surrounded by single quotes which caused the mail\n> server to complain about invalid address syntax.\n> ...\n> diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email\n> index c589a39..a733d0c 100644\n> --- a/contrib/hooks/post-receive-email\n> +++ b/contrib/hooks/post-receive-email\n> @@ -608,7 +608,7 @@ if [ -n \"$1\" -a -n \"$2\" -a -n \"$3\" ]; then\n>  \tPAGER= generate_email $2 $3 $1\n>  else\n>  \tif [ -n \"$envelopesender\" ]; then\n> -\t\tenvelopesender=\"-f '$envelopesender'\"\n> +\t\tenvelopesender=\"-f \\\"$envelopesender\\\"\"\n>  \tfi\n>  \n>  \twhile read oldrev newrev refname\n\nI do not think this is a correct fix either.\n\nSuppose you have envelope sender \"A B <c@d.xz>\" and have\noriginal or your version to massage that string.\n\nA few lines below the part you quoted does this:\n\n\t/usr/sbin/sendmail -t $envelopesender\n\nwhich would expand and split at $IFS into\n\n\t/usr/sbin/sendmail -t -f 'A    B      <c@d.xz>'\n        $0                 $1 $2 $3    $4     $5 \n\nwhich is wrong, but then your fixed version would read as:\n\n\t/usr/sbin/sendmail -t -f '\"A   B      <c@d.xz>\"'\n        $0                 $1 $2 $3    $4     $5 \n\nwhich looks just as wrong.\n\nPerhaps you would need something like this (untested) patch.\n\n---\n\n contrib/hooks/post-receive-email |    7 ++-----\n 1 files changed, 2 insertions(+), 5 deletions(-)\n\ndiff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email\nindex c589a39..f1efd5f 100644\n--- a/contrib/hooks/post-receive-email\n+++ b/contrib/hooks/post-receive-email\n@@ -607,13 +607,10 @@ if [ -n \"$1\" -a -n \"$2\" -a -n \"$3\" ]; then\n \t# resend an email; they could redirect the output to sendmail themselves\n \tPAGER= generate_email $2 $3 $1\n else\n-\tif [ -n \"$envelopesender\" ]; then\n-\t\tenvelopesender=\"-f '$envelopesender'\"\n-\tfi\n-\n \twhile read oldrev newrev refname\n \tdo\n \t\tgenerate_email $oldrev $newrev $refname |\n-\t\t/usr/sbin/sendmail -t $envelopesender\n+\t\t/usr/sbin/sendmail -t ${envelopesender:+\"-f\"} \\\n+\t\t\t${envelopesender:+\"$envelopesender\"}\n \tdone\n fi\n"}]}