revert: Save data for continuing after conflict resolution
commit04d3d3cfc4a26f003c5ae2b5598cc975a31e4395
authorRamkumar Ramachandra <artagnon@gmail.com>
Thu, 4 Aug 2011 10:39:08 +0000 (4 16:09 +0530)
committerJunio C Hamano <gitster@pobox.com>
Thu, 4 Aug 2011 22:40:44 +0000 (4 15:40 -0700)
tree78eb7c49d239fcc064e4612cbe08aef49d24158d
parent9044143ff150a4ccc834523ae2f9ee11c2c961c3
revert: Save data for continuing after conflict resolution

Ever since v1.7.2-rc1~4^2~7 (revert: allow cherry-picking more than
one commit, 2010-06-02), a single invocation of "git cherry-pick" or
"git revert" can perform picks of several individual commits.  To
implement features like "--continue" to continue the whole operation,
we will need to store some information about the state and the plan at
the beginning.  Introduce a ".git/sequencer/head" file to store this
state, and ".git/sequencer/todo" file to store the plan.  The head
file contains the SHA-1 of the HEAD before the start of the operation,
and the todo file contains an instruction sheet whose format is
inspired by the format of the "rebase -i" instruction sheet.  As a
result, a typical todo file looks like:

  pick 8537f0e submodule add: test failure when url is not configured
  pick 4d68932 submodule add: allow relative repository path
  pick f22a17e submodule add: clean up duplicated code
  pick 59a5775 make copy_ref globally available

Since SHA-1 hex is abbreviated using an find_unique_abbrev(), it is
unambiguous.  This does not guarantee that there will be no ambiguity
when more objects are added to the repository.

These two files alone are not enough to implement a "--continue" that
remembers the command-line options specified; later patches in the
series save them too.

These new files are unrelated to the existing .git/CHERRY_PICK_HEAD,
which will still be useful while committing after a conflict
resolution.

Inspired-by: Christian Couder <chriscool@tuxfamily.org>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/revert.c
t/t3510-cherry-pick-sequence.sh [new file with mode: 0755]