git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix overstrict :<path> diagnosis
@ 2011-05-10 18:10 Junio C Hamano
  2011-05-10 19:02 ` [PATCH] fix overslow :/no-such-string-ever-existed diagnostics Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2011-05-10 18:10 UTC (permalink / raw)
  To: git; +Cc: Matthieu Moy

Given "git log :", we get a disambiguation message that tries to be
helpful and yet totally misses the point, i.e.

    $ git log :
    fatal: Path '' does not exist (neither on disk nor in the index).
    $ git log :/
    fatal: Path '/' exists on disk, but not in the index.

An empty path nor anything that begins with '/' cannot possibly in the
index, and it is wrong to guess that the user might have meant to access
such an index entry.

It should yield the same error message as "git log '*.c'", i.e.

    $ git log '*.c'
    fatal: ambiguous argument '*.c': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * I actually think the message should say

 	fatal: ambiguous argument '*.c': neither a rev nor a path.
        Use '--' to separate pathspec from revisions.

   for brevity, but that is a separate topic.

 sha1_name.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sha1_name.c b/sha1_name.c
index faea58d..90d8bfa 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -1173,7 +1173,7 @@ int get_sha1_with_context_1(const char *name, unsigned char *sha1,
 			}
 			pos++;
 		}
-		if (!gently)
+		if (!gently && name[1] && name[1] != '/')
 			diagnose_invalid_index_path(stage, prefix, cp);
 		free(new_path);
 		return -1;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-10 23:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-10 18:10 [PATCH] fix overstrict :<path> diagnosis Junio C Hamano
2011-05-10 19:02 ` [PATCH] fix overslow :/no-such-string-ever-existed diagnostics Junio C Hamano
2011-05-10 19:05   ` Re* " Junio C Hamano
2011-05-10 20:41   ` Matthieu Moy
2011-05-10 23:11     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).