Re: [RFC/PATCH 1/2] improve missing repository error message

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [RFC/PATCH 1/2] improve missing repository error message

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:46:19

Jeff King [off-list ref] writes:
+		die("'%s' does not appear to be a git repository", dir);
It may be sensible to distinguish the case where dir exists as a
directory but isn't a repository, and the case where it does not exist
at all, like "directory exists but does not appear to be a git
repository" Vs "no such directory".

Just in case someone does a "mkdir" on the server and doesn't know he
has to "git init" there too.

My 2 cents,

-- 
Matthieu

Re: [RFC/PATCH 1/2] improve missing repository error message

From: Jeff King <hidden>
Date: 2016-06-15 22:46:19

On Wed, Mar 04, 2009 at 10:19:25AM +0100, Matthieu Moy wrote:
quoted
+		die("'%s' does not appear to be a git repository", dir);
It may be sensible to distinguish the case where dir exists as a
directory but isn't a repository, and the case where it does not exist
at all, like "directory exists but does not appear to be a git
repository" Vs "no such directory".

Just in case someone does a "mkdir" on the server and doesn't know he
has to "git init" there too.
I agree it would be nice to be more descriptive; however, it's not quite
as simple as checking if the chdir failed. For "non-strict" repo lookup,
we check a number of variants. For $foo, we check:

  $foo.git/.git
  $foo/.git
  $foo.git
  $foo

If $foo exists but isn't a git directory, but $foo/.git does not exist,
then what is the correct response?  I guess we can say "no such
directory" only if $foo and $foo.git don't exist, and "not a git
repository" for the others.

I also don't know if we care about information leakage; with such a
patch can I now start probing the existence of arbitrary directories via
git-daemon (I haven't checked to see if there are other path
restrictions in place)?

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help