Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Michael Rappazzo <rappazzo@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-rebase--interactive.sh: add config option for custom
Date: Mon, 08 Jun 2015 08:28:35 -0700	[thread overview]
Message-ID: <xmqqsia2cj8c.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <0000014dd0a821f6-a4ffca2d-d242-4e96-aeec-7a52186c5df1-000000@eu-west-1.amazonses.com> (Michael Rappazzo's message of "Mon, 8 Jun 2015 00:53:09 +0000")

Michael Rappazzo <rappazzo@gmail.com> 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 <rappazzo@gmail.com>
> ---

Thanks.  Roberto's gizmo seems to be working OK ;-)

>  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" |

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...

  reply	other threads:[~2015-06-08 15:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-08  0:53 [PATCH] git-rebase--interactive.sh: add config option for custom Michael Rappazzo
2015-06-08 15:28 ` Junio C Hamano [this message]
2015-06-08 16:01   ` Mike Rappazzo
2015-06-08 17:29     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqsia2cj8c.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rappazzo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox