Skip to content

am-3-merge-recursive-direct-v6

This is the sixth iteration of the long-awaited re-roll of the attempt to
avoid spawning merge-recursive from the builtin am and use merge_recursive()
directly instead.

The *real* reason for the reroll is that I need a libified recursive
merge to accelerate the interactive rebase by teaching the sequencer to
do rebase -i's grunt work. Coming with a very nice 3x-5x speedup of
`rebase -i`.

In this endeavor, we need to be extra careful to retain backwards
compatibility. The test script t6022-merge-rename.sh, for example, verifies
that `git pull` exits with status 128 in case of a fatal error. To that end,
we need to make sure that fatal errors are handled by existing (builtin)
users via exit(128) (or die(), which calls exit(128) at the end).  New users
(such as a builtin helper doing rebase -i's grunt work) may want to print
some helpful advice what happened and how to get out of this mess before
erroring out.

The changes relative to the fifth iteration of this patch series:

- the commit message that talked about swallowing messages was improved

- the va_start()/va_end() statements were moved closer to the vararg usage

- the `buffer_output` field is no longer a bit field because it is now
  logically more like the verbosity level, which we traditionally keep
  as a full `int`

- the flush_output() call is no longer moved, but instead added to the
  code path when we return early

- the commit message saying that we speculated about stdout's buffer
  size now instead states that we made an assumption

This patch series touches rather important code. I appreciate thorough
reviews with a focus on the critical parts of the code, those that could
result in regressions.

Johannes Schindelin (16):
  t5520: verify that `pull --rebase` shows the helpful advice when
    failing
  Report bugs consistently
  Avoid translating bug messages
  merge-recursive: clarify code in was_tracked()
  Prepare the builtins for a libified merge_recursive()
  merge_recursive: abort properly upon errors
  merge-recursive: avoid returning a wholesale struct
  merge-recursive: allow write_tree_from_memory() to error out
  merge-recursive: handle return values indicating errors
  merge-recursive: switch to returning errors instead of dying
  am -3: use merge_recursive() directly again
  merge-recursive: flush output buffer before printing error messages
  merge-recursive: write the commit title in one go
  merge-recursive: offer an option to retain the output in 'obuf'
  Ensure that the output buffer is released after calling merge_trees()
  merge-recursive: flush output buffer even when erroring out

 builtin/am.c           |  62 ++----
 builtin/checkout.c     |   5 +-
 builtin/ls-files.c     |   3 +-
 builtin/merge.c        |   2 +
 builtin/update-index.c |   2 +-
 grep.c                 |   8 +-
 imap-send.c            |   2 +-
 merge-recursive.c      | 578 +++++++++++++++++++++++++++++--------------------
 merge-recursive.h      |   2 +-
 sequencer.c            |   5 +
 sha1_file.c            |   4 +-
 t/t5520-pull.sh        |  32 +++
 trailer.c              |   2 +-
 transport.c            |   2 +-
 wt-status.c            |   4 +-
 15 files changed, 419 insertions(+), 294 deletions(-)

Submitted-As: http://mid.gmane.org/cover.1470051326.git.johannes.schindelin@gmx.de
In-Reply-To: http://mid.gmane.org/cover.1469187652.git.johannes.schindelin@gmx.de
In-Reply-To: http://mid.gmane.org/cover.1467717729.git.johannes.schindelin@gmx.de
In-Reply-To: http://mid.gmane.org/cover.1467199553.git.johannes.schindelin@gmx.de
In-Reply-To: http://mid.gmane.org/cover.1467902082.git.johannes.schindelin@gmx.de
In-Reply-To: http://mid.gmane.org/cover.1469547160.git.johannes.schindelin@gmx.de
Assets 2