RE: [EXTERNAL] Re: Error handling when giving empty command line arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> The user is not giving enough information to Git to allow it to tell if "git fetch ''" it got came from any of these with unset variable:
>
>	$ git fetch "$path"
>	$ git fetch "$url"
>	$ git fetch "$force"
>
> because all Git sees is an empty string.
>
> It is unfair to complain "is completely unrelated".  The user didn't give enough information to even allow Git to tell if it is or is not related.

That is exactly my point! I was thinking along the lines that perhaps the Git command(s) could complain about that it got an empty string as an argument since that is probably a mistake by the user due to that an empty string is neither a path, a URL/URI, or an option. It is thus an error case of its own.


The git checkout command actually complains about the case when you give it an empty string

$ git checkout "" feature/foobar
fatal: empty string is not a valid pathspec. please use . instead if you want to match all paths


When it comes to git fetch it could assume that the given empty string is either a path or a URL/URI and write a similar error message. For instance

$ git fetch ""
fatal: empty string is not a valid pathspec or URL; see 'git help fetch' for valid syntax

For me there is an important distinction between "no path specified" and "empty string". The former says that an argument is missing and the latter says that an argument is indeed given but it is an empty string.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux