git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] git-rebase--interactive.sh: add config option for custom instruction format

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 8, 2015, 21:29 UTC
Message-ID
<xmqqioax99ee.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1433797202-97425-2-git-send-email-rappazzo@gmail.com>
Michael Rappazzo <rappazzo@gmail.com> writes:
Show 26 quoted lines
> 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>
> ---
>  git-rebase--interactive.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index dc3133f..b92375e 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -977,7 +977,9 @@ 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)
> +# the 'rev-list .. | sed' requires %m to parse; the instruction requires %H to parse
> +git rev-list $merges_option --format="%m%H ${format-%s}" --reverse --left-right --topo-order \
>  	$revisions ${restrict_revision+^$restrict_revision} | \
>  	sed -n "s/^>//p" |
>  while read -r sha1 rest
Looks OK, but
 - Needs a patch to Documentation/config.txt and possibly also
   Documentation/git-rebase.txt
 - Needs tests somewhere in t34?? series.

Also I think "git rev-list" line has got way too long. As it is already using backslash-continuation, do not hesitate to fold it further, e.g.

        git rev-list $merges_option --format="%m%H ${format-%s}" \
                --reverse --left-right --topo-order \
                $revisions ${restrict_revision+^$restrict_revision} | \
                sed -n "s/^>//p" |
	while ...
Thanks.
Previous: Michael RappazzoNext: Johannes Schindelin
Message 3 of 9 in “git-rebase--interactive.sh: add config option for custom instruction format”
  1. git-rebase--interactive.sh: add config option for custom instruction formatMichael Rappazzo, Jun 8, 2015
  2. git-rebase--interactive.sh: add config option for custom instruction formatMichael Rappazzo, Jun 8, 2015
  3. Junio C HamanoJun 8, 2015
  4. Johannes SchindelinJun 9, 2015
  5. Mike RappazzoJun 9, 2015
  6. Junio C HamanoJun 9, 2015
  7. Mike RappazzoJun 9, 2015
  8. Junio C HamanoJun 10, 2015
  9. Junio C HamanoJun 8, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.