summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 21a08dc)
raw | patch | inline | side by side (parent: 21a08dc)
author | Junio C Hamano <junkio@cox.net> | |
Sun, 1 May 2005 16:33:12 +0000 (09:33 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Sun, 1 May 2005 16:33:12 +0000 (09:33 -0700) |
I found this during a conflict merge testing. The original did
not have either DF (a file) or DF/DF (a file DF/DF under a
directory DF). One side created DF, the other created DF/DF. I
first resolved DF as a new file by taking what the first side
did. After that, the entry DF/DF cannot be resolved by running
git-update-cache --remove although it does not exist on the
filesystem.
$ /bin/ls -F
AN DF MN NM NN SS Z/
$ git-ls-files --stage | grep DF
100644 71420ab81e254145d26d6fc0cddee64c1acd4787 0 DF
100644 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 2 DF/DF
$ git-update-cache --remove DF/DF
fatal: Unable to add DF/DF to database
It turns out that the errno from open() in this case was not
ENOENT but ENOTDIR, which the code did not check. Here is a
fix.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
not have either DF (a file) or DF/DF (a file DF/DF under a
directory DF). One side created DF, the other created DF/DF. I
first resolved DF as a new file by taking what the first side
did. After that, the entry DF/DF cannot be resolved by running
git-update-cache --remove although it does not exist on the
filesystem.
$ /bin/ls -F
AN DF MN NM NN SS Z/
$ git-ls-files --stage | grep DF
100644 71420ab81e254145d26d6fc0cddee64c1acd4787 0 DF
100644 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 2 DF/DF
$ git-update-cache --remove DF/DF
fatal: Unable to add DF/DF to database
It turns out that the errno from open() in this case was not
ENOENT but ENOTDIR, which the code did not check. Here is a
fix.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
update-cache.c | patch | blob | history |
diff --git a/update-cache.c b/update-cache.c
index 16e1bb9aea6413db35039042289605124d759501..5dda89a93e722640ac5ff855374a82143e9f29a4 100644 (file)
--- a/update-cache.c
+++ b/update-cache.c
fd = open(path, O_RDONLY);
if (fd < 0) {
- if (errno == ENOENT) {
+ if (errno == ENOENT || errno == ENOTDIR) {
if (allow_remove)
return remove_file_from_cache(path);
}