# bad behaviour while using git rebase -i -p

2 messages from 2018-02-09 to 2018-02-09. Participants: Jan Viktorin, Junio C Hamano.
Thread: https://gitlist.dev/t/47794

## Jan Viktorin, 2018-02-09 00:39

Subject: bad behaviour while using git rebase -i -p
Message-ID: <20180209013902.6702a0dd@jvn>
URL: https://gitlist.dev/e/20180209013902.6702a0dd%40jvn

```
Hello,

since Git 2.16.1, I've noticed a bad behaviour of git rebase -i -p. It
screws up merge commits created with --log (or config merge.log = true)
in my history. A good merge commit with message like:

    Merge branch 'test'
    
    * test:
      c
      b

is changed after rebase (without touching that commit in any way) into:

    Merge branch 'test' a git-rebase-p-test.sh test: c b

It seems, like the commit message is interpreted somehow - the '*'
character is expanded to the list of files in the current directory and
the original spacing is removed. This happens during my regular work.

Here is a code that seems to be reproducing this behaviour well:

git init

touch a
git add a
git commit -m a

git checkout -b test
# a new branch made to merge back to master later

touch b
git add b
git commit -m b

touch c
git add c
git commit -m c

git checkout master
git merge --no-edit --log test
git log -1
# everything looks good at this point

export GIT_SEQUENCE_EDITOR='sed "1s/pick/reword/" -i'
# we are rewording only the first commit...
export EDITOR='sed "s/b/x/" -i'
# ...and changing its message from "b" to "x"

git rebase -i HEAD^1 -p
git log -1
# here, you can see the bad merge commit message

Regards
Jan

```

## Junio C Hamano, 2018-02-09 02:32

Subject: Re: bad behaviour while using git rebase -i -p
Message-ID: <xmqqtvuq6gg3.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqtvuq6gg3.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <20180209013902.6702a0dd@jvn>

```
Jan Viktorin <viktorin@rehivetech.com> writes:

> since Git 2.16.1, I've noticed a bad behaviour of git rebase -i -p. It
> screws up merge commits created with --log (or config merge.log = true)
> in my history.  A good merge commit with message like:
>
>     Merge branch 'test'
>     
>     * test:
>       c
>       b
>
> is changed after rebase (without touching that commit in any way) into:
>
>     Merge branch 'test' a git-rebase-p-test.sh test: c b

I think we saw this problem independently discovered and a fix for
it posted today to the list.

    https://public-inbox.org/git/20180208204241.19324-1-gregory.herrero@oracle.com/

Thanks.


```
