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

4 messages, 3 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:50:42

Nguyễn Thái Ngọc Duy  [off-list ref] 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?

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

From: Miles Bader <hidden>
Date: 2016-06-15 22:50:42

Junio C Hamano [off-list ref] writes:
quoted
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.
--separate-git-dir  ?

[Terms like "separate source dir" and "separate build dir" seems to be
common when talking about build systems, and it seems a somewhat
similar situation -- separation of usually co-located information.]

-miles

-- 
It wasn't the Exxon Valdez captain's driving that caused the Alaskan oil spill.
It was yours.  [Greenpeace advertisement, New York Times, 25 February 1990]

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

From: Nguyen Thai Ngoc Duy <hidden>
Date: 2016-06-15 22:50:42

2011/3/4 Junio C Hamano [off-list ref]:
quoted
 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?
Moving .git away from existing repos/worktrees I have.
-- 
Duy

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

From: Nguyen Thai Ngoc Duy <hidden>
Date: 2016-06-15 22:50:42

2011/3/4 Miles Bader [off-list ref]:
Junio C Hamano [off-list ref] writes:
quoted
quoted
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.
--separate-git-dir  ?

[Terms like "separate source dir" and "separate build dir" seems to be
common when talking about build systems, and it seems a somewhat
similar situation -- separation of usually co-located information.]
Sounds good.
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help