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

[PATCH v7 00/15] Rewrite the remaining merge strategies from shell to C

From
Alban Gruin <alban.gruin@gmail.com>
Date
Mar 17, 2021, 20:49 UTC
Message-ID
<20210317204939.17890-1-alban.gruin@gmail.com>
In-Reply-To
<20201124115315.13311-1-alban.gruin@gmail.com>

In an effort to reduce the number of shell scripts in git's codebase, I propose this patch series converting the two remaining merge strategies, resolve and octopus, from shell to C. This will enable slightly better performance, better integration with git itself (no more forking to perform these operations), better portability (Windows and shell scripts don't mix well).

Three scripts are actually converted: first git-merge-one-file.sh, then git-merge-resolve.sh, and finally git-merge-octopus.sh. Not only they are converted, but they also are modified to operate without forking, and then libified so they can be used by git without spawning another process.

The first patch is not important to make the whole series work, but I made this patch while working on it.

This series keeps the commands `git merge-one-file', `git merge-resolve', and `git merge-octopus', so any script depending on them should keep working without changes.

This series is based on a5828ae6b5 (Git 2.31, 2021-03-15). The tip is tagged as "rewrite-merge-strategies-v7" at https://github.com/agrn/git.

Changes since v6:
 - The series has been rebased on Git 2.31.
 - The series has been reordered.  Now, all the work around merge-index
   happens first to handle the case when git has been compiled with
   SKIP_DASHED_BUILT_INS enabled.
 - Remove usage of the index in the new builtins and in merge-index.
 - Adapt t6407 to use the "main" branch instead of "master".
 - Move merge_one_file_spawn() from merge-strategies.c to
   builtin/merge-index.c.
 - The functions extracted from merge-index and merge_three_way() now
   take a `struct index_state *' instead of a `struct repository *'.
 - Introduce ADD_TO_INDEX_CACHEINFO_{INVALID_PATH,UNABLE_TO_ADD}.
 - Remove checkout_from_index(), and replace it by
   add_merge_result_to_index(), a new function that calls
   add_to_index_cacheinfo() and checkout_entry() at the same time.
 - Fix a case where a file deleted in both branches would result in a
   failure in merge_three_way().  A test case has been added in t6060 to
   check that the new version is correct.
 - Rename some variables in merge_strategies_octopus(), and change its
   flow to make it more understandable.
 - Use CALLOC_ARRAY() in merge_strategies_octopus() instead of
   xcalloc().
 - Change merge-resolve and merge-octopus to handle the case where they
   are given an empty tree instead of a commit.
