From 33a798c880f9a8bed1fe95531349e5e5ef1e0cd2 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 6 Aug 2007 00:20:06 -0700 Subject: setup.c:verify_non_filename(): don't die unnecessarily while disambiguating If you have a working tree _file_ "foo", attempt to refer to a branch "foo/bar" without -- to disambiguate, like this: $ git log foo/bar tried to make sure that foo/bar cannot be naming a working tree file "foo/bar" (in which case we would say "which one do you want? A rev or a working tree file? clarify with -- please"). We run lstat("foo/bar") to check that. If it does not succeed, there is no ambiguity. That is good. But we also checked the error status for the lstat() and expected it to fail with ENOENT. In this particular case, however, it fails with ENOTDIR. That should be treated as "expected error" as well. Signed-off-by: Junio C Hamano diff --git a/setup.c b/setup.c index a45ea83..2b8e8c0 100644 --- a/setup.c +++ b/setup.c @@ -103,7 +103,7 @@ void verify_non_filename(const char *prefix, const char *arg) if (!lstat(name, &st)) die("ambiguous argument '%s': both revision and filename\n" "Use '--' to separate filenames from revisions", arg); - if (errno != ENOENT) + if (errno != ENOENT && errno != ENOTDIR) die("'%s': %s", arg, strerror(errno)); } -- cgit v0.10.2-6-g49f6 From 93969438dca50c7f0039fcf35e7ab82776d4122f Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 4 Aug 2007 21:48:08 -0700 Subject: apply: remove directory that becomes empty by renaming the last file away We attempt to remove directory that becomes empty after removal of a file. We should do the same when we rename an existing file away. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano diff --git a/builtin-apply.c b/builtin-apply.c index 490e23e..9ee9393 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -2489,7 +2489,7 @@ static void write_out_one_result(struct patch *patch, int phase) * thing: remove the old, write the new */ if (phase == 0) - remove_file(patch, 0); + remove_file(patch, patch->is_rename); if (phase == 1) create_file(patch); } -- cgit v0.10.2-6-g49f6