{"thread":{"id":"9402","subject":"[PATCH] setup.c:verify_non_filename(): don't die unnecessarily while disambiguating","startedAt":"2007-08-06T07:24:12Z","lastAt":"2007-08-06T08:03:01Z","messageCount":2,"participants":["Junio C Hamano","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"49989","messageId":"7vk5s9dt2b.fsf@assigned-by-dhcp.cox.net","threadId":"9402","inReplyTo":null,"subject":"[PATCH] setup.c:verify_non_filename(): don't die unnecessarily while disambiguating","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-06T07:24:12Z","receivedAt":"2007-08-06T07:24:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"If you have a working tree _file_ \"foo\", attempt to refer to a\nbranch \"foo/bar\" without -- to disambiguate, like this:\n\n\t$ git log foo/bar\n\ntried to make sure that foo/bar cannot be naming a working tree\nfile \"foo/bar\" (in which case we would say \"which one do you\nwant?  A rev or a working tree file?  clarify with -- please\").\nWe run lstat(\"foo/bar\") to check that.  If it does not succeed,\nthere is no ambiguity.\n\nThat is good.  But we also checked the error status for the\nlstat() and expected it to fail with ENOENT.  For this\nparticular case, however, it fails with ENOTDIR.  That one\nshould be treated as \"expected error\" as well.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * This was from a real-life experience Shawn had.\n\n setup.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex a45ea83..2b8e8c0 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -103,7 +103,7 @@ void verify_non_filename(const char *prefix, const char *arg)\n \tif (!lstat(name, &st))\n \t\tdie(\"ambiguous argument '%s': both revision and filename\\n\"\n \t\t    \"Use '--' to separate filenames from revisions\", arg);\n-\tif (errno != ENOENT)\n+\tif (errno != ENOENT && errno != ENOTDIR)\n \t\tdie(\"'%s': %s\", arg, strerror(errno));\n }\n \n-- \n1.5.3.rc4.15.ga2c3d\n"},{"id":"49992","messageId":"20070806080301.GL9527@spearce.org","threadId":"9402","inReplyTo":"7vk5s9dt2b.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] setup.c:verify_non_filename(): don't die unnecessarily while disambiguating","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-08-06T08:03:01Z","receivedAt":"2007-08-06T08:03:01Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> If you have a working tree _file_ \"foo\", attempt to refer to a\n> branch \"foo/bar\" without -- to disambiguate, like this:\n> \n> \t$ git log foo/bar\n> ---\n> \n>  * This was from a real-life experience Shawn had.\n\nAck.  I have done this many times, and every time I thought I was\ngoing nuts.  Until Junio found this bug tonight.  Many thanks.\n\n-- \nShawn.\n"}]}