git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Rappazzo <rappazzo@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Junio C Hamano <gitster@pobox.com>, Git List <git@vger.kernel.org>
Subject: Re: Suggestion: add author info to TODO list in git-rebase--interactive
Date: Fri, 5 Jun 2015 21:00:51 -0400	[thread overview]
Message-ID: <CANoM8SXnTU5bnyLKUUYEtnug89cC9cN3AU3E07qUmk85teamLw@mail.gmail.com> (raw)
In-Reply-To: <CAPig+cS0dW=KpD3C_6ugiJTccQqNu1NopcU6Pc71hf6iLLbcfw@mail.gmail.com>

I think the custom format makes sense.  I took a first pass.

A config option 'rebase.interactive.todo-format' can override the
default 'oneline' format of the TODO list.  Since the list is
parsed using the left, right or boundary mark plus the sha1, then if the
custom format does not start with those values, they will be
automatically added to the beginning of the custom format.

For example, if author information is desired for the TODO list, then
setting the config value to '[%an] %s' will actually result in the
format being '%m%h [%an] %s'

---
 git-rebase--interactive.sh | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index dc3133f..e2d5ffc 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -977,7 +977,18 @@ else
  revisions=$onto...$orig_head
  shortrevisions=$shorthead
 fi
-git rev-list $merges_option --pretty=oneline --reverse --left-right
--topo-order \
+custom_format=$(git config --get rebase.interactive.todo-format)
+if test -z "$custom_format"
+then
+   custom_format="oneline"
+else
+   # the custom format MUST start with %m%h or %m%H
+ if test "${custom_format:0:5}" != '%m%h '
+   then
+      custom_format="%m%h ${custom_format}"
+   fi
+fi
+git rev-list $merges_option --pretty="${custom_format}" --reverse
--left-right --topo-order \
  $revisions ${restrict_revision+^$restrict_revision} | \
  sed -n "s/^>//p" |
 while read -r sha1 rest
-- 

Is this closer to what you are looking for?  I also tried changing the
'--left-right' to '--left-only', but that seemed to not produce any
results.




On Fri, Jun 5, 2015 at 3:39 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> On Fri, Jun 5, 2015 at 3:35 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Mike Rappazzo <rappazzo@gmail.com> writes:
>>> I find that If I am doing a rebase with the intention to squash or
>>> re-order commits, it is helpful to know the commit author.
>>
>> There is not a fundamental reason why the remainder of the line
>> after the object name in the rebase insn sheet should not be
>> customizable, and I think your patch is a good first step to
>> identify where that customization should go.
>>
>> But that is a customization issue, not changing the default and the
>> only format used.
>
> The idea of being able to provide a custom format for insn sheet lines
> came up within the last year and was somewhat more well-developed and
> a bit more heavily discussed. I don't recall whether there was an
> accompanying patch, and I am unfortunately unable to locate the
> discussion in the archive.

  reply	other threads:[~2015-06-06  1:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05 19:00 Suggestion: add author info to TODO list in git-rebase--interactive Mike Rappazzo
2015-06-05 19:35 ` Junio C Hamano
2015-06-05 19:39   ` Eric Sunshine
2015-06-06  1:00     ` Mike Rappazzo [this message]
2015-06-07  6:14       ` 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=CANoM8SXnTU5bnyLKUUYEtnug89cC9cN3AU3E07qUmk85teamLw@mail.gmail.com \
    --to=rappazzo@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.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;
as well as URLs for NNTP newsgroup(s).