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

Re: Bug: All git operations fail when .git contains a non-existent gitdir

From
TCTom Cook <tom.k.cook@gmail.com>
Date
Aug 31, 2021, 14:16 UTC
Message-ID
<CAFSh4UynPZ9YvS=_RZX2Grr38h=Ly2D830Q1XXJ0yqUj7z8GgA@mail.gmail.com>
In-Reply-To
<CAJDDKr7vXRxhwuTN=xFxqQkt_zt_Hpi3bYfc7rotcUAFjau9Sg@mail.gmail.com>
On Mon, Aug 30, 2021 at 1:38 AM David Aguilar <davvid@gmail.com> wrote:
Show 11 quoted lines
> I hope that helps and maybe sparks an idea that you can run with. I
> certainly don't mean it to be a dismissive, "go change your setup"
> kind of advice, but it would be interesting to know more details since
> it seems like achieving correctness is going to require doing that
> based on the limited information in this thread about the specifics of
> the setup.
>
> Also, I wouldn't be surprised if, even after the "git ls-remote"
> robustness fixes are applied, you'll just stumble onto the next git
> command that can only be resolved by mapping in the parent repo's .git
> directory.

We map the source code into a build tree in order to build executables. We don't expect to be using git on that build tree. But one of our executables is written in go and uses go modules. In our situation, `go mod download` was trying to use `git ls-remote` to inspect dependencies before downloading them with `git clone`, swallowing the git error and then dying horribly on something else that appeared to be unrelated. I raised a related bug report on `go` (I think I linked it elsewhere in this thread). So for us, easily the worst thing about these two related bugs was just figuring out what was wrong in the first place, and the go bug was definitely more severe than the git bug.

We could modify our build system to make the git local repo valid but there just doesn't seem any point - we never do anything to the local repo in the build tree. The next engineer who comes along and looks at our build system would inevitably ask why on earth we need to make git work in the build tree and it would be a fair question.

As an end user, it still appears to make little sense for a git operation that will complete happily with no local git repo at all and which doesn't depend on the local repo in any way to nonetheless die because the local repo is not valid. As a software engineer I can see why it's that way but as a user it's unhelpful.

Regards, Tom

Previous: David Aguilar
Message 17 of 17 in “Bug: All git operations fail when .git contains a non-existent gitdir”
  1. Tom CookJul 21, 2021
  2. brian m. carlsonJul 21, 2021
  3. Tom CookJul 22, 2021
  4. setup: only die on invalid .git under RUN_SETUPÆvar Arnfjörð Bjarmason, Jul 22, 2021
  5. Junio C HamanoJul 22, 2021
  6. Ævar Arnfjörð BjarmasonJul 22, 2021
  7. Junio C HamanoJul 23, 2021
  8. Tom CookJul 23, 2021
  9. Andrei RybakJul 22, 2021
  10. Ævar Arnfjörð BjarmasonJul 23, 2021
  11. Junio C HamanoJul 23, 2021
  12. Atharva RaykarJul 23, 2021
  13. Tom CookJul 23, 2021
  14. Ævar Arnfjörð BjarmasonJul 23, 2021
  15. Atharva RaykarJul 23, 2021
  16. David AguilarAug 30, 2021
  17. Tom CookAug 31, 2021

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.