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

Re: [PATCH] More readable 'Not a git repository' messages

From
Ralf Ebert <info@ralfebert.de>
Date
Aug 9, 2010, 22:44 UTC
Message-ID
<i3q0d8$m8f$1@dough.gmane.org>
In-Reply-To
<AANLkTinttmKi4+EbE54r-GeRbN3_2wxUHu_qJMn5Nysn@mail.gmail.com>
Hi Duy,
Show 11 quoted lines
> How about this and avoid adding cwd_orig?
>
> -                               cwd[offset] = '\0';
> -                               die("Not a git repository (or any
> parent up to mount parent %s)\n"
> -                               "Stopping at filesystem boundary
> (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).", cwd);
> +                               die("Not in a git repository: %s\n"
> +                               "(stopped searching at %.*s because "
> +                               "GIT_DISCOVERY_ACROSS_FILESYSTEM is
> not set)", cwd, offset, cwd);

this code is inside a loop that goes up in the directory hierarchy. So cwd[offset] = '\0' does not only happen once before dying. Maybe it could be done without copying but I thought keeping a copy of the unaltered path might be more readable.

-- Ralf

Previous: Nguyen Thai Ngoc DuyNext: Jonathan Nieder
Message 3 of 13 in “More readable 'Not a git repository' messages”
  1. More readable 'Not a git repository' messagesRalf Ebert, Aug 9, 2010
  2. Nguyen Thai Ngoc DuyAug 9, 2010
  3. Ralf EbertAug 9, 2010
  4. Jonathan NiederAug 9, 2010
  5. Ralf EbertAug 9, 2010
  6. Nguyen Thai Ngoc DuyAug 10, 2010
  7. Sverre RabbelierAug 10, 2010
  8. Jared HanceAug 10, 2010
  9. Joshua JuranAug 10, 2010
  10. More readable 'Not a git repository' messagesRalf Ebert, Aug 13, 2010
  11. Joshua JuranAug 13, 2010
  12. setup.c: Improve 'Not a git repository' messagesRalf Ebert, Aug 15, 2010
  13. Jonathan NiederAug 15, 2010

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.