From: Phil Hord <hordp@cisco.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Cc: "phil.hord@gmail.com" <phil.hord@gmail.com>
Subject: git-rebase-todo gets popped prematurely
Date: Wed, 02 Apr 2014 18:37:48 -0400 [thread overview]
Message-ID: <533C913C.20106@cisco.com> (raw)
During a 'git rebase --continue', I got an error about having left a
file in place which the next commit intended to add as new. Stupid me.
So I rm'ed the file and tried again. This time, git rebase --continue
succeeded. But it accidentally left out the next commit in my rebase-todo.
I looked in the code and it seems that when the "pick" returns an error,
rebase--interactive stops and lets the user clean up. But it assumes
the index already tracks a conflicted merge, and so it removes the
commit from the todo list. In this case, however, the conflicted merge
was avoided by detecting it in advance. The result is that the "would
be overwritten" conflict evicts the entire commit from the rebase action.
I think the code needs to detect the difference between "merge failed;
conflicted index" and "merge failed; no change". I think I can do this
with 'git-status -s -uno', maybe. But I haven't tried it yet and it
feels like I'm missing a case or two also.
I tried to bisect this to some specific change, but it fails the same
way as far back as 1.6.5.
Test script follows in case anyone has a better idea how to approach
this and wants to understand it better.
#!/bin/sh
set -x
git --version
rm -rf baz
git init baz && cd baz
echo initial>initial && git add initial && git commit -minitial
echo foo>foo && git add foo && git commit -mfoo
echo bar>bar && git add bar && git commit -mbar
git log --oneline
GIT_EDITOR='sed -i -e s/^pick/edit/ -e /^#/d' git rebase -i HEAD^^
touch bar
git rebase --continue
rm bar
git rebase --continue
git log --oneline
And the tail of the output (note the missing "bar" commit even though
"Successfully rebased"):
+ git log --oneline
fcc9b6e bar
8121f15 foo
a521fa1 initial
+ GIT_EDITOR='sed -i -e s/^pick/edit/ -e /^#/d'
+ git rebase -i 'HEAD^^'
Stopped at 8121f1593ea5c66dc7e9af7719100c1fcf4ab721... foo
You can amend the commit now, with
git commit --amend
Once you are satisfied with your changes, run
git rebase --continue
+ touch bar
+ git rebase --continue
error: The following untracked working tree files would be
overwritten by merge:
bar
Please move or remove them before you can merge.
Aborting
Could not apply fcc9b6ef2941e870f88362edbe0f1078cebb20e5... bar
+ rm bar
+ git rebase --continue
Successfully rebased and updated refs/heads/master.
+ git log --oneline
8121f15 foo
a521fa1 initial
next reply other threads:[~2014-04-03 10:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-02 22:37 Phil Hord [this message]
2014-05-26 22:19 ` [RFC 1/3] sequencer: Signal failed ff as an aborted, not a conflicted merge Fabian Ruch
2014-05-27 18:42 ` Junio C Hamano
2014-06-09 15:04 ` Fabian Ruch
2014-06-10 17:56 ` Junio C Hamano
2014-06-10 18:51 ` Phil Hord
2014-06-10 19:17 ` Junio C Hamano
2014-05-26 22:19 ` [RFC 2/3] rebase -i: Reschedule tasks that failed before the index was touched Fabian Ruch
2014-05-27 11:56 ` Michael Haggerty
2014-05-27 18:26 ` Phil Hord
2014-05-26 22:19 ` [RFC 3/3] tests: Add 'rebase -i commits that overwrite untracked files' Fabian Ruch
2014-05-27 13:15 ` Michael Haggerty
2014-05-27 18:47 ` 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=533C913C.20106@cisco.com \
--to=hordp@cisco.com \
--cc=git@vger.kernel.org \
--cc=phil.hord@gmail.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.