All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olsson John <john.olsson@saabgroup.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: RE: [EXTERNAL] Re: Error handling when giving empty command line arguments
Date: Wed, 25 May 2022 07:32:18 +0000	[thread overview]
Message-ID: <8767dbe0c22540a4ab3e18684aa7e030@saabgroup.com> (raw)
In-Reply-To: <xmqq35gyee7r.fsf@gitster.g>

> 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.


  reply	other threads:[~2022-05-25  7:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24 13:25 Error handling when giving empty command line arguments Olsson John
2022-05-24 22:51 ` Junio C Hamano
2022-05-25  7:32   ` Olsson John [this message]
2022-05-25 15:46     ` [EXTERNAL] " Junio C Hamano
2022-05-25  4:41 ` Kevin Daudt
2022-05-25  7:03   ` [EXTERNAL] " Olsson John

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8767dbe0c22540a4ab3e18684aa7e030@saabgroup.com \
    --to=john.olsson@saabgroup.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.