On Friday, August 16, 2013 6:04:29 PM UTC+2, Dale Worley wrote:

> Using Git (1.7.7.6), it appears that if I run "git diff" in a 
> directory that is not part of a Git working copy, it produces this 
> error message: 
>
>     $ git diff 
>     usage: git diff [--no-index] <path> <path> 
>     $ 
>
> 1) This message doesn't tell the user what went wrong.  (Indeed, 
> invoking "git diff" with no arguments is valid in a working copy.) 
>
> 2) The usage message is incorrect, in that the manual page lists four 
> fundamental invocation formats: 
>
>        git diff [options] [<commit>] [--] [<path>...] 
>        git diff [options] --cached [<commit>] [--] [<path>...] 
>        git diff [options] <commit> <commit> [--] [<path>...] 
>        git diff [options] [--no-index] [--] <path> <path> 
>
> Am I correct here? 
>
> Dale 
>


Well, I wouldn't say it's wrong. Given that there is no Git repository, and 
hence no index, it assumes that it's running in --no-index mode, that is, 
the 4th format. Quoting the docs:

"If exactly two paths are given and at least one points outside the current 
repository, git diff will compare the two files/directories. This behavior 
can be forced by --no-index."

Perhaps this could have been stated in the docs. I find them a bit hard to 
read too, as with any git command that can work in many different ways. I 
am sure the git-devs would appreciate some concrete ideas for how the docs 
and error messages can be changed. Here's how to get in touch with them if 
you feel up to it: https://gist.github.com/tfnico/4441562

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to