aboutsummaryrefslogtreecommitdiff
path: root/git-apply-patch-script
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-04 10:45:36 -0700
committerJunio C Hamano <junkio@cox.net>2005-05-04 10:45:36 -0700
commit8a9d32b7e9f3aebd9c322c4613c4608224d09a60 (patch)
treed952b69c7ba71b0f5628166bfcc81abb67ed818f /git-apply-patch-script
parentb46f0b6dfd09629645efc59cda76e7e4fad7ca39 (diff)
downloadgit-8a9d32b7e9f3aebd9c322c4613c4608224d09a60.tar.gz
git-8a9d32b7e9f3aebd9c322c4613c4608224d09a60.tar.xz
When the patch tries to create a new file and the file exists, abort.
This fixes an error introduced to git-apply-patch-script in the previous round. We do not invoke patch for create/delete case, so we need to be a bit careful about detecting conflicts like this. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-apply-patch-script')
-rwxr-xr-xgit-apply-patch-script9
1 files changed, 9 insertions, 0 deletions
diff --git a/git-apply-patch-script b/git-apply-patch-script
index 29548ba6a..dccad2706 100755
--- a/git-apply-patch-script
+++ b/git-apply-patch-script
@@ -28,6 +28,15 @@ case "$mode1,$mode2" in
echo >&2 "cannot create leading path for $name."
exit 1
}
+ if test -f "$name"
+ then
+ echo >&2 "file $name to be created already exists."
+ exit 1
+ fi
+ cat "$tmp2" >"$name" || {
+ echo >&2 "cannot create $name."
+ exit 1
+ }
case "$mode2" in
+x)
echo >&2 "created $name with mode +x."