aboutsummaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-12-24 02:18:35 -0800
committerJunio C Hamano <junkio@cox.net>2006-12-24 02:18:35 -0800
commite036c90a913889dfa8097ebe73b619370e0c6f32 (patch)
tree2d910b13395345d9d9bc7c9137d1f6e9bb71d64a /merge-recursive.c
parent9def2138a17325c68961c3b1e6c967d33f28a4f1 (diff)
parente0ec18192db8a5f80705a81dfaa1caa3e6c48c1a (diff)
downloadgit-e036c90a913889dfa8097ebe73b619370e0c6f32.tar.gz
git-e036c90a913889dfa8097ebe73b619370e0c6f32.tar.xz
Merge branch 'sb/merge-friendly'
* sb/merge-friendly: Display 'theirs' branch name when possible in merge. Use extended SHA1 syntax in merge-recursive conflicts.
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index ae7ae4cd2..ca4f19e34 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -649,8 +649,8 @@ static struct merge_file_info merge_file(struct diff_filespec *o,
char *name1, *name2;
int merge_status;
- name1 = xstrdup(mkpath("%s/%s", branch1, a->path));
- name2 = xstrdup(mkpath("%s/%s", branch2, b->path));
+ name1 = xstrdup(mkpath("%s:%s", branch1, a->path));
+ name2 = xstrdup(mkpath("%s:%s", branch2, b->path));
fill_mm(o->sha1, &orig);
fill_mm(a->sha1, &src1);
@@ -1263,6 +1263,18 @@ static struct commit *get_ref(const char *ref)
return (struct commit *)object;
}
+static const char *better_branch_name(const char *branch)
+{
+ static char githead_env[8 + 40 + 1];
+ char *name;
+
+ if (strlen(branch) != 40)
+ return branch;
+ sprintf(githead_env, "GITHEAD_%s", branch);
+ name = getenv(githead_env);
+ return name ? name : branch;
+}
+
int main(int argc, char *argv[])
{
static const char *bases[2];
@@ -1293,11 +1305,14 @@ int main(int argc, char *argv[])
branch1 = argv[++i];
branch2 = argv[++i];
- printf("Merging %s with %s\n", branch1, branch2);
h1 = get_ref(branch1);
h2 = get_ref(branch2);
+ branch1 = better_branch_name(branch1);
+ branch2 = better_branch_name(branch2);
+ printf("Merging %s with %s\n", branch1, branch2);
+
if (bases_count == 1) {
struct commit *ancestor = get_ref(bases[0]);
clean = merge(h1, h2, branch1, branch2, 0, ancestor, &result);