summaryrefslogtreecommitdiff
path: root/builtin-merge.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-08-24 14:48:36 -0700
committerJunio C Hamano <gitster@pobox.com>2008-08-24 14:50:44 -0700
commit49d3536594e653717844d53825fa7c0a494888f7 (patch)
tree35022ab151934461b2a9f21cce140b5a773369c6 /builtin-merge.c
parent98fcf840af443a0a93b9a6cd1fada5af826383f3 (diff)
parent5760a6b094736e6f59eb32c7abb4cdbb7fca1627 (diff)
downloadgit-49d3536594e653717844d53825fa7c0a494888f7.tar.gz
Merge branch 'maint' to sync with 1.6.0.1
Diffstat (limited to 'builtin-merge.c')
-rw-r--r--builtin-merge.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/builtin-merge.c b/builtin-merge.c
index 7759a0b1e9..0bff26e833 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -564,8 +564,6 @@ static int checkout_fast_forward(unsigned char *head, unsigned char *remote)
struct dir_struct dir;
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
- if (read_cache_unmerged())
- die("you need to resolve your current index first");
refresh_cache(REFRESH_QUIET);
fd = hold_locked_index(lock_file, 1);
@@ -651,13 +649,15 @@ static void add_strategies(const char *string, unsigned attr)
static int merge_trivial(void)
{
unsigned char result_tree[20], result_commit[20];
- struct commit_list parent;
+ struct commit_list *parent = xmalloc(sizeof(struct commit_list *));
write_tree_trivial(result_tree);
printf("Wonderful.\n");
- parent.item = remoteheads->item;
- parent.next = NULL;
- commit_tree(merge_msg.buf, result_tree, &parent, result_commit);
+ parent->item = lookup_commit(head);
+ parent->next = xmalloc(sizeof(struct commit_list *));
+ parent->next->item = remoteheads->item;
+ parent->next->next = NULL;
+ commit_tree(merge_msg.buf, result_tree, parent, result_commit);
finish(result_commit, "In-index merge");
drop_save();
return 0;
@@ -743,6 +743,7 @@ static int evaluate_result(void)
int cnt = 0;
struct rev_info rev;
+ discard_cache();
if (read_cache() < 0)
die("failed to read the cache");
@@ -776,7 +777,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
struct commit_list **remotes = &remoteheads;
setup_work_tree();
- if (unmerged_cache())
+ if (read_cache_unmerged())
die("You are in the middle of a conflicted merge.");
/*
@@ -1078,6 +1079,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
}
/* Automerge succeeded. */
+ discard_cache();
write_tree_trivial(result_tree);
automerge_was_ok = 1;
break;