Re: Bug? clone ignores --git-dir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 26, 2019 at 11:07:27AM -0700, Jack Bates wrote:

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

This is the expected behavior. "clone" and "init" are special in that
they are creating _new_ repositories, so they explicitly ignore the
any notion of the current repository.

I'm not quite sure what you're trying to do. I'd think:

  git clone --bare repository git-dir

would do what you want, but then I'm not sure why you're specifying
"directory" in the first place, or what you expect to happen. Are you
looking for clone's --separate-git-dir option, perhaps?

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux