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

Bug? clone ignores --git-dir

From
JBJack Bates <bk874k@nottheoilrig.com>
Date
Nov 26, 2019, 18:07 UTC
Message-ID
<7d28416e-c927-4cd3-bac2-d8bfd02ce949@nottheoilrig.com>

If you `git rebase --exec 'gulp runtests-parallel --runners user'` this project, the tests perform Git operations on various subprojects [1], but because Git exports `GIT_DIR` and `GIT_WORK_TREE`, they end up operating on the parent project instead.

Adding `--git-dir` and `--work-tree` overrides `GIT_DIR` and `GIT_WORK_TREE` [2], forcing the tests to operate on the correct repositories, however `clone` ignores `--git-dir`:

> git init repository
> git --git-dir git-dir clone repository directory

I'd expect Git to create a directory `git-dir` and put the index, etc. there, but instead it creates `directory/.git`, as usual. I'm not sure if this is a bug or the expected behavior?

[1] https://github.com/microsoft/TypeScript/blob/master/src/testRunner/externalCompileRunner.ts#L58 [2] https://github.com/microsoft/TypeScript/pull/35362

Next: Jeff King
Message 1 of 4 in “Bug? clone ignores --git-dir”
  1. Jack BatesNov 26, 2019
  2. Jeff KingNov 27, 2019
  3. Junio C HamanoNov 27, 2019
  4. Jack BatesNov 27, 2019

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.