diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2008-10-09 10:19:23 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2008-10-09 10:19:23 -0700 |
commit | 76c3fb1f844753c4186975a483943e1970b3c4e2 (patch) | |
tree | 3c454310228d1c2500fbb38c5b78eb473766680a /builtin-merge.c | |
parent | c9618ff939aeb5e895d90c2478db989038eccc26 (diff) | |
parent | 668f26fff610605d112fbedffae79917de948893 (diff) | |
download | git-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.c | 10 |
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; |