summaryrefslogtreecommitdiff
path: root/builtin-merge.c
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2008-10-03 15:02:31 +0200
committerShawn O. Pearce <spearce@spearce.org>2008-10-03 08:01:46 -0700
commit668f26fff610605d112fbedffae79917de948893 (patch)
tree4251bf2b3f245dc1e58e68483f9d93387cde599e /builtin-merge.c
parent52e8370bc7a71366b664ece0a9ec0b79d673a356 (diff)
downloadgit-668f26fff610605d112fbedffae79917de948893.tar.gz
builtin-merge: refresh the index before calling a strategy
In case a file is touched but has no real changes then we just have to update the index and should not error out. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
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 5c65a58699..afa01c659e 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -547,6 +547,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;