git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 00/15] Build in merge

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Jun 27, 2008, 16:21 UTC
Message-ID
<cover.1214581610.git.vmiklos@frugalware.org>
Hello,

Dscho gave me a detailed review on builtin-merge, so I'm sending an updated series.

It's based on 49646c5 in git.git, so hopefully it includes all the work Junio did recently in 'pu'. (PARSE_OPT_ARGV0_IS_AN_OPTION removal, etc.)

Changes:
* "git-fmt-merge-msg: make it usable from other builtins"
  - Small cleanup.
* "Build in merge"
  - When a custom message was given for a merge, the result was not
    identical to the one git-merge.sh had. I added a testcase for this
    and fixed up builtin-merge to pass the test.
  - Memleak fix in restore_state()
  - Cleanup in finish_up_to_date() and squash_message()
  - run_hook() now first checks if the executable bit is set and returns
    immediately if not.
  - Make merge_name() a bit more readable, like *(ptr+1) -> ptr[1]. Also
    fixed a missing initialization in this function.
  - split_merge_strategies(): while (1) -> for (;;)
  - Simplified path_list_append_strategy() by removing unnecessary
    parameters.
  - cmd_merge(): Added more comments to make the code more readable,
    fixed a memory leak, optimized the case when --no-commit is used.
  - merge_one_remote(): Fixed a bug which for example caused a segfault
    when building with -fno-inline.
  - Fixed up color handling when showing the diff after a merge, as
    noticed by Olivier Marin.
  - Fixed up the "Updating foo..bar" message which was like "Updating
    bar..bar", as pointed out by Olivier Marin.
* Dscho's two patches: These introduces strbuf_initf() which can be used
  instead of strbuf_init() and strbuf_addf(). Modified builtin-merge.c
  to use strbuf_initf() where possible.
* Extended t7601-merge-pull-config.sh to make sure git-merge picks up
  the best strategy when no strategy can handle the merge without
  conflicts.

The "interdiff" is available via git diff 49646c5..d1c62b2 in git://repo.or.cz/git/vmiklos.git.

I'm sending the whole series to avoid complexity, but in fact I only changed the following patches:

* "git-fmt-merge-msg: make it usable from other builtins"
* "Add new test case to ensure git-merge prepends the custom merge
  message"
* "Build in merge"
Johannes Schindelin (2):
  Add strbuf_vaddf(), use it in strbuf_addf(), and add strbuf_initf()
  strbuf_vaddf(): support %*s, too
Junio C Hamano (2):
  Introduce get_merge_bases_many()
  Introduce reduce_heads()
Miklos Vajna (11):
  Move split_cmdline() to alias.c
  Move commit_list_count() to commit.c
  Move parse-options's skip_prefix() to git-compat-util.h
  Add new test to ensure git-merge handles pull.twohead and
    pull.octopus
  Move read_cache_unmerged() to read-cache.c
  git-fmt-merge-msg: make it usable from other builtins
  Introduce get_octopus_merge_bases() in commit.c
  Add new test to ensure git-merge handles more than 25 refs.
  Add new test case to ensure git-merge reduces octopus parents when
    possible
  Add new test case to ensure git-merge prepends the custom merge
    message
  Build in merge
 .gitignore                                    |    1 +
 Makefile                                      |    6 +-
 alias.c                                       |   54 ++
 builtin-fmt-merge-msg.c                       |  155 ++--
 builtin-merge-recursive.c                     |    8 -
 builtin-merge.c                               | 1143 +++++++++++++++++++++++++
 builtin-read-tree.c                           |   24 -
 builtin-remote.c                              |   39 +-
 builtin.h                                     |    4 +
 cache.h                                       |    3 +
 commit.c                                      |  136 +++-
 commit.h                                      |    4 +
 git-merge.sh => contrib/examples/git-merge.sh |    0 
 git-compat-util.h                             |    6 +
 git.c                                         |   54 +--
 parse-options.c                               |    6 -
 read-cache.c                                  |   31 +
 strbuf.c                                      |  140 +++-
 strbuf.h                                      |    3 +
 t/t0000-basic.sh                              |    8 +
 t/t7601-merge-pull-config.sh                  |  129 +++
 t/t7602-merge-octopus-many.sh                 |   52 ++
 t/t7603-merge-reduce-heads.sh                 |   63 ++
 t/t7604-merge-custom-message.sh               |   37 +
 test-strbuf.c                                 |   17 +
 25 files changed, 1917 insertions(+), 206 deletions(-)
 create mode 100644 builtin-merge.c
 rename git-merge.sh => contrib/examples/git-merge.sh (100%)
 create mode 100755 t/t7601-merge-pull-config.sh
 create mode 100755 t/t7602-merge-octopus-many.sh
 create mode 100755 t/t7603-merge-reduce-heads.sh
 create mode 100755 t/t7604-merge-custom-message.sh
 create mode 100644 test-strbuf.c