Alban Gruin (15):
  t6407: modernise tests
  t6060: modify multiple files to expose a possible issue with
    merge-index
  t6060: add tests for removed files
  merge-index: libify merge_one_path() and merge_all()
  merge-index: drop the index
  merge-index: add a new way to invoke `git-merge-one-file'
  update-index: move add_cacheinfo() to read-cache.c
  merge-one-file: rewrite in C
  merge-resolve: rewrite in C
  merge-recursive: move better_branch_name() to merge.c
  merge-octopus: rewrite in C
  merge: use the "resolve" strategy without forking
  merge: use the "octopus" strategy without forking
  sequencer: use the "resolve" strategy without forking
  sequencer: use the "octopus" merge strategy without forking
 Documentation/git-merge-index.txt |   7 +-
 Makefile                          |   7 +-
 builtin.h                         |   3 +
 builtin/merge-index.c             | 119 ++++---
 builtin/merge-octopus.c           |  70 ++++
 builtin/merge-one-file.c          |  94 ++++++
 builtin/merge-recursive.c         |  16 +-
 builtin/merge-resolve.c           |  74 ++++
 builtin/merge.c                   |   7 +
 builtin/update-index.c            |  25 +-
 cache.h                           |  10 +-
 git-merge-octopus.sh              | 112 ------
 git-merge-one-file.sh             | 167 ---------
 git-merge-resolve.sh              |  54 ---
 git.c                             |   3 +
 merge-strategies.c                | 544 ++++++++++++++++++++++++++++++
 merge-strategies.h                |  39 +++
 merge.c                           |  12 +
 read-cache.c                      |  35 ++
 sequencer.c                       |  17 +-
 t/t6060-merge-index.sh            |  23 +-
 t/t6407-merge-binary.sh           |  27 +-
 t/t6415-merge-dir-to-symlink.sh   |   2 +-
 23 files changed, 1001 insertions(+), 466 deletions(-)
 create mode 100644 builtin/merge-octopus.c
 create mode 100644 builtin/merge-one-file.c
 create mode 100644 builtin/merge-resolve.c
 delete mode 100755 git-merge-octopus.sh
 delete mode 100755 git-merge-one-file.sh
 delete mode 100755 git-merge-resolve.sh
 create mode 100644 merge-strategies.c
 create mode 100644 merge-strategies.h
Range-diff against v6:
 1:  70d6507330 !  1:  dfe230bfce t6407: modernise tests
    @@ Commit message
         Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
     
      ## t/t6407-merge-binary.sh ##
    -@@ t/t6407-merge-binary.sh: test_description='ask merge-recursive to merge binary files'
    +@@ t/t6407-merge-binary.sh: export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
      . ./test-lib.sh
      
      test_expect_success setup '
    @@ t/t6407-merge-binary.sh: test_expect_success setup '
      	rm -f a* m* &&
      	git reset --hard anchor &&
     -
    --	if git merge -s resolve master
    +-	if git merge -s resolve main
     -	then
     -		echo Oops, should not have succeeded
     -		false
    @@ t/t6407-merge-binary.sh: test_expect_success setup '
     -		git ls-files -s >current
     -		test_cmp expect current
     -	fi
    -+	test_must_fail git merge -s resolve master &&
    ++	test_must_fail git merge -s resolve main &&
     +	git ls-files -s >current &&
     +	test_cmp expect current
      '
    @@ t/t6407-merge-binary.sh: test_expect_success setup '
      	rm -f a* m* &&
      	git reset --hard anchor &&
     -
    --	if git merge -s recursive master
    +-	if git merge -s recursive main
     -	then
     -		echo Oops, should not have succeeded
     -		false
    @@ t/t6407-merge-binary.sh: test_expect_success setup '
     -		git ls-files -s >current
     -		test_cmp expect current
     -	fi
    -+	test_must_fail git merge -s recursive master &&
    ++	test_must_fail git merge -s recursive main &&
     +	git ls-files -s >current &&
     +	test_cmp expect current
      '
 2:  25e9c47e41 =  2:  575e24685d t6060: modify multiple files to expose a possible issue with merge-index
 -:  ---------- >  3:  4f366ff363 t6060: add tests for removed files
 -:  ---------- >  4:  6af79a6b2d merge-index: libify merge_one_path() and merge_all()
 -:  ---------- >  5:  909ed66114 merge-index: drop the index
 -:  ---------- >  6:  1a8aba05bd merge-index: add a new way to invoke `git-merge-one-file'
 3:  e7ea43c5ff !  7:  1f6635512c update-index: move add_cacheinfo() to read-cache.c
    @@ builtin/update-index.c: static int process_path(const char *path, struct stat *s
     -	if (add_cache_entry(ce, option))
     +	res = add_to_index_cacheinfo(&the_index, mode, oid, path, stage,
     +				     allow_add, allow_replace, NULL);
    -+	if (res == -1)
    -+		return res;
    -+	if (res == -2)
    ++	if (res == ADD_TO_INDEX_CACHEINFO_INVALID_PATH)
    ++		return error(_("Invalid path '%s'"), path);
    ++	if (res == ADD_TO_INDEX_CACHEINFO_UNABLE_TO_ADD)
      		return error("%s: cannot add to the index - missing --add option?",
      			     path);
     +
    @@ cache.h: int remove_file_from_index(struct index_state *, const char *path);
      int add_to_index(struct index_state *, const char *path, struct stat *, int flags);
      int add_file_to_index(struct index_state *, const char *path, int flags);
      
    ++#define ADD_TO_INDEX_CACHEINFO_INVALID_PATH (-1)
    ++#define ADD_TO_INDEX_CACHEINFO_UNABLE_TO_ADD (-2)
    ++
     +int add_to_index_cacheinfo(struct index_state *, unsigned int mode,
     +			   const struct object_id *oid, const char *path,
     +			   int stage, int allow_add, int allow_replace,
    -+			   struct cache_entry **pce);
    ++			   struct cache_entry **ce_ret);
     +
      int chmod_index_entry(struct index_state *, struct cache_entry *ce, char flip);
      int ce_same_name(const struct cache_entry *a, const struct cache_entry *b);
    @@ read-cache.c: int add_index_entry(struct index_state *istate, struct cache_entry
     +int add_to_index_cacheinfo(struct index_state *istate, unsigned int mode,
     +			   const struct object_id *oid, const char *path,
     +			   int stage, int allow_add, int allow_replace,
    -+			   struct cache_entry **pce)
    ++			   struct cache_entry **ce_ret)
     +{
     +	int len, option;
    -+	struct cache_entry *ce = NULL;
    ++	struct cache_entry *ce;
     +
     +	if (!verify_path(path, mode))
    -+		return error(_("Invalid path '%s'"), path);
    ++		return ADD_TO_INDEX_CACHEINFO_INVALID_PATH;
     +
     +	len = strlen(path);
     +	ce = make_empty_cache_entry(istate, len);
    @@ read-cache.c: int add_index_entry(struct index_state *istate, struct cache_entry
     +
     +	if (add_index_entry(istate, ce, option)) {
     +		discard_cache_entry(ce);
    -+		return -2;
    ++		return ADD_TO_INDEX_CACHEINFO_UNABLE_TO_ADD;
     +	}
     +
    -+	if (pce)
    -+		*pce = ce;
    ++	if (ce_ret)
    ++		*ce_ret = ce;
     +
     +	return 0;
     +}
 4:  284fc4227f !  8:  8755608f6d merge-one-file: rewrite in C
    @@ Commit message
         it did not because there was no regular file called `a/b'.  This test is
         now marked as successful.
     
    +    This also teaches `merge-index' to call merge_three_way() (when invoked
    +    with `--use=merge-one-file') without forking using a new callback,
    +    merge_one_file_func().
    +
    +    To avoid any issue with a shrinking index because of the merge function
    +    used (directly in the process or by forking), as described earlier, the
    +    iterator of the loop of merge_all_index() is increased by the number of
    +    entries with the same name, minus the difference between the number of
    +    entries in the index before and after the merge.
    +
    +    This should handle a shrinking index correctly, but could lead to issues
    +    with a growing index.  However, this case is not treated, as there is no
    +    callback that can produce such a case.
    +
         Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
     
      ## Makefile ##
    @@ Makefile: SCRIPT_SH += git-bisect.sh
      SCRIPT_SH += git-merge-resolve.sh
      SCRIPT_SH += git-mergetool.sh
      SCRIPT_SH += git-quiltimport.sh
    -@@ Makefile: LIB_OBJS += match-trees.o
    - LIB_OBJS += mem-pool.o
    - LIB_OBJS += merge-blobs.o
    - LIB_OBJS += merge-recursive.o
    -+LIB_OBJS += merge-strategies.o
    - LIB_OBJS += merge.o
    - LIB_OBJS += mergesort.o
    - LIB_OBJS += midx.o
     @@ Makefile: BUILTIN_OBJS += builtin/mailsplit.o
      BUILTIN_OBJS += builtin/merge-base.o
      BUILTIN_OBJS += builtin/merge-file.o
    @@ builtin.h: int cmd_merge_base(int argc, const char **argv, const char *prefix);
      int cmd_merge_tree(int argc, const char **argv, const char *prefix);
      int cmd_mktag(int argc, const char **argv, const char *prefix);
     
    + ## builtin/merge-index.c ##
    +@@ builtin/merge-index.c: static int merge_one_file_spawn(struct index_state *istate,
    + int cmd_merge_index(int argc, const char **argv, const char *prefix)
    + {
    + 	int i, force_file = 0, err = 0, one_shot = 0, quiet = 0;
    +-	merge_fn merge_action = merge_one_file_spawn;
    ++	merge_fn merge_action;
    + 	struct lock_file lock = LOCK_INIT;
    + 	struct repository *r = the_repository;
    + 	const char *use_internal = NULL;
    +@@ builtin/merge-index.c: int cmd_merge_index(int argc, const char **argv, const char *prefix)
    + 
    + 	if (skip_prefix(pgm, "--use=", &use_internal)) {
    + 		if (!strcmp(use_internal, "merge-one-file"))
    +-			pgm = "git-merge-one-file";
    ++			merge_action = merge_one_file_func;
    + 		else
    + 			die(_("git merge-index: unknown internal program %s"), use_internal);
    +-	}
    ++
    ++		repo_hold_locked_index(r, &lock, LOCK_DIE_ON_ERROR);
    ++	} else
    ++		merge_action = merge_one_file_spawn;
    + 
    + 	for (; i < argc; i++) {
    + 		const char *arg = argv[i];
    +
      ## builtin/merge-one-file.c (new) ##
     @@
     +/*
    @@ builtin/merge-one-file.c (new)
     + * that might change the tree layout.
     + */
     +
    -+#define USE_THE_INDEX_COMPATIBILITY_MACROS
     +#include "cache.h"
     +#include "builtin.h"
     +#include "lockfile.h"
    @@ builtin/merge-one-file.c (new)
     +		*p_orig_blob = NULL, *p_our_blob = NULL, *p_their_blob = NULL;
     +	unsigned int orig_mode = 0, our_mode = 0, their_mode = 0, ret = 0;
     +	struct lock_file lock = LOCK_INIT;
    ++	struct repository *r = the_repository;
     +
     +	if (argc != 8)
     +		usage(builtin_merge_one_file_usage);
     +
    -+	if (read_cache() < 0)
    ++	if (repo_read_index(r) < 0)
     +		die("invalid index");
     +
    -+	hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
    ++	repo_hold_locked_index(r, &lock, LOCK_DIE_ON_ERROR);
     +
     +	if (!get_oid_hex(argv[1], &orig_blob)) {
     +		p_orig_blob = &orig_blob;
    @@ builtin/merge-one-file.c (new)
     +	if (ret)
     +		return ret;
     +
    -+	ret = merge_three_way(the_repository, p_orig_blob, p_our_blob, p_their_blob,
    ++	ret = merge_three_way(r->index, p_orig_blob, p_our_blob, p_their_blob,
     +			      argv[4], orig_mode, our_mode, their_mode);
     +
     +	if (ret) {
    @@ builtin/merge-one-file.c (new)
     +		return !!ret;
     +	}
     +
    -+	return write_locked_index(&the_index, &lock, COMMIT_LOCK);
    ++	return write_locked_index(r->index, &lock, COMMIT_LOCK);
     +}
     
      ## git-merge-one-file.sh (deleted) ##
    @@ git.c: static struct cmd_struct commands[] = {
      	{ "merge-recursive-ours", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE | NO_PARSEOPT },
      	{ "merge-recursive-theirs", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE | NO_PARSEOPT },
     
    - ## merge-strategies.c (new) ##
    + ## merge-strategies.c ##
     @@
    -+#include "cache.h"
    + #include "cache.h"
     +#include "dir.h"
    -+#include "merge-strategies.h"
    + #include "merge-strategies.h"
     +#include "xdiff-interface.h"
     +
    -+static int checkout_from_index(struct index_state *istate, const char *path,
    -+			       struct cache_entry *ce)
    ++static int add_merge_result_to_index(struct index_state *istate, unsigned int mode,
    ++				     const struct object_id *oid, const char *path,
    ++				     int checkout)
     +{
    -+	struct checkout state = CHECKOUT_INIT;
    ++	struct cache_entry *ce;
    ++	int res;
     +
    -+	state.istate = istate;
    -+	state.force = 1;
    -+	state.base_dir = "";
    -+	state.base_dir_len = 0;
    ++	res = add_to_index_cacheinfo(istate, mode, oid, path, 0, 1, 1, &ce);
    ++	if (res == -1)
    ++		return error(_("Invalid path '%s'"), path);
    ++	else if (res == -2)
    ++		return -1;
    ++
    ++	if (checkout) {
    ++		struct checkout state = CHECKOUT_INIT;
    ++
    ++		state.istate = istate;
    ++		state.force = 1;
    ++		state.base_dir = "";
    ++		state.base_dir_len = 0;
    ++
    ++		if (checkout_entry(ce, &state, NULL, NULL) < 0)
    ++			return error(_("%s: cannot checkout file"), path);
    ++	}
     +
    -+	if (checkout_entry(ce, &state, NULL, NULL) < 0)
    -+		return error(_("%s: cannot checkout file"), path);
     +	return 0;
     +}
     +
    @@ merge-strategies.c (new)
     +				  const struct object_id *their_blob, const char *path,
     +				  unsigned int orig_mode, unsigned int our_mode, unsigned int their_mode)
     +{
    -+	if ((our_blob && orig_mode != our_mode) ||
    -+	    (their_blob && orig_mode != their_mode))
    ++	if ((!our_blob && orig_mode != their_mode) ||
    ++	    (!their_blob && orig_mode != our_mode))
     +		return error(_("File %s deleted on one branch but had its "
     +			       "permissions changed on the other."), path);
     +
    @@ merge-strategies.c (new)
     +	return add_file_to_index(istate, path, 0);
     +}
     +
    -+int merge_three_way(struct repository *r,
    ++int merge_three_way(struct index_state *istate,
     +		    const struct object_id *orig_blob,
     +		    const struct object_id *our_blob,
     +		    const struct object_id *their_blob, const char *path,
     +		    unsigned int orig_mode, unsigned int our_mode, unsigned int their_mode)
     +{
     +	if (orig_blob &&
    -+	    ((!their_blob && our_blob && oideq(orig_blob, our_blob)) ||
    ++	    ((!our_blob && !their_blob) ||
    ++	     (!their_blob && our_blob && oideq(orig_blob, our_blob)) ||
     +	     (!our_blob && their_blob && oideq(orig_blob, their_blob)))) {
     +		/* Deleted in both or deleted in one and unchanged in the other. */
    -+		return merge_one_file_deleted(r->index, our_blob, their_blob, path,
    ++		return merge_one_file_deleted(istate, our_blob, their_blob, path,
     +					      orig_mode, our_mode, their_mode);
     +	} else if (!orig_blob && our_blob && !their_blob) {
     +		/*
    -+		 * Added in one.  The other side did not add and we
    ++		 * Added in ours.  The other side did not add and we
     +		 * added so there is nothing to be done, except making
     +		 * the path merged.
     +		 */
    -+		return add_to_index_cacheinfo(r->index, our_mode, our_blob,
    -+					      path, 0, 1, 1, NULL);
    ++		return add_merge_result_to_index(istate, our_mode, our_blob, path, 0);
     +	} else if (!orig_blob && !our_blob && their_blob) {
    -+		struct cache_entry *ce;
     +		printf(_("Adding %s\n"), path);
     +
     +		if (file_exists(path))
     +			return error(_("untracked %s is overwritten by the merge."), path);
     +
    -+		if (add_to_index_cacheinfo(r->index, their_mode, their_blob,
    -+					   path, 0, 1, 1, &ce))
    -+			return -1;
    -+		return checkout_from_index(r->index, path, ce);
    ++		return add_merge_result_to_index(istate, their_mode, their_blob, path, 1);
     +	} else if (!orig_blob && our_blob && their_blob &&
     +		   oideq(our_blob, their_blob)) {
    -+		struct cache_entry *ce;
    -+
     +		/* Added in both, identically (check for same permissions). */
     +		if (our_mode != their_mode)
     +			return error(_("File %s added identically in both branches, "
    @@ merge-strategies.c (new)
     +
     +		printf(_("Adding %s\n"), path);
     +
    -+		if (add_to_index_cacheinfo(r->index, our_mode, our_blob,
    -+					   path, 0, 1, 1, &ce))
    -+			return -1;
    -+		return checkout_from_index(r->index, path, ce);
    ++		return add_merge_result_to_index(istate, our_mode, our_blob, path, 1);
     +	} else if (our_blob && their_blob) {
     +		/* Modified in both, but differently. */
    -+		return do_merge_one_file(r->index,
    ++		return do_merge_one_file(istate,
     +					 orig_blob, our_blob, their_blob, path,
     +					 orig_mode, our_mode, their_mode);
     +	} else {
    @@ merge-strategies.c (new)
     +
     +	return 0;
     +}
    ++
    ++int merge_one_file_func(struct index_state *istate,
    ++			const struct object_id *orig_blob,
    ++			const struct object_id *our_blob,
    ++			const struct object_id *their_blob, const char *path,
    ++			unsigned int orig_mode, unsigned int our_mode, unsigned int their_mode,
    ++			void *data)
    ++{
    ++	return merge_three_way(istate,
    ++			       orig_blob, our_blob, their_blob, path,
    ++			       orig_mode, our_mode, their_mode);
    ++}
    + 
    + static int merge_entry(struct index_state *istate, int quiet, unsigned int pos,
    + 		       const char *path, int *err, merge_fn fn, void *data)
    +@@ merge-strategies.c: int merge_all_index(struct index_state *istate, int oneshot, int quiet,
    + 		    merge_fn fn, void *data)
    + {
    + 	int err = 0, ret;
    +-	unsigned int i;
    ++	unsigned int i, prev_nr;
    + 
    + 	for (i = 0; i < istate->cache_nr; i++) {
    + 		const struct cache_entry *ce = istate->cache[i];
    + 		if (!ce_stage(ce))
    + 			continue;
    + 
    ++		prev_nr = istate->cache_nr;
    + 		ret = merge_entry(istate, quiet || oneshot, i, ce->name, &err, fn, data);
    +-		if (ret > 0)
    +-			i += ret - 1;
    +-		else if (ret == -1)
    ++		if (ret > 0) {
    ++			/*
    ++			 * Don't bother handling an index that has
    ++			 * grown, since merge_one_file_func() can't grow
    ++			 * it, and merge_one_file_spawn() can't change
    ++			 * it.
    ++			 */
    ++			i += ret - (prev_nr - istate->cache_nr) - 1;
    ++		} else if (ret == -1)
    + 			return -1;
    + 
    + 		if (err && !oneshot)
     
    - ## merge-strategies.h (new) ##
    + ## merge-strategies.h ##
     @@
    -+#ifndef MERGE_STRATEGIES_H
    -+#define MERGE_STRATEGIES_H
    -+
    -+#include "object.h"
    -+
    -+int merge_three_way(struct repository *r,
    + 
    + #include "object.h"
    + 
    ++int merge_three_way(struct index_state *istate,
     +		    const struct object_id *orig_blob,
     +		    const struct object_id *our_blob,
     +		    const struct object_id *their_blob, const char *path,
     +		    unsigned int orig_mode, unsigned int our_mode, unsigned int their_mode);
     +
    -+#endif /* MERGE_STRATEGIES_H */
    + typedef int (*merge_fn)(struct index_state *istate,
    + 			const struct object_id *orig_blob,
    + 			const struct object_id *our_blob,
    +@@ merge-strategies.h: typedef int (*merge_fn)(struct index_state *istate,
    + 			unsigned int orig_mode, unsigned int our_mode, unsigned int their_mode,
    + 			void *data);
    + 
    ++int merge_one_file_func(struct index_state *istate,
    ++			const struct object_id *orig_blob,
    ++			const struct object_id *our_blob,
    ++			const struct object_id *their_blob, const char *path,
    ++			unsigned int orig_mode, unsigned int our_mode, unsigned int their_mode,
    ++			void *data);
    ++
    + int merge_index_path(struct index_state *istate, int oneshot, int quiet,
    + 		     const char *path, merge_fn fn, void *data);
    + int merge_all_index(struct index_state *istate, int oneshot, int quiet,
    +
    + ## t/t6060-merge-index.sh ##
    +@@ t/t6060-merge-index.sh: test_expect_success 'merge-one-file fails without a work tree' '
    + 	(cd bare.git &&
    + 	 GIT_INDEX_FILE=$PWD/merge.index &&
    + 	 export GIT_INDEX_FILE &&
    +-	 test_must_fail git merge-index git-merge-one-file -a
    ++	 test_must_fail git merge-index --use=merge-one-file -a
    + 	)
    + '
    + 
     
      ## t/t6415-merge-dir-to-symlink.sh ##
     @@ t/t6415-merge-dir-to-symlink.sh: test_expect_success SYMLINKS 'a/b was resolved as symlink' '
 5:  54abee902f <  -:  ---------- merge-index: libify merge_one_path() and merge_all()
 6:  acaf100edd <  -:  ---------- merge-index: don't fork if the requested program is `git-merge-one-file'
 7:  9a9e3faeff !  9:  3ecf49a8ac merge-resolve: rewrite in C
    @@ builtin/merge-resolve.c (new)
     + * Resolve two trees, using enhanced multi-base read-tree.
     + */
     +
    -+#define USE_THE_INDEX_COMPATIBILITY_MACROS
     +#include "cache.h"
     +#include "builtin.h"
     +#include "merge-strategies.h"
    @@ builtin/merge-resolve.c (new)
     +	const char *head = NULL;
     +	struct commit_list *bases = NULL, *remote = NULL;
     +	struct commit_list **next_base = &bases;
    ++	struct repository *r = the_repository;
     +
     +	if (argc < 5)
     +		usage(builtin_merge_resolve_usage);
     +
     +	setup_work_tree();
    -+	if (read_cache() < 0)
    ++	if (repo_read_index(r) < 0)
     +		die("invalid index");
     +
     +	/*
    @@ builtin/merge-resolve.c (new)
     +			if (get_oid(argv[i], &oid))
     +				die("object %s not found.", argv[i]);
     +
    -+			commit = lookup_commit_or_die(&oid, argv[i]);
    ++			commit = oideq(&oid, r->hash_algo->empty_tree) ?
    ++				NULL : lookup_commit_or_die(&oid, argv[i]);
     +
     +			if (sep_seen)
     +				commit_list_insert(commit, &remote);
    @@ builtin/merge-resolve.c (new)
     +	if (!bases)
     +		return 2;
     +
    -+	return merge_strategies_resolve(the_repository, bases, head, remote);
    ++	return merge_strategies_resolve(r, bases, head, remote);
     +}
     
      ## git-merge-resolve.sh (deleted) ##
    @@ git-merge-resolve.sh (deleted)
     -	exit 0
     -else
     -	echo "Simple merge failed, trying Automatic merge."
    --	if git merge-index -o git-merge-one-file -a
    +-	if git merge-index -o --use=merge-one-file -a
     -	then
     -		exit 0
     -	else
    @@ merge-strategies.c
      #include "dir.h"
     +#include "lockfile.h"
      #include "merge-strategies.h"
    - #include "run-command.h"
     +#include "unpack-trees.h"
      #include "xdiff-interface.h"
      
    - static int checkout_from_index(struct index_state *istate, const char *path,
    -@@ merge-strategies.c: int merge_all_index(struct repository *r, int oneshot, int quiet,
    + static int add_merge_result_to_index(struct index_state *istate, unsigned int mode,
    +@@ merge-strategies.c: int merge_all_index(struct index_state *istate, int oneshot, int quiet,
      
      	return err;
      }
    @@ merge-strategies.c: int merge_all_index(struct repository *r, int oneshot, int q
     +
     +		puts(_("Simple merge failed, trying Automatic merge."));
     +		repo_hold_locked_index(r, &lock, LOCK_DIE_ON_ERROR);
    -+		ret = merge_all_index(r, 1, 0, merge_one_file_func, NULL);
    ++		ret = merge_all_index(r->index, 1, 0, merge_one_file_func, NULL);
     +
     +		write_locked_index(r->index, &lock, COMMIT_LOCK);
     +		return !!ret;
    @@ merge-strategies.h
     +#include "commit.h"
      #include "object.h"
      
    - int merge_three_way(struct repository *r,
    -@@ merge-strategies.h: int merge_index_path(struct repository *r, int oneshot, int quiet,
    - int merge_all_index(struct repository *r, int oneshot, int quiet,
    + int merge_three_way(struct index_state *istate,
    +@@ merge-strategies.h: int merge_index_path(struct index_state *istate, int oneshot, int quiet,
    + int merge_all_index(struct index_state *istate, int oneshot, int quiet,
      		    merge_fn fn, void *data);
      
     +int merge_strategies_resolve(struct repository *r,
 8:  359346229c = 10:  615b04d417 merge-recursive: move better_branch_name() to merge.c
 9:  4dff780212 ! 11:  a6ece04f3d merge-octopus: rewrite in C
    @@ builtin/merge-octopus.c (new)
     + * Resolve two or more trees.
     + */
     +
    -+#define USE_THE_INDEX_COMPATIBILITY_MACROS
     +#include "cache.h"
     +#include "builtin.h"
     +#include "commit.h"
    @@ builtin/merge-octopus.c (new)
     +	struct commit_list *bases = NULL, *remotes = NULL;
     +	struct commit_list **next_base = &bases, **next_remote = &remotes;
     +	const char *head_arg = NULL;
    ++	struct repository *r = the_repository;
     +
     +	if (argc < 5)
     +		usage(builtin_merge_octopus_usage);
     +
     +	setup_work_tree();
    -+	if (read_cache() < 0)
    ++	if (repo_read_index(r) < 0)
     +		die("invalid index");
     +
     +	/*
    @@ builtin/merge-octopus.c (new)
     +			if (get_oid(argv[i], &oid))
     +				die("object %s not found.", argv[i]);
     +
    -+			commit = lookup_commit_or_die(&oid, argv[i]);
    ++			commit = oideq(&oid, r->hash_algo->empty_tree) ?
    ++				NULL : lookup_commit_or_die(&oid, argv[i]);
     +
     +			if (sep_seen)
     +				next_remote = commit_list_append(commit, next_remote);
    @@ builtin/merge-octopus.c (new)
     +	if (commit_list_count(remotes) < 2)
     +		return 2;
     +
    -+	return merge_strategies_octopus(the_repository, bases, head_arg, remotes);
    ++	return merge_strategies_octopus(r, bases, head_arg, remotes);
     +}
     
      ## git-merge-octopus.sh (deleted) ##
    @@ git-merge-octopus.sh (deleted)
     -	if test $? -ne 0
     -	then
     -		gettextln "Simple merge did not work, trying automatic merge."
    --		git merge-index -o git-merge-one-file -a ||
    +-		git merge-index -o --use=merge-one-file -a ||
     -		OCTOPUS_FAILURE=1
     -		next=$(git write-tree 2>/dev/null)
     -	fi
    @@ merge-strategies.c: int merge_strategies_resolve(struct repository *r,
     +			    struct tree **reference_tree)
     +{
     +	struct tree_desc t[MAX_UNPACK_TREES];
    -+	struct commit_list *j;
    ++	struct commit_list *i;
     +	int nr = 0, ret = 0;
     +
     +	printf(_("Trying simple merge with %s\n"), branch_name);
     +
    -+	for (j = common; j; j = j->next) {
    -+		struct tree *tree = repo_get_commit_tree(r, j->item);
    ++	for (i = common; i; i = i->next) {
    ++		struct tree *tree = repo_get_commit_tree(r, i->item);
     +		if (add_tree(tree, t + (nr++)))
     +			return -1;
     +	}
    @@ merge-strategies.c: int merge_strategies_resolve(struct repository *r,
     +	if (add_tree(current_tree, t + (nr++)))
     +		return -1;
     +	if (fast_forward(r, t, nr, 1))
    -+		return -1;
    ++		return 2;
     +
     +	if (write_tree(r, reference_tree)) {
     +		struct lock_file lock = LOCK_INIT;
     +
     +		puts(_("Simple merge did not work, trying automatic merge."));
     +		repo_hold_locked_index(r, &lock, LOCK_DIE_ON_ERROR);
    -+		ret = merge_all_index(r, 1, 0, merge_one_file_func, NULL);
    ++		ret = !!merge_all_index(r->index, 0, 0, merge_one_file_func, NULL);
     +		write_locked_index(r->index, &lock, COMMIT_LOCK);
     +
     +		write_tree(r, reference_tree);
     +	}
     +
    -+	return ret ? -2 : 0;
    ++	return ret;
     +}
     +
     +int merge_strategies_octopus(struct repository *r,
     +			     struct commit_list *bases, const char *head_arg,
     +			     struct commit_list *remotes)
     +{
    -+	int ff_merge = 1, ret = 0, references = 1;
    -+	struct commit **reference_commit, *head_commit;
    ++	int ff_merge = 1, ret = 0, nr_references = 1;
    ++	struct commit **reference_commits, *head_commit;
     +	struct tree *reference_tree, *head_tree;
     +	struct commit_list *i;
     +	struct object_id head;
    @@ merge-strategies.c: int merge_strategies_resolve(struct repository *r,
     +		return 2;
     +	}
     +
    -+	reference_commit = xcalloc(commit_list_count(remotes) + 1,
    -+				   sizeof(struct commit *));
    -+	reference_commit[0] = head_commit;
    ++	CALLOC_ARRAY(reference_commits, commit_list_count(remotes) + 1);
    ++	reference_commits[0] = head_commit;
     +	reference_tree = head_tree;
     +
     +	for (i = remotes; i && i->item; i = i->next) {
    @@ merge-strategies.c: int merge_strategies_resolve(struct repository *r,
     +		struct object_id *oid = &c->object.oid;
     +		struct tree *current_tree = repo_get_commit_tree(r, c);
     +		struct commit_list *common, *j;
    -+		char *branch_name;
    -+		int k = 0, up_to_date = 0;
    -+
    -+		if (ret) {
    -+			/*
    -+			 * We allow only last one to have a
    -+			 * hand-resolvable conflicts.  Last round failed
    -+			 * and we still had a head to merge.
    -+			 */
    -+			puts(_("Automated merge did not work."));
    -+			puts(_("Should not be doing an octopus."));
    -+
    -+			free(reference_commit);
    -+			return 2;
    -+		}
    -+
    -+		branch_name = merge_get_better_branch_name(oid_to_hex(oid));
    -+		common = get_merge_bases_many(c, references, reference_commit);
    ++		char *branch_name = merge_get_better_branch_name(oid_to_hex(oid));
    ++		int up_to_date = 0;
     +
    ++		common = repo_get_merge_bases_many(r, c, nr_references, reference_commits);
     +		if (!common) {
     +			error(_("Unable to find common commit with %s"), branch_name);
     +
     +			free(branch_name);
     +			free_commit_list(common);
    -+			free(reference_commit);
    ++			free(reference_commits);
     +
     +			return 2;
     +		}
     +
    -+		for (j = common; j && !(up_to_date || !ff_merge); j = j->next) {
    ++		for (j = common; j && !up_to_date && ff_merge; j = j->next) {
     +			up_to_date |= oideq(&j->item->object.oid, oid);
     +
    -+			if (k < references)
    -+				ff_merge &= oideq(&j->item->object.oid, &reference_commit[k++]->object.oid);
    ++			if (!j->next &&
    ++			    !oideq(&j->item->object.oid,
    ++				   &reference_commits[nr_references - 1]->object.oid))
    ++				ff_merge = 0;
     +		}
     +
     +		if (up_to_date) {
    @@ merge-strategies.c: int merge_strategies_resolve(struct repository *r,
     +		if (ff_merge) {
     +			ret = octopus_fast_forward(r, branch_name, head_tree,
     +						   current_tree, &reference_tree);
    -+			references = 0;
    ++			nr_references = 0;
     +		} else {
     +			ret = octopus_do_merge(r, branch_name, common,
     +					       current_tree, &reference_tree);
    @@ merge-strategies.c: int merge_strategies_resolve(struct repository *r,
     +		free(branch_name);
     +		free_commit_list(common);
     +
    -+		if (ret == -1)
    ++		if (ret == -1 || ret == 2)
     +			break;
    ++		else if (ret && i->next) {
    ++			/*
    ++			 * We allow only last one to have a
    ++			 * hand-resolvable conflicts.  Last round failed
    ++			 * and we still had a head to merge.
    ++			 */
    ++			puts(_("Automated merge did not work."));
    ++			puts(_("Should not be doing an octopus."));
     +
    -+		reference_commit[references++] = c;
    ++			free(reference_commits);
    ++			return 2;
    ++		}
    ++
    ++		reference_commits[nr_references++] = c;
     +	}
     +
    -+	free(reference_commit);
    ++	free(reference_commits);
     +	return ret;
     +}
     
      ## merge-strategies.h ##
    -@@ merge-strategies.h: int merge_all_index(struct repository *r, int oneshot, int quiet,
    +@@ merge-strategies.h: int merge_all_index(struct index_state *istate, int oneshot, int quiet,
      int merge_strategies_resolve(struct repository *r,
      			     struct commit_list *bases, const char *head_arg,
      			     struct commit_list *remote);
10:  76f02b4531 = 12:  cc1500147b merge: use the "resolve" strategy without forking
11:  c9e0a38d0f = 13:  ec3dc3b81e merge: use the "octopus" strategy without forking
12:  5b595efa46 = 14:  e7dc4a15d4 sequencer: use the "resolve" strategy without forking
13:  7eb0f13442 = 15:  34280dd82d sequencer: use the "octopus" merge strategy without forking
-- 
2.31.0
Previous: Derrick StoleeNext: Alban Gruin
Message 130 of 221 in “Rewrite the remaining merge strategies from shell to C”
  1. 00/17 Rewrite the remaining merge strategies from shell to CAlban Gruin, Jun 25, 2020
  2. 01/17 t6027: modernise testsAlban Gruin, Jun 25, 2020
  3. 03/17 merge-one-file: remove calls to external processesAlban Gruin, Jun 25, 2020
  4. 04/17 merge-one-file: use error() instead of fprintf(stderr, ...)Alban Gruin, Jun 25, 2020
  5. 02/17 merge-one-file: rewrite in CAlban Gruin, Jun 25, 2020
  6. Chris TorekJun 25, 2020
  7. Phillip WoodJun 25, 2020
  8. Phillip WoodJun 25, 2020
  9. Phillip WoodJun 26, 2020
  10. Alban GruinJul 12, 2020
  11. 05/17 merge-one-file: libify merge_one_file()Alban Gruin, Jun 25, 2020
  12. 06/17 merge-index: libify merge_one_path() and merge_all()Alban Gruin, Jun 25, 2020
  13. Phillip WoodJun 26, 2020
  14. Phillip WoodJun 26, 2020
  15. Alban GruinJul 12, 2020
  16. Phillip WoodJul 12, 2020
  17. Alban GruinJul 12, 2020
  18. 09/17 merge-resolve: libify merge_resolve()Alban Gruin, Jun 25, 2020
  19. 08/17 merge-resolve: remove calls to external processesAlban Gruin, Jun 25, 2020
  20. 07/17 merge-resolve: rewrite in CAlban Gruin, Jun 25, 2020
  21. 10/17 merge-recursive: move better_branch_name() to merge.cAlban Gruin, Jun 25, 2020
  22. 13/17 merge-octopus: libify merge_octopus()Alban Gruin, Jun 25, 2020
  23. 15/17 merge: use the "octopus" strategy without forkingAlban Gruin, Jun 25, 2020
  24. 16/17 sequencer: use the "resolve" strategy without forkingAlban Gruin, Jun 25, 2020
  25. Phillip WoodJun 25, 2020
  26. Alban GruinJul 12, 2020
  27. 14/17 merge: use the "resolve" strategy without forkingAlban Gruin, Jun 25, 2020
  28. 11/17 merge-octopus: rewrite in CAlban Gruin, Jun 25, 2020
  29. 12/17 merge-octopus: remove calls to external processesAlban Gruin, Jun 25, 2020
  30. 17/17 sequencer: use the "octopus" merge strategy without forkingAlban Gruin, Jun 25, 2020
  31. 00/11 Rewrite the remaining merge strategies from shell to CAlban Gruin, Sep 1, 2020
  32. 01/11 t6027: modernise testsAlban Gruin, Sep 1, 2020
  33. 04/11 merge-index: don't fork if the requested program is `git-merge-one-file'Alban Gruin, Sep 1, 2020
  34. 06/11 merge-recursive: move better_branch_name() to merge.cAlban Gruin, Sep 1, 2020
  35. 02/11 merge-one-file: rewrite in CAlban Gruin, Sep 1, 2020
  36. Junio C HamanoSep 1, 2020
  37. Alban GruinSep 2, 2020
  38. 10/11 sequencer: use the "resolve" strategy without forkingAlban Gruin, Sep 1, 2020
  39. 03/11 merge-index: libify merge_one_path() and merge_all()Alban Gruin, Sep 1, 2020
  40. Junio C HamanoSep 1, 2020
  41. Alban GruinSep 2, 2020
  42. 09/11 merge: use the "octopus" strategy without forkingAlban Gruin, Sep 1, 2020
  43. 11/11 sequencer: use the "octopus" merge strategy without forkingAlban Gruin, Sep 1, 2020
  44. 08/11 merge: use the "resolve" strategy without forkingAlban Gruin, Sep 1, 2020
  45. 07/11 merge-octopus: rewrite in CAlban Gruin, Sep 1, 2020
  46. 05/11 merge-resolve: rewrite in CAlban Gruin, Sep 1, 2020
  47. 00/11 Rewrite the remaining merge strategies from shell to CAlban Gruin, Oct 5, 2020
  48. 03/11 merge-index: libify merge_one_path() and merge_all()Alban Gruin, Oct 5, 2020
  49. Junio C HamanoOct 9, 2020
  50. Alban GruinNov 6, 2020
  51. 02/11 merge-one-file: rewrite in CAlban Gruin, Oct 5, 2020
  52. Junio C HamanoOct 6, 2020
  53. Alban GruinOct 21, 2020
  54. Junio C HamanoOct 21, 2020
  55. Junio C HamanoOct 21, 2020
  56. Junio C HamanoOct 21, 2020
  57. 01/11 t6027: modernise testsAlban Gruin, Oct 5, 2020
  58. Junio C HamanoOct 6, 2020
  59. 08/11 merge: use the "resolve" strategy without forkingAlban Gruin, Oct 5, 2020
  60. 11/11 sequencer: use the "octopus" merge strategy without forkingAlban Gruin, Oct 5, 2020
  61. 07/11 merge-octopus: rewrite in CAlban Gruin, Oct 5, 2020
  62. 10/11 sequencer: use the "resolve" strategy without forkingAlban Gruin, Oct 5, 2020
  63. 06/11 merge-recursive: move better_branch_name() to merge.cAlban Gruin, Oct 5, 2020
  64. 04/11 merge-index: don't fork if the requested program is `git-merge-one-file'Alban Gruin, Oct 5, 2020
  65. Junio C HamanoOct 16, 2020
  66. 09/11 merge: use the "octopus" strategy without forkingAlban Gruin, Oct 5, 2020
  67. 05/11 merge-resolve: rewrite in CAlban Gruin, Oct 5, 2020
  68. Junio C HamanoOct 16, 2020
  69. Alban GruinNov 6, 2020
  70. Johannes SchindelinOct 7, 2020
  71. 00/12 Rewrite the remaining merge strategies from shell to CAlban Gruin, Nov 13, 2020
  72. 01/12 t6027: modernise testsAlban Gruin, Nov 13, 2020
  73. 02/12 update-index: move add_cacheinfo() to read-cache.cAlban Gruin, Nov 13, 2020
  74. 03/12 merge-one-file: rewrite in CAlban Gruin, Nov 13, 2020
  75. 06/12 merge-resolve: rewrite in CAlban Gruin, Nov 13, 2020
  76. 04/12 merge-index: libify merge_one_path() and merge_all()Alban Gruin, Nov 13, 2020
  77. 07/12 merge-recursive: move better_branch_name() to merge.cAlban Gruin, Nov 13, 2020
  78. 08/12 merge-octopus: rewrite in CAlban Gruin, Nov 13, 2020
  79. 10/12 merge: use the "octopus" strategy without forkingAlban Gruin, Nov 13, 2020
  80. 12/12 sequencer: use the "octopus" merge strategy without forkingAlban Gruin, Nov 13, 2020
  81. 05/12 merge-index: don't fork if the requested program is `git-merge-one-file'Alban Gruin, Nov 13, 2020
  82. 11/12 sequencer: use the "resolve" strategy without forkingAlban Gruin, Nov 13, 2020
  83. 09/12 merge: use the "resolve" strategy without forkingAlban Gruin, Nov 13, 2020
  84. 00/12 Rewrite the remaining merge strategies from shell to CAlban Gruin, Nov 16, 2020
  85. 01/12 t6027: modernise testsAlban Gruin, Nov 16, 2020
  86. 02/12 update-index: move add_cacheinfo() to read-cache.cAlban Gruin, Nov 16, 2020
  87. 04/12 merge-index: libify merge_one_path() and merge_all()Alban Gruin, Nov 16, 2020
  88. 03/12 merge-one-file: rewrite in CAlban Gruin, Nov 16, 2020
  89. 05/12 merge-index: don't fork if the requested program is `git-merge-one-file'Alban Gruin, Nov 16, 2020
  90. 06/12 merge-resolve: rewrite in CAlban Gruin, Nov 16, 2020
  91. 07/12 merge-recursive: move better_branch_name() to merge.cAlban Gruin, Nov 16, 2020
  92. 08/12 merge-octopus: rewrite in CAlban Gruin, Nov 16, 2020
  93. 11/12 sequencer: use the "resolve" strategy without forkingAlban Gruin, Nov 16, 2020
  94. 12/12 sequencer: use the "octopus" merge strategy without forkingAlban Gruin, Nov 16, 2020
  95. 10/12 merge: use the "octopus" strategy without forkingAlban Gruin, Nov 16, 2020
  96. 09/12 merge: use the "resolve" strategy without forkingAlban Gruin, Nov 16, 2020
  97. 00/13 Rewrite the remaining merge strategies from shell to CAlban Gruin, Nov 24, 2020
  98. 01/13 t6407: modernise testsAlban Gruin, Nov 24, 2020
  99. 02/13 t6060: modify multiple files to expose a possible issue with merge-indexAlban Gruin, Nov 24, 2020
  100. 03/13 update-index: move add_cacheinfo() to read-cache.cAlban Gruin, Nov 24, 2020
  101. Junio C HamanoDec 22, 2020
  102. 04/13 merge-one-file: rewrite in CAlban Gruin, Nov 24, 2020
  103. Junio C HamanoDec 22, 2020
  104. Alban GruinJan 3, 2021
  105. Junio C HamanoJan 8, 2021
  106. 07/13 merge-resolve: rewrite in CAlban Gruin, Nov 24, 2020
  107. 05/13 merge-index: libify merge_one_path() and merge_all()Alban Gruin, Nov 24, 2020
  108. Derrick StoleeJan 5, 2021
  109. Alban GruinJan 5, 2021
  110. 06/13 merge-index: don't fork if the requested program is `git-merge-one-file'Alban Gruin, Nov 24, 2020
  111. Derrick StoleeJan 5, 2021
  112. Martin ÅgrenJan 5, 2021
  113. Alban GruinJan 5, 2021
  114. Alban GruinJan 5, 2021
  115. Junio C HamanoJan 6, 2021
  116. Alban GruinJan 10, 2021
  117. Junio C HamanoJan 10, 2021
  118. Alban GruinMar 8, 2021
  119. 08/13 merge-recursive: move better_branch_name() to merge.cAlban Gruin, Nov 24, 2020
  120. Derrick StoleeJan 5, 2021
  121. 09/13 merge-octopus: rewrite in CAlban Gruin, Nov 24, 2020
  122. Derrick StoleeJan 5, 2021
  123. 11/13 merge: use the "octopus" strategy without forkingAlban Gruin, Nov 24, 2020
  124. 10/13 merge: use the "resolve" strategy without forkingAlban Gruin, Nov 24, 2020
  125. Derrick StoleeJan 5, 2021
  126. 13/13 sequencer: use the "octopus" merge strategy without forkingAlban Gruin, Nov 24, 2020
  127. 12/13 sequencer: use the "resolve" strategy without forkingAlban Gruin, Nov 24, 2020
  128. SZEDER GáborNov 24, 2020
  129. Derrick StoleeJan 5, 2021
  130. 00/15 Rewrite the remaining merge strategies from shell to CAlban Gruin, Mar 17, 2021
  131. 01/15 t6407: modernise testsAlban Gruin, Mar 17, 2021
  132. 02/15 t6060: modify multiple files to expose a possible issue with merge-indexAlban Gruin, Mar 17, 2021
  133. 04/15 merge-index: libify merge_one_path() and merge_all()Alban Gruin, Mar 17, 2021
  134. 05/15 merge-index: drop the indexAlban Gruin, Mar 17, 2021
  135. 03/15 t6060: add tests for removed filesAlban Gruin, Mar 17, 2021
  136. Johannes SchindelinMar 22, 2021
  137. Alban GruinMar 23, 2021
  138. 07/15 update-index: move add_cacheinfo() to read-cache.cAlban Gruin, Mar 17, 2021
  139. Johannes SchindelinMar 22, 2021
  140. Alban GruinMar 23, 2021
  141. 06/15 merge-index: add a new way to invoke `git-merge-one-file'Alban Gruin, Mar 17, 2021
  142. 09/15 merge-resolve: rewrite in CAlban Gruin, Mar 17, 2021
  143. Johannes SchindelinMar 23, 2021
  144. Alban GruinApr 10, 2021
  145. 10/15 merge-recursive: move better_branch_name() to merge.cAlban Gruin, Mar 17, 2021
  146. 12/15 merge: use the "resolve" strategy without forkingAlban Gruin, Mar 17, 2021
  147. 11/15 merge-octopus: rewrite in CAlban Gruin, Mar 17, 2021
  148. Johannes SchindelinMar 23, 2021
  149. 08/15 merge-one-file: rewrite in CAlban Gruin, Mar 17, 2021
  150. Johannes SchindelinMar 22, 2021
  151. Alban GruinMar 23, 2021
  152. Johannes SchindelinMar 24, 2021
  153. Alban GruinApr 10, 2021
  154. 15/15 sequencer: use the "octopus" merge strategy without forkingAlban Gruin, Mar 17, 2021
  155. 14/15 sequencer: use the "resolve" strategy without forkingAlban Gruin, Mar 17, 2021
  156. 13/15 merge: use the "octopus" strategy without forkingAlban Gruin, Mar 17, 2021
  157. 00/14 Rewrite the remaining merge strategies from shell to CAlban Gruin, Aug 9, 2022
  158. 01/14 t6060: modify multiple files to expose a possible issue with merge-indexAlban Gruin, Aug 9, 2022
  159. 02/14 t6060: add tests for removed filesAlban Gruin, Aug 9, 2022
  160. 03/14 merge-index: libify merge_one_path() and merge_all()Alban Gruin, Aug 9, 2022
  161. Ævar Arnfjörð BjarmasonAug 17, 2022
  162. 05/14 merge-index: add a new way to invoke `git-merge-one-file'Alban Gruin, Aug 9, 2022
  163. Johannes SchindelinAug 9, 2022
  164. Phillip WoodAug 10, 2022
  165. 04/14 merge-index: drop the indexAlban Gruin, Aug 9, 2022
  166. 06/14 update-index: move add_cacheinfo() to read-cache.cAlban Gruin, Aug 9, 2022
  167. 07/14 merge-one-file: rewrite in CAlban Gruin, Aug 9, 2022
  168. Johannes SchindelinAug 9, 2022
  169. 08/14 merge-resolve: rewrite in CAlban Gruin, Aug 9, 2022
  170. Phillip WoodAug 10, 2022
  171. Junio C HamanoAug 10, 2022
  172. Johannes SchindelinAug 16, 2022
  173. Junio C HamanoAug 16, 2022
  174. Johannes SchindelinAug 17, 2022
  175. Elijah NewrenAug 17, 2022
  176. Junio C HamanoAug 17, 2022
  177. Ævar Arnfjörð BjarmasonAug 18, 2022
  178. Junio C HamanoAug 18, 2022
  179. Elijah NewrenAug 19, 2022
  180. Ævar Arnfjörð BjarmasonAug 19, 2022
  181. Elijah NewrenAug 19, 2022
  182. Junio C HamanoAug 17, 2022
  183. Johannes SchindelinAug 16, 2022
  184. Phillip WoodAug 16, 2022
  185. Ævar Arnfjörð BjarmasonAug 17, 2022
  186. Ævar Arnfjörð BjarmasonAug 18, 2022
  187. 09/14 merge-recursive: move better_branch_name() to merge.cAlban Gruin, Aug 9, 2022
  188. 11/14 merge: use the "resolve" strategy without forkingAlban Gruin, Aug 9, 2022
  189. Junio C HamanoAug 13, 2022
  190. 10/14 merge-octopus: rewrite in CAlban Gruin, Aug 9, 2022
  191. 13/14 sequencer: use the "resolve" strategy without forkingAlban Gruin, Aug 9, 2022
  192. 12/14 merge: use the "octopus" strategy without forkingAlban Gruin, Aug 9, 2022
  193. 14/14 sequencer: use the "octopus" strategy without forkingAlban Gruin, Aug 9, 2022
  194. 00/12 merge-index: prepare to rewrite merge drivers in CÆvar Arnfjörð Bjarmason, Nov 18, 2022
  195. 01/12 merge-index doc & -h: fix padding, labels and "()" useÆvar Arnfjörð Bjarmason, Nov 18, 2022
  196. 03/12 t6060: add tests for removed filesÆvar Arnfjörð Bjarmason, Nov 18, 2022
  197. 02/12 t6060: modify multiple files to expose a possible issue with merge-indexÆvar Arnfjörð Bjarmason, Nov 18, 2022
  198. 05/12 merge-index: migrate to parse_options() APIÆvar Arnfjörð Bjarmason, Nov 18, 2022
  199. 07/12 merge-index i18n: mark die() messages for translationÆvar Arnfjörð Bjarmason, Nov 18, 2022
  200. 04/12 merge-index tests: add usage testsÆvar Arnfjörð Bjarmason, Nov 18, 2022
  201. 06/12 merge-index: improve die() error messagesÆvar Arnfjörð Bjarmason, Nov 18, 2022
  202. 08/12 merge-index: stop calling ensure_full_index() twiceÆvar Arnfjörð Bjarmason, Nov 18, 2022
  203. 10/12 merge-index: libify merge_one_path() and merge_all()Ævar Arnfjörð Bjarmason, Nov 18, 2022
  204. 09/12 builtin/merge-index.c: don't USE_THE_INDEX_COMPATIBILITY_MACROSÆvar Arnfjörð Bjarmason, Nov 18, 2022
  205. 11/12 merge-index: use "struct strvec" and helper to prepare argsÆvar Arnfjörð Bjarmason, Nov 18, 2022
  206. 12/12 merge-index: make the argument parsing sensible & simplerÆvar Arnfjörð Bjarmason, Nov 18, 2022
  207. Taylor BlauNov 18, 2022
  208. Ævar Arnfjörð BjarmasonNov 19, 2022
  209. 00/12 merge-index: prepare to rewrite merge drivers in CÆvar Arnfjörð Bjarmason, Dec 15, 2022
  210. 01/12 merge-index doc & -h: fix padding, labels and "()" useÆvar Arnfjörð Bjarmason, Dec 15, 2022
  211. 02/12 t6060: modify multiple files to expose a possible issue with merge-indexÆvar Arnfjörð Bjarmason, Dec 15, 2022
  212. 03/12 t6060: add tests for removed filesÆvar Arnfjörð Bjarmason, Dec 15, 2022
  213. 04/12 merge-index tests: add usage testsÆvar Arnfjörð Bjarmason, Dec 15, 2022
  214. 05/12 merge-index: migrate to parse_options() APIÆvar Arnfjörð Bjarmason, Dec 15, 2022
  215. 06/12 merge-index: improve die() error messagesÆvar Arnfjörð Bjarmason, Dec 15, 2022
  216. 07/12 merge-index i18n: mark die() messages for translationÆvar Arnfjörð Bjarmason, Dec 15, 2022
  217. 08/12 merge-index: stop calling ensure_full_index() twiceÆvar Arnfjörð Bjarmason, Dec 15, 2022
  218. 09/12 builtin/merge-index.c: don't USE_THE_INDEX_VARIABLEÆvar Arnfjörð Bjarmason, Dec 15, 2022
  219. 10/12 merge-index: libify merge_one_path() and merge_all()Ævar Arnfjörð Bjarmason, Dec 15, 2022
  220. 11/12 merge-index: use "struct strvec" and helper to prepare argsÆvar Arnfjörð Bjarmason, Dec 15, 2022
  221. 12/12 merge-index: make the argument parsing sensible & simplerÆvar Arnfjörð Bjarmason, Dec 15, 2022

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.