git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2 v2] verify_filename: ask the caller to chose the kind of diagnosis

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 18, 2012, 22:25 UTC
Message-ID
<7vipeo2r7j.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1340043501-6170-2-git-send-email-Matthieu.Moy@imag.fr>
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Show 16 quoted lines
> verify_filename can be called in two different contexts. Either we just
> tried to interpret a string as an object name, and it fails, so we try
> looking for a working tree file as a fallback, or we _know_ that we are
> looking for a filename, and shouldn't even try interpreting the string as
> an object name.
>
> For example, with this change, we get:
>
>   $ git log COPYING HEAD:inexistant
>   fatal: HEAD:inexistant: no such path in the working tree.
>   Use '-- <path>...' to specify paths that do not exist locally.
>   $ git log HEAD:inexistant
>   fatal: Path 'inexistant' does not exist in 'HEAD'
>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
Thanks; both patches look sensible (modulo minor nits below).
Will queue with a local fix-up.
Show 9 quoted lines
> @@ -80,14 +86,28 @@ static void NORETURN die_verify_filename(const char *prefix, const char *arg)
>   * as true, because even if such a filename were to exist, we want
>   * it to be preceded by the "--" marker (or we want the user to
>   * use a format like "./-filename")
> + *
> + * The "diagnose_misspelt_rev" is used to provide a user-friendly
> + * diagnosis. If 0, the diagnosis will try to diagnose "name" as an
> + * invalid object name (e.g. HEAD:foo). If non-zero, the diagnosis
> + * will only complain about an inexisting file.
I have a feeling that "if 0/if non-zero" above are backwards.
Previous: Matthieu MoyNext: Matthieu Moy
Message 10 of 16 in “"Detailed diagnosis" perhaps broken”
  1. Junio C HamanoJun 15, 2012
  2. Matthieu MoyJun 17, 2012
  3. 1/2 sha1_name: don't trigger detailed diagnosis for file argumentsMatthieu Moy, Jun 17, 2012
  4. 2/2 verify_filename: ask the caller to chose the kind of diagnosisMatthieu Moy, Jun 17, 2012
  5. Junio C HamanoJun 17, 2012
  6. Matthieu MoyJun 18, 2012
  7. Junio C HamanoJun 18, 2012
  8. 1/2 sha1_name: don't trigger detailed diagnosis for file argumentsMatthieu Moy, Jun 18, 2012
  9. 2/2 verify_filename: ask the caller to chose the kind of diagnosisMatthieu Moy, Jun 18, 2012
  10. Junio C HamanoJun 18, 2012
  11. Matthieu MoyJun 19, 2012
  12. Junio C HamanoJun 18, 2012
  13. Matthieu MoyJun 18, 2012
  14. Junio C HamanoJun 18, 2012
  15. Matthieu MoyJun 18, 2012
  16. Junio C HamanoJun 18, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.