summaryrefslogtreecommitdiff
path: root/builtin-merge.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-10-09 10:19:23 -0700
committerShawn O. Pearce <spearce@spearce.org>2008-10-09 10:19:23 -0700
commit76c3fb1f844753c4186975a483943e1970b3c4e2 (patch)
tree3c454310228d1c2500fbb38c5b78eb473766680a /builtin-merge.c
parentc9618ff939aeb5e895d90c2478db989038eccc26 (diff)
parent668f26fff610605d112fbedffae79917de948893 (diff)
downloadgit-76c3fb1f844753c4186975a483943e1970b3c4e2.tar.gz
Merge branch 'mv/merge-refresh'
* mv/merge-refresh: builtin-merge: refresh the index before calling a strategy
Diffstat (limited to 'builtin-merge.c')
-rw-r--r--builtin-merge.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin-merge.c b/builtin-merge.c
index fa7c95472c..38266baf5f 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -546,6 +546,16 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
int i = 0, ret;
struct commit_list *j;
struct strbuf buf;
+ int index_fd;
+ struct lock_file *lock = xcalloc(1, sizeof(struct lock_file));
+
+ index_fd = hold_locked_index(lock, 1);
+ refresh_cache(REFRESH_QUIET);
+ if (active_cache_changed &&
+ (write_cache(index_fd, active_cache, active_nr) ||
+ commit_locked_index(lock)))
+ return error("Unable to write index.");
+ rollback_lock_file(lock);
if (!strcmp(strategy, "recursive") || !strcmp(strategy, "subtree")) {
int clean;