Skip to content

Commit

Permalink
setup.c:verify_non_filename(): don't die unnecessarily while disambig…
Browse files Browse the repository at this point in the history
…uating

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 <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Aug 6, 2007
1 parent 4e0b2bb commit 33a798c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

0 comments on commit 33a798c

Please sign in to comment.