Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file

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

 



Nguyán ThÃi Ngác Duy  <pclouds@xxxxxxxxx> writes:

> Instead of creating the repository at $GIT_DIR, --real-git-dir will
> tell git to put the repository there, then make $GIT_DIR a .git file
> that points to --real-git-dir.

Just like you, I am also bad at naming things, so I cannot offhand suggest
a better name, even though I _know_ --real-git-dir sounds horrible.

The naming aside, the feature is what we have wanted to have for a long
time and is way overdue.  Thanks for showing how small-impact the
necessary changes are.

"submodule init subpro" should be able to use this to clone a submodule
with:

	git clone --xxx=.git/modules/subpro.git subpro

When we need to switch to a revision without that submodule, after making
sure that there is no precious file in subpro/ directory, we would:

	rm -rf subpro/

Now, what do we need to switch back to a revision with that submodule?  It
would involve something like this:

	... after checking if we already have .git/modules/subpro.git
        ... and seeing that we do ...

	mkdir subpro
	commit=$(git rev-parse :subpro)
        echo 'gitdir: ../.git/modules/subpro.git' >subpro/.git
	cd subpro && git checkout $commit^0

The above four lines packaged for "git submodule" script would be a useful
thing to have, especially because then nobody has to write the "echo" part.

>  I intend to make 'git init --real-git-dir' move current repo to
>  somewhere else if called on existing repo.

I don't know if that is useful in real life.  Do you have a concrete use
case (like the one I showed an example above) in mind?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]