git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* builtin command's prefix question
@ 2007-12-05 16:56 Nguyen Thai Ngoc Duy
  2007-12-05 22:12 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2007-12-05 16:56 UTC (permalink / raw)
  To: Git Mailing List

Hi,

I have been looking at setup_git_directory_gently() lately. From my
understanding, setup_git_directory* will return a string called
"prefix" that is passed to builtin commands. What is the exact meaning
of this prefix? Correct me if I'm wrong. In early (read: no worktree)
days, cwd was moved to working root directory and prefix contained
relative path from working root directory to the original cwd. So it
had a few implications:
 1. A non-empty prefix indicates cwd has been moved
 2. If cwd is moved, it is moved to working root directory
 3. cwd+prefix should point to the current directory at the time the
command was issued (let's call it "user cwd")

Things change a bit since the rise of worktree:
 - If GIT_DIR is set and GIT_WORK_TREE is not, prefix is relative to
the to-be-set-up worktree, but cwd is not changed, so point 3 is gone.
 - If GIT_DIR is not set and GiT_WORK_TREE is,
  - and it is found that user cwd is inside a gitdir (bare repo), cwd
has been moved and prefix is empty, cwd+prefix no longer point to user
cwd
  - for other cases, cwd may not be worktree (the real worktree will
be setup in setup_work_tree or setup_git_directory)

Now that setup_work_tree can move cwd, it should also change prefix to
meet point 3. But it does not.

I feel dizzy now. Were my assumptions wrong? What is expected behavior
of setup_git_directory_gently()?
-- 
Duy

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-12-06 16:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-05 16:56 builtin command's prefix question Nguyen Thai Ngoc Duy
2007-12-05 22:12 ` Junio C Hamano
2007-12-05 23:22   ` Junio C Hamano
2007-12-05 23:43     ` Junio C Hamano
2007-12-06 15:26   ` Nguyen Thai Ngoc Duy
2007-12-06 15:48     ` Johannes Schindelin
2007-12-06 16:04       ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).