Skip to content

Build in merge

Miklos Vajna git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest15 patches 16 repliesIn review

Changes from the cover letter · 16 lines

* "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.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/15Move split_cmdline() to alias.calias.c cache.h git.c+55 -535 replies
2/15Move commit_list_count() to commit.cbuiltin-merge-recursive.c commit.c commit.h+9 -80 replies
3/15Move parse-options's skip_prefix() to git-compat-util.hbuiltin-remote.c git-compat-util.h parse-options.c+32 -190 replies
4/15Add new test to ensure git-merge handles pull.twohead and pull.octopust/t7601-merge-pull-config.sh+129 -07 replies
5/15Move read_cache_unmerged() to read-cache.cbuiltin-read-tree.c cache.h read-cache.c+33 -240 replies
6/15git-fmt-merge-msg: make it usable from other builtinsbuiltin-fmt-merge-msg.c builtin.h+92 -660 replies
7/15Introduce get_octopus_merge_bases() in commit.ccommit.c commit.h+28 -00 replies
8/15Add new test to ensure git-merge handles more than 25 refs.t/t7602-merge-octopus-many.sh+52 -00 replies
8/15Add new test to ensure git-merge handles more than 25 refs.t/t7602-merge-octopus-many.sh+52 -00 replies
9/15Introduce get_merge_bases_many()commit.c+38 -180 replies
10/15Introduce reduce_heads()commit.c commit.h+47 -00 replies
11/15Add strbuf_vaddf(), use it in strbuf_addf(), and add strbuf_initf().gitignore Makefile strbuf.c +3 more+150 -1751 replies
12/15strbuf_vaddf(): support %*s, toostrbuf.c+6 -00 replies
13/15Add new test case to ensure git-merge reduces octopus parents when possiblet/t7603-merge-reduce-heads.sh+63 -00 replies
14/15Add new test case to ensure git-merge prepends the custom merge messaget/t7604-merge-custom-message.sh+37 -00 replies
15/15Build in mergeMakefile builtin-merge.c builtin.h +2 more+1146 -10 replies
15/15Build in mergeMakefile builtin-merge.c builtin.h +3 more+1147 -20 replies

Reviews trailers per patch

None of the 17 patches has a Reviewed-by or Acked-by.

PatchJohannes Schindelin
1/15
2/15
3/15
4/15
5/15
6/15
7/15
8/15
8/15
9/15
10/15
11/15Mentored-by Mentored-by Mentored-by Mentored-by Mentored-by Mentored-by Mentored-by Mentored-by
12/15
13/15
14/15
15/15Mentored-by Mentored-by
15/15Mentored-by Mentored-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/15] Build in merge

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