Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
apply --cached: do not check newly added file in the working tree
author
Junio C Hamano
<junkio@cox.net>
Wed, 17 May 2006 23:56:13 +0000
(16:56 -0700)
committer
Junio C Hamano
<junkio@cox.net>
Wed, 17 May 2006 23:56:13 +0000
(16:56 -0700)
The --cached mode does not deal with the working tree, so we
should not check it with lstat. An earlier code omitted the
call to lstat but forgot to omit the check for the errno.
Signed-off-by: Junio C Hamano <junkio@cox.net>
apply.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
b762727
)
diff --git
a/apply.c
b/apply.c
index b3b9b40596ef4af5c2187b0d1227e17cadecd342..0ed9d132e88f52c678a4a64caf3b49d5bc04ee2e 100644
(file)
--- a/
apply.c
+++ b/
apply.c
@@
-1711,10
+1711,12
@@
static int check_patch(struct patch *patch)
if (new_name && (patch->is_new | patch->is_rename | patch->is_copy)) {
if (check_index && cache_name_pos(new_name, strlen(new_name)) >= 0)
return error("%s: already exists in index", new_name);
if (new_name && (patch->is_new | patch->is_rename | patch->is_copy)) {
if (check_index && cache_name_pos(new_name, strlen(new_name)) >= 0)
return error("%s: already exists in index", new_name);
- if (!cached && !lstat(new_name, &st))
- return error("%s: already exists in working directory", new_name);
- if (errno != ENOENT)
- return error("%s: %s", new_name, strerror(errno));
+ if (!cached) {
+ if (!lstat(new_name, &st))
+ return error("%s: already exists in working directory", new_name);
+ if (errno != ENOENT)
+ return error("%s: %s", new_name, strerror(errno));
+ }
if (!patch->new_mode) {
if (patch->is_new)
patch->new_mode = S_IFREG | 0644;
if (!patch->new_mode) {
if (patch->is_new)
patch->new_mode = S_IFREG | 0644;