This patch series is one of the half dozen patch series left to move the
bulk of rebase -i into a builtin.

The purpose of this patch series is to switch the functions in
sequencer.c from die()ing to returning errors instead, as proper library
functions should do, to give callers a chance to clean up after an

Changes since v1:

- two "return error()"s replacing "die_errno()"s were turned into "return
  error_errno()"s instead.

- an strbuf is now released when format_todo() failed (and may have left
  the strbuf with allocated memory).

- a superfluous space (which was inherited from the previous code) was
  fixed, while at it.

- fixed commit messages to report that callers of the libified functions
  are already libified.

- reordered patches to ensure that callers of libified functions are
  already libified.

Johannes Schindelin (14):
  sequencer: lib'ify sequencer_pick_revisions()
  sequencer: do not die() in do_pick_commit()
  sequencer: lib'ify write_message()
  sequencer: lib'ify do_recursive_merge()
  sequencer: lib'ify do_pick_commit()
  sequencer: lib'ify walk_revs_populate_todo()
  sequencer: lib'ify prepare_revs()
  sequencer: lib'ify read_and_refresh_cache()
  sequencer: lib'ify read_populate_todo()
  sequencer: lib'ify read_populate_opts()
  sequencer: lib'ify create_seq_dir()
  sequencer: lib'ify save_head()
  sequencer: lib'ify save_todo()
  sequencer: lib'ify save_opts()

 sequencer.c | 172 ++++++++++++++++++++++++++++++++++++------------------------
 1 file changed, 104 insertions(+), 68 deletions(-)

Fetch-It-Via: git fetch libify-sequencer-v2

Interdiff vs v1:

 diff --git a/sequencer.c b/sequencer.c
 index caba11d..b6481bb 100644
 --- a/sequencer.c
 +++ b/sequencer.c
 @@ -464,7 +464,7 @@ static int do_pick_commit(struct commit *commit, struct 
replay_opts *opts)
                 * to work on.
                if (write_cache_as_tree(head, 0, NULL))
 -                      return error (_("Your index file is unmerged."));
 +                      return error(_("Your index file is unmerged."));
        } else {
                unborn = get_sha1("HEAD", head);
                if (unborn)
 @@ -756,8 +756,8 @@ static int read_populate_todo(struct commit_list 
        fd = open(git_path_todo_file(), O_RDONLY);
        if (fd < 0)
 -              return error(_("Could not open %s (%s)"),
 -                      git_path_todo_file(), strerror(errno));
 +              return error_errno(_("Could not open %s"),
 +                                 git_path_todo_file());
        if (strbuf_read(&buf, fd, 0) < 0) {
 @@ -841,8 +841,8 @@ static int create_seq_dir(void)
                return -1;
        else if (mkdir(git_path_seq_dir(), 0777) < 0)
 -              return error(_("Could not create sequencer directory %s (%s)"),
 -                        git_path_seq_dir(), strerror(errno));
 +              return error_errno(_("Could not create sequencer directory %s"),
 +                                 git_path_seq_dir());
        return 0;
 @@ -941,8 +941,10 @@ static int save_todo(struct commit_list *todo_list, 
struct replay_opts *opts)
        if (fd < 0)
                return error_errno(_("Could not lock '%s'"),
 -      if (format_todo(&buf, todo_list, opts) < 0)
 +      if (format_todo(&buf, todo_list, opts) < 0) {
 +              strbuf_release(&buf);
                return error(_("Could not format %s."), git_path_todo_file());
 +      }
        if (write_in_full(fd, buf.buf, buf.len) < 0) {
                return error_errno(_("Could not write to %s"),


base-commit: 5cb0d5ad05e027cbddcb0a3c7518ddeea0f7c286
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to