Re: [PATCH] clone: forbid --bare --separate-git-dir <dir>
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Jan 6, 2013, 10:19 UTC
- Message-ID
- <20130106101948.GD10956@elie.Belkin>
- In-Reply-To
- <1357465670-32766-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy wrote:
Show 5 quoted lines
> --separate-git-dir was added to clone with the repository away from > standard position <worktree>/.git. It does not make sense to use it > without creating working directory. > > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
The patch correctly implements the above. The description leaves out detail. I'd say something like
The --separate-git-dir option was introduced to make it simple to put the git directory somewhere outside the worktree, for example when cloning a repository for use as a submodule.
It was not intended for use when creating a bare repository. In that case there is no worktree and it is more natural to directly clone the repository and create a .git file as separate steps:
git clone --bare /path/to/repo.git bar.git printf 'gitdir: bar.git\n' >foo.git
Unfortunately we forgot to forbid the --bare --separate-git-dir combination. In practice, we know no one could be using --bare with --separate-git-dir because it is broken in the following way: <explanation here>. So it is safe to make good on our mistake and forbid the combination, making the command easier to explain.
I don't know what would go in the <explanation here> blank above, though. Is it possible that some people are relying on this option combination?