summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8bc5c04)
raw | patch | inline | side by side (parent: 8bc5c04)
author | Junio C Hamano <junkio@cox.net> | |
Sat, 4 Feb 2006 06:04:14 +0000 (22:04 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 7 Feb 2006 05:43:27 +0000 (21:43 -0800) |
A new flag --aggressive resolves what we traditionally resolved
with external git-merge-one-file inside index while read-tree
3-way merge works.
git-merge-octopus and git-merge-resolve use this flag before
running git-merge-index with git-merge-one-file.
Signed-off-by: Junio C Hamano <junkio@cox.net>
with external git-merge-one-file inside index while read-tree
3-way merge works.
git-merge-octopus and git-merge-resolve use this flag before
running git-merge-index with git-merge-one-file.
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-merge-octopus.sh | patch | blob | history | |
git-merge-resolve.sh | patch | blob | history | |
read-tree.c | patch | blob | history |
diff --git a/git-merge-octopus.sh b/git-merge-octopus.sh
index eb74f96e81b4980f395944da46602e29555fc6db..eb3f473d5a3ac2a894503c1a7601b763548f8722 100755 (executable)
--- a/git-merge-octopus.sh
+++ b/git-merge-octopus.sh
NON_FF_MERGE=1
echo "Trying simple merge with $SHA1"
- git-read-tree -u -m $common $MRT $SHA1 || exit 2
+ git-read-tree -u -m --aggressive $common $MRT $SHA1 || exit 2
next=$(git-write-tree 2>/dev/null)
if test $? -ne 0
then
diff --git a/git-merge-resolve.sh b/git-merge-resolve.sh
index 966e81ff7d353beb15ac2c9ed9a50a1ea45c876c..0a8ef216cb8a45df7f900a0c9698bec3e4bb47bb 100755 (executable)
--- a/git-merge-resolve.sh
+++ b/git-merge-resolve.sh
fi
git-update-index --refresh 2>/dev/null
-git-read-tree -u -m $bases $head $remotes || exit 2
+git-read-tree -u -m --aggressive $bases $head $remotes || exit 2
echo "Trying simple merge."
if result_tree=$(git-write-tree 2>/dev/null)
then
diff --git a/read-tree.c b/read-tree.c
index a46c6fe2f5d3234abe5dce0b7a9d44da07b6dae9..5580f15ba2c89f9fd1ed35de0b0183487d024bf8 100644 (file)
--- a/read-tree.c
+++ b/read-tree.c
static int index_only = 0;
static int nontrivial_merge = 0;
static int trivial_merges_only = 0;
+static int aggressive = 0;
static int head_idx = -1;
static int merge_size = 0;
int df_conflict_remote = 0;
int any_anc_missing = 0;
+ int no_anc_exists = 1;
int i;
for (i = 1; i < head_idx; i++) {
if (!stages[i])
any_anc_missing = 1;
+ else
+ no_anc_exists = 0;
}
index = stages[0];
if (!head && !remote && any_anc_missing)
return 0;
+ /* Under the new "aggressive" rule, we resolve mostly trivial
+ * cases that we historically had git-merge-one-file resolve.
+ */
+ if (aggressive) {
+ int head_deleted = !head && !df_conflict_head;
+ int remote_deleted = !remote && !df_conflict_remote;
+ /*
+ * Deleted in both.
+ * Deleted in one and unchanged in the other.
+ */
+ if ((head_deleted && remote_deleted) ||
+ (head_deleted && remote && remote_match) ||
+ (remote_deleted && head && head_match))
+ return 0;
+
+ /*
+ * Added in both, identically.
+ */
+ if (no_anc_exists && head && remote && same(head, remote))
+ return merged_entry(head, index);
+
+ }
+
/* Below are "no merge" cases, which require that the index be
* up-to-date to avoid the files getting overwritten with
* conflict resolution files.
continue;
}
+ if (!strcmp(arg, "--aggressive")) {
+ aggressive = 1;
+ continue;
+ }
+
/* "-m" stands for "merge", meaning we start in stage 1 */
if (!strcmp(arg, "-m")) {
if (stage || merge)