On Mon, Jun 8, 2015 at 11:28 AM, Junio C Hamano <[email protected]> wrote:
> Michael Rappazzo <[email protected]> writes:
>
>> A config option 'rebase.instructionFormat' can override the
>> default 'oneline' format of the rebase instruction list.
>>
>> Since the list is parsed using the left, right or boundary mark plus
>> the sha1, they are prepended to the instruction format.
>>
>> Signed-off-by: Michael Rappazzo <[email protected]>
>> ---
>
> Thanks. Roberto's gizmo seems to be working OK ;-)
Will see if the pull request -> email contraption will allow me to put
[patch v2] in there. I also need to see if it can make a [patch 0/1]
>
>> git-rebase--interactive.sh | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
>> index dc3133f..cc79b81 100644
>> --- a/git-rebase--interactive.sh
>> +++ b/git-rebase--interactive.sh
>> @@ -977,7 +977,14 @@ else
>> revisions=$onto...$orig_head
>> shortrevisions=$shorthead
>> fi
>> -git rev-list $merges_option --pretty=oneline --reverse --left-right
>> --topo-order \
>> +format=$(git config --get rebase.instructionFormat)
>> +if test -z "$format"
>> +then
>> + format="%s"
>
> Style. One indent level in our shell scripts is one HT, not a few spaces.
>
>> +fi
>> +# the 'rev-list .. | sed' requires %m to parse; the instruction requires %h
>> to parse
>> +format="%m%h ${format}"
>
> I think you want %H not %h here. If you check how the default
> "--pretty=online" is shown, you would see something like this:
>
> >1e9676ec0a771de06abca3009eb4bdc5a4ae3312 lockfile: replace ...
> >2024d3176536fd437b4c0a744161e96bc150a24e help.c: wrap wait-...
>
>> +git rev-list $merges_option --pretty="${format}" --reverse --left-right
>> --topo-order \
>> $revisions ${restrict_revision+^$restrict_revision} | \
>> sed -n "s/^>//p" |
I will make the changes from above, and resubmit a patch.
>
> This is optional, but I still wonder why the command line cannot be
> more like this, though:
>
> format=$(git config --get rebase.insnFormat)
> git log --format="%H ${format-%s}" --reverse --right-only
> --topo-order \
> $revisions ${restrict_revision+^$restrict_revision} |
> while read -r sha1 junk
> do
> ...
>
> That way we can optimize one "sed" process away.
>
> If this is a good idea, it needs to be a separate follow-up patch
> that changes "%m filtered by sed" to "use --right-only". I do not
> think such a change breaks anything, but I do not deal with complex
> histories myself, so...
>
As far as I can tell, the rev-list will return multiple lines when not
using 'oneline'. The 'sed -n' will join the lines back together. I
will take a look at moving it to 'git log' for a future change. I
have a huge codebase with tons of branches to experiment with.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html