From: Onno Kortmann <onno@gmx.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Show number of commits being rebased interactively
Date: Wed, 10 Dec 2014 19:16:44 +0100 [thread overview]
Message-ID: <54888E0C.4050402@gmx.net> (raw)
In-Reply-To: <xmqqbnncmys1.fsf@gitster.dls.corp.google.com>
Hi,
>> In the case of having 'exec' lines interspersed, the $commitcount
>> becomes a lot less useful (no comparison to editor line numbers),
>> though.
>
> Hmph, interesting. Then perhaps not filtering at all and instead
> labelling this new piece of information not "commit(s)" a better
> solution? You are counting the number of instructions in the insn
> sheet, so perhaps something like "($count todo items(s))" or
> something?
Yes that sounds good. Though I lack the experience to say what would
be the typical workflow for someone who uses rebase-i a lot with execs
interspersed(?)
In all cases, simply counting and noting '#todo item(s)' would always be
a correct labelling and simple to understand, albeit not necessarily a
very helpful value. But at least for pure picks/edit/squash lists,
it will allow a quick sanity check.
Also, I noted that filtering for ^pick will not be good
in case one uses '--autosquash'.
>> 8< 8< 8< 8< 8< 8< 8< 8< 8<
>
> That is not a scissors line, I suspect.
>
> I didn't try running "git am" on this message, though. Did you?
Yes, I RTFMed on git-mailinfo and to be sure I tested this before sending
the last mail out :)
Below is the patch, changed to say 'TODO items', and with updated commit
message.
Cheers,
Onno
8< 8< 8< 8< 8< 8< 8< 8< 8<
Subject: [PATCH] Show number of TODO items for interactive rebase
During 'rebase -i', one wrong edit in a long rebase session
might inadvertently drop commits/items. This change shows
the total number of TODO items in the comments after the
list. After performing the rebase edit, total item counts
can be compared to make sure that no changes have been lost
in the edit.
Signed-off-by: Onno Kortmann <onno@gmx.net>
---
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 b64dd28..c6a4629 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -1031,9 +1031,11 @@ test -s "$todo" || echo noop >> "$todo"
test -n "$autosquash" && rearrange_squash "$todo"
test -n "$cmd" && add_exec_commands "$todo"
+todocount=$(git stripspace --strip-comments <"$todo" | wc -l)
+
cat >>"$todo" <<EOF
-$comment_char Rebase $shortrevisions onto $shortonto
+$comment_char Rebase $shortrevisions onto $shortonto ($todocount TODO item(s))
EOF
append_todo_help
git stripspace --comment-lines >>"$todo" <<\EOF
--
2.2.0.34.gb8f29bf
next prev parent reply other threads:[~2014-12-10 18:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <md5:H/n6RCGs7zvP8Sp7z7ElnQ==>
2014-11-10 16:32 ` [PATCH] Show number of commits being rebased interactively Onno Kortmann
2014-12-05 21:37 ` Junio C Hamano
2014-12-07 20:56 ` Onno Kortmann
2014-12-09 19:03 ` Junio C Hamano
2014-12-10 18:16 ` Onno Kortmann [this message]
2014-11-09 13:24 Onno Kortmann
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=54888E0C.4050402@gmx.net \
--to=onno@gmx.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.