summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 52e8370)
raw | patch | inline | side by side (parent: 52e8370)
author | Miklos Vajna <vmiklos@frugalware.org> | |
Fri, 3 Oct 2008 13:02:31 +0000 (15:02 +0200) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 3 Oct 2008 15:01:46 +0000 (08:01 -0700) |
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>
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>
builtin-merge.c | patch | blob | history | |
t/t7600-merge.sh | patch | blob | history |
diff --git a/builtin-merge.c b/builtin-merge.c
index 5c65a5869900ad1a1014fb3aad88c874a5410bf7..afa01c659e4a6c6727639ca528265cbb92dfe14c 100644 (file)
--- 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;
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 9516f541e9c47f83fed2fc8d3baa065a9bb206de..7313ac278cb7cb1d741e49f261e65d929ddeffb7 100755 (executable)
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
test_debug 'gitk --all'
+test_expect_success 'refresh the index before merging' '
+ git reset --hard c1 &&
+ sleep 1 &&
+ touch file &&
+ git merge c3
+'
+
+test_debug 'gitk --all'
+
test_done