{"thread":{"id":"39553","subject":"[PATCH] git-rebase--interactive.sh: add config option for custom","startedAt":"2015-06-08T00:53:09Z","lastAt":"2015-06-08T17:29:58Z","messageCount":4,"participants":["Michael Rappazzo","Junio C Hamano","Mike Rappazzo"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"263165","messageId":"0000014dd0a821f6-a4ffca2d-d242-4e96-aeec-7a52186c5df1-000000@eu-west-1.amazonses.com","threadId":"39553","inReplyTo":null,"subject":"[PATCH] git-rebase--interactive.sh: add config option for custom","fromName":"Michael Rappazzo","fromEmail":"rappazzo@gmail.com","sentAt":"2015-06-08T00:53:09Z","receivedAt":"2015-06-08T00:53:09Z","isPatch":true,"sender":{"key":"rappazzo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/525287?v=4"},"body":"A config option 'rebase.instructionFormat' can override the\ndefault 'oneline' format of the rebase instruction list.\n\nSince the list is parsed using the left, right or boundary mark plus\nthe sha1, they are prepended to the instruction format.\n\nSigned-off-by: Michael Rappazzo <rappazzo@gmail.com>\n---\n git-rebase--interactive.sh | 9 ++++++++-\n 1 file changed, 8 insertions(+), 1 deletion(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex dc3133f..cc79b81 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -977,7 +977,14 @@ else\n \trevisions=$onto...$orig_head\n \tshortrevisions=$shorthead\n fi\n-git rev-list $merges_option --pretty=oneline --reverse --left-right --topo-order \\\n+format=$(git config --get rebase.instructionFormat)\n+if test -z \"$format\"\n+then\n+   format=\"%s\"\n+fi\n+# the 'rev-list .. | sed' requires %m to parse; the instruction requires %h to parse\n+format=\"%m%h ${format}\"\n+git rev-list $merges_option --pretty=\"${format}\" --reverse --left-right --topo-order \\\n \t$revisions ${restrict_revision+^$restrict_revision} | \\\n \tsed -n \"s/^>//p\" |\n while read -r sha1 rest\n\n---\nhttps://github.com/git/git/pull/146"},{"id":"263228","messageId":"xmqqsia2cj8c.fsf@gitster.dls.corp.google.com","threadId":"39553","inReplyTo":"0000014dd0a821f6-a4ffca2d-d242-4e96-aeec-7a52186c5df1-000000@eu-west-1.amazonses.com","subject":"Re: [PATCH] git-rebase--interactive.sh: add config option for custom","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-08T15:28:35Z","receivedAt":"2015-06-08T15:28:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Rappazzo <rappazzo@gmail.com> writes:\n\n> A config option 'rebase.instructionFormat' can override the\n> default 'oneline' format of the rebase instruction list.\n>\n> Since the list is parsed using the left, right or boundary mark plus\n> the sha1, they are prepended to the instruction format.\n>\n> Signed-off-by: Michael Rappazzo <rappazzo@gmail.com>\n> ---\n\nThanks.  Roberto's gizmo seems to be working OK ;-)\n\n>  git-rebase--interactive.sh | 9 ++++++++-\n>  1 file changed, 8 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> index dc3133f..cc79b81 100644\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n> @@ -977,7 +977,14 @@ else\n>  \trevisions=$onto...$orig_head\n>  \tshortrevisions=$shorthead\n>  fi\n> -git rev-list $merges_option --pretty=oneline --reverse --left-right --topo-order \\\n> +format=$(git config --get rebase.instructionFormat)\n> +if test -z \"$format\"\n> +then\n> +   format=\"%s\"\n\nStyle.  One indent level in our shell scripts is one HT, not a few spaces.\n\n> +fi\n> +# the 'rev-list .. | sed' requires %m to parse; the instruction requires %h to parse\n> +format=\"%m%h ${format}\"\n\nI think you want %H not %h here.  If you check how the default\n\"--pretty=online\" is shown, you would see something like this:\n\n    >1e9676ec0a771de06abca3009eb4bdc5a4ae3312 lockfile: replace ...\n    >2024d3176536fd437b4c0a744161e96bc150a24e help.c: wrap wait-...\n\n> +git rev-list $merges_option --pretty=\"${format}\" --reverse --left-right --topo-order \\\n>  \t$revisions ${restrict_revision+^$restrict_revision} | \\\n>  \tsed -n \"s/^>//p\" |\n\nThis is optional, but I still wonder why the command line cannot be\nmore like this, though:\n\n\tformat=$(git config --get rebase.insnFormat)\n\tgit log --format=\"%H ${format-%s}\" --reverse --right-only --topo-order \\\n\t  \t$revisions ${restrict_revision+^$restrict_revision} |\n        while read -r sha1 junk\n        do\n        \t...\n\nThat way we can optimize one \"sed\" process away.\n\nIf this is a good idea, it needs to be a separate follow-up patch\nthat changes \"%m filtered by sed\" to \"use --right-only\".  I do not\nthink such a change breaks anything, but I do not deal with complex\nhistories myself, so...\n"},{"id":"263237","messageId":"CANoM8SXM=gk9jpi7PJQh6dVeg=Nbg9bJD0eoU=Y-76vHBsHjcw@mail.gmail.com","threadId":"39553","inReplyTo":"xmqqsia2cj8c.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] git-rebase--interactive.sh: add config option for custom","fromName":"Mike Rappazzo","fromEmail":"rappazzo@gmail.com","sentAt":"2015-06-08T16:01:26Z","receivedAt":"2015-06-08T16:01:26Z","isPatch":true,"sender":{"key":"rappazzo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/525287?v=4"},"body":"On Mon, Jun 8, 2015 at 11:28 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Michael Rappazzo <rappazzo@gmail.com> writes:\n>\n>> A config option 'rebase.instructionFormat' can override the\n>> default 'oneline' format of the rebase instruction list.\n>>\n>> Since the list is parsed using the left, right or boundary mark plus\n>> the sha1, they are prepended to the instruction format.\n>>\n>> Signed-off-by: Michael Rappazzo <rappazzo@gmail.com>\n>> ---\n>\n> Thanks.  Roberto's gizmo seems to be working OK ;-)\n\nWill see if the pull request -> email contraption will allow me to put\n[patch v2] in there.  I also need to see if it can make a [patch 0/1]\n\n>\n>>  git-rebase--interactive.sh | 9 ++++++++-\n>>  1 file changed, 8 insertions(+), 1 deletion(-)\n>>\n>> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n>> index dc3133f..cc79b81 100644\n>> --- a/git-rebase--interactive.sh\n>> +++ b/git-rebase--interactive.sh\n>> @@ -977,7 +977,14 @@ else\n>>       revisions=$onto...$orig_head\n>>       shortrevisions=$shorthead\n>>  fi\n>> -git rev-list $merges_option --pretty=oneline --reverse --left-right --topo-order \\\n>> +format=$(git config --get rebase.instructionFormat)\n>> +if test -z \"$format\"\n>> +then\n>> +   format=\"%s\"\n>\n> Style.  One indent level in our shell scripts is one HT, not a few spaces.\n>\n>> +fi\n>> +# the 'rev-list .. | sed' requires %m to parse; the instruction requires %h to parse\n>> +format=\"%m%h ${format}\"\n>\n> I think you want %H not %h here.  If you check how the default\n> \"--pretty=online\" is shown, you would see something like this:\n>\n>     >1e9676ec0a771de06abca3009eb4bdc5a4ae3312 lockfile: replace ...\n>     >2024d3176536fd437b4c0a744161e96bc150a24e help.c: wrap wait-...\n>\n>> +git rev-list $merges_option --pretty=\"${format}\" --reverse --left-right --topo-order \\\n>>       $revisions ${restrict_revision+^$restrict_revision} | \\\n>>       sed -n \"s/^>//p\" |\n\nI will make the changes from above, and resubmit a patch.\n\n>\n> This is optional, but I still wonder why the command line cannot be\n> more like this, though:\n>\n>         format=$(git config --get rebase.insnFormat)\n>         git log --format=\"%H ${format-%s}\" --reverse --right-only --topo-order \\\n>                 $revisions ${restrict_revision+^$restrict_revision} |\n>         while read -r sha1 junk\n>         do\n>                 ...\n>\n> That way we can optimize one \"sed\" process away.\n>\n> If this is a good idea, it needs to be a separate follow-up patch\n> that changes \"%m filtered by sed\" to \"use --right-only\".  I do not\n> think such a change breaks anything, but I do not deal with complex\n> histories myself, so...\n>\n\nAs far as I can tell, the rev-list will return multiple lines when not\nusing 'oneline'.  The 'sed -n' will join the lines back together.  I\nwill take a look at moving it to 'git log' for a future change.  I\nhave a huge codebase with tons of branches to experiment with.\n"},{"id":"263267","messageId":"xmqqtwuiaz1l.fsf@gitster.dls.corp.google.com","threadId":"39553","inReplyTo":"CANoM8SXM=gk9jpi7PJQh6dVeg=Nbg9bJD0eoU=Y-76vHBsHjcw@mail.gmail.com","subject":"Re: [PATCH] git-rebase--interactive.sh: add config option for custom","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-08T17:29:58Z","receivedAt":"2015-06-08T17:29:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mike Rappazzo <rappazzo@gmail.com> writes:\n\n> On Mon, Jun 8, 2015 at 11:28 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n>> This is optional, but I still wonder why the command line cannot be\n>> more like this, though:\n>>\n>>         format=$(git config --get rebase.insnFormat)\n>>         git log --format=\"%H ${format-%s}\" --reverse --right-only --topo-order \\\n>>                 $revisions ${restrict_revision+^$restrict_revision} |\n>>         while read -r sha1 junk\n>>         do\n>>                 ...\n>>\n>> That way we can optimize one \"sed\" process away.\n>>\n>> If this is a good idea, it needs to be a separate follow-up patch\n>> that changes \"%m filtered by sed\" to \"use --right-only\".  I do not\n>> think such a change breaks anything, but I do not deal with complex\n>> histories myself, so...\n>\n> As far as I can tell, the rev-list will return multiple lines when not\n> using 'oneline'.  The 'sed -n' will join the lines back together.\n\nThere is no joining going on.\n\nTo \"rev-list\", a custom --pretty/--format is a signal to trigger its\n\"verbose\" mode, and it shows a \"commit <object-name>\" line and then\nthe line in the format specified, e.g.\n\n  $ git rev-list --pretty='%m%H %<(35,trunc)%s' --right-only --reverse ...2024d3\n  commit 1e9676ec0a771de06abca3009eb4bdc5a4ae3312\n  >1e9676ec0a771de06abca3009eb4bdc5a4ae3312 lockfile: replace random() by ran..\n  commit 2024d3176536fd437b4c0a744161e96bc150a24e\n  >2024d3176536fd437b4c0a744161e96bc150a24e help.c: wrap wait-only poll() inv..\n  ...\n\nBecause of that, \"format=%m | sed -n s/>//p\" would be one way to\nmake sure that all lines we care about are prefixed by '>' so that\nwe can pick them while discarding anything else.  So you do need\nfiltering unless switch to \"log\", even if you used --right-only.\n\nThat is why I didn't use \"rev-list\" in the message you are\nresponding to.\n"}]}