Re: [PATCH v2] rebase -i: respect core.commentchar
- From
John Keeping <john@keeping.me.uk>
- Date
- Feb 12, 2013, 09:53 UTC
- Message-ID
- <20130212095340.GG2270@serenity.lan>
- In-Reply-To
- <7vehgmjsno.fsf@alter.siamese.dyndns.org>
On Mon, Feb 11, 2013 at 04:13:31PM -0800, Junio C Hamano wrote:
Show 13 quoted lines
> John Keeping <john@keeping.me.uk> writes:
>
> > @@ -179,7 +182,9 @@ die_abort () {
> > }
> >
> > has_action () {
> > - sane_grep '^[^#]' "$1" >/dev/null
> > + echo "space stripped actions:" >&2
> > + git stripspace --strip-comments <"$1" >&2
> > + test -n "$(git stripspace --strip-comments <"$1")"
> > }
>
> I'll remove the debugging remnants while queuing.Thanks. I don't think I was fully awake when I finished this last night - the following fixup is also needed to avoid relying on the shell emitting a literal backslash when a backslash isn't followed by a known escape character.
-- >8 --
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index cbe36bf..84bd525 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -947,7 +947,7 @@ test_expect_success 'rebase -i respects core.commentchar' ' test_when_finished "git config --unset core.commentchar" && cat >comment-lines.sh <<EOF && #!$SHELL_PATH -sed -e "2,\$ s/^/\\\\\\/" "\$1" >"\$1".tmp +sed -e "2,\$ s/^/\\\\\\\\/" "\$1" >"\$1".tmp mv "\$1".tmp "\$1" EOF chmod a+x comment-lines.sh && -- >8 -- > > @@ -942,20 +948,18 @@ test -s "$todo" || echo noop >> "$todo" > > test -n "$autosquash" && rearrange_squash "$todo" > > test -n "$cmd" && add_exec_commands "$todo" > > > > -cat >> "$todo" << EOF > > - > > -# Rebase $shortrevisions onto $shortonto > > -EOF > > +echo >>"$todo" > > +printf '%s\n' "$comment_char Rebase $shortrevisions onto $shortonto" >>"$todo" > > I think you can still do > > cat >>"$todo" <<EOF > > $comment_char Rebase $shortrevisions onto... > EOF > > here with any funny comment character. Doing this with two separate > I/O does not hurt very much, but the resulting code may be easier to > scan if left as here-text with a single cat. > > Please eyeball what is in 'pu' (I have a separate squashable fixup > on top of your patch) and let me know if I made mistakes. The fixup commit looks good to me. John