On Thu, Jul 17, 2014 at 01:27:08AM -0700, Yue Lin Ho wrote:
> I see that refresh() of update_index.c calls setup_work_tree() to change dir
> to working tree.
> And the dir is not changed back to git dir before commit_lock_file() or
> rollback_lock_file() is called.
> So, commit_lock_file() rename file failed.
> or rollback_lock_file() delete file failed.

I think you're on the right track. Although the problem is
hold_locked_index() in cmd_update_index() when the index path is
relative. After setup_work_tree(), the saved path points to a wrong
place and can't be unlinked anymore.

This patch seems to fix it

-- 8< --
diff --git a/lockfile.c b/lockfile.c
index 2a800ce..69fe837 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -264,7 +264,8 @@ int commit_lock_file(struct lock_file *lk)
 int hold_locked_index(struct lock_file *lk, int die_on_error)
-       return hold_lock_file_for_update(lk, get_index_file(),
+       return hold_lock_file_for_update(lk,
+                                        absolute_path(get_index_file()),
                                         ? LOCK_DIE_ON_ERROR
                                         : 0);
-- 8< --

We could turn all lockfile's path absolute when setup_work_tree()
moves pwd, but that seems dangerous without looking through how all
lockfiles are used.

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to