Next: Miklos Vajna
Message 1 of 50 in “Build in merge”
  1. 00/15 Build in mergeMiklos Vajna, Jun 27, 2008
  2. 01/15 Move split_cmdline() to alias.cMiklos Vajna, Jun 27, 2008
  3. 02/15 Move commit_list_count() to commit.cMiklos Vajna, Jun 27, 2008
  4. 03/15 Move parse-options's skip_prefix() to git-compat-util.hMiklos Vajna, Jun 27, 2008
  5. 04/15 Add new test to ensure git-merge handles pull.twohead and pull.octopusMiklos Vajna, Jun 27, 2008
  6. 05/15 Move read_cache_unmerged() to read-cache.cMiklos Vajna, Jun 27, 2008
  7. 06/15 git-fmt-merge-msg: make it usable from other builtinsMiklos Vajna, Jun 27, 2008
  8. 07/15 Introduce get_octopus_merge_bases() in commit.cMiklos Vajna, Jun 27, 2008
  9. 08/15 Add new test to ensure git-merge handles more than 25 refs.Miklos Vajna, Jun 27, 2008
  10. 09/15 Introduce get_merge_bases_many()Miklos Vajna, Jun 27, 2008
  11. 10/15 Introduce reduce_heads()Miklos Vajna, Jun 27, 2008
  12. 11/15 Add strbuf_vaddf(), use it in strbuf_addf(), and add strbuf_initf()Miklos Vajna, Jun 27, 2008
  13. 12/15 strbuf_vaddf(): support %*s, tooMiklos Vajna, Jun 27, 2008
  14. 13/15 Add new test case to ensure git-merge reduces octopus parents when possibleMiklos Vajna, Jun 27, 2008
  15. 14/15 Add new test case to ensure git-merge prepends the custom merge messageMiklos Vajna, Jun 27, 2008
  16. 15/15 Build in mergeMiklos Vajna, Jun 27, 2008
  17. 15/15 Build in mergeMiklos Vajna, Jun 27, 2008
  18. Junio C HamanoJun 28, 2008
  19. Miklos VajnaJun 28, 2008
  20. 13/13 Build in mergeMiklos Vajna, Jun 28, 2008
  21. Junio C HamanoJun 29, 2008
  22. Jakub NarebskiJun 29, 2008
  23. Miklos VajnaJun 30, 2008
  24. 13/13 Build in mergeMiklos Vajna, Jun 30, 2008
  25. Junio C HamanoJun 30, 2008
  26. Alex RiesenJun 30, 2008
  27. Miklos VajnaJul 1, 2008
  28. Olivier MarinJun 30, 2008
  29. Miklos VajnaJun 30, 2008
  30. Junio C HamanoJun 30, 2008
  31. Miklos VajnaJun 30, 2008
  32. Johannes SchindelinJun 28, 2008
  33. Junio C HamanoJun 29, 2008
  34. Johannes SchindelinJun 29, 2008
  35. Alex RiesenJun 29, 2008
  36. Junio C HamanoJun 29, 2008
  37. Sverre RabbelierJun 29, 2008
  38. 08/15 Add new test to ensure git-merge handles more than 25 refs.Miklos Vajna, Jun 27, 2008
  39. Olivier MarinJun 29, 2008
  40. Add new test to ensure git-merge handles pull.twohead and pull.octopusMiklos Vajna, Jun 29, 2008
  41. Miklos VajnaJun 29, 2008
  42. Mike RalphsonJul 4, 2008
  43. Miklos VajnaJul 5, 2008
  44. Fix t7601-merge-pull-config.sh on AIXMiklos Vajna, Jul 5, 2008
  45. Junio C HamanoJul 5, 2008
  46. Olivier MarinJun 29, 2008
  47. Johannes SchindelinJun 29, 2008
  48. Olivier MarinJun 29, 2008
  49. Johannes SchindelinJun 29, 2008
  50. Olivier MarinJun 30, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.