2010/10/19 Jonathan Nieder <[email protected]>:
> Yagh. Given: cwd is .git dir, GIT_DIR unset, GIT_WORK_TREE=/tmp/git
So cwd is /tmp/git/.git, right?
Another the way to "address" this is to ban this case entirely.
GIT_WORK_TREE should only be considered when GIT_DIR is set. I think
there are discussions in the past about this approach.
> run_builtin() runs the repository setup:
>
> setup_git_directory() ->
> setup_git_directory_gently(NULL) ->
> setup_git_directory_gently_1(NULL) ->
> setup_bare_git_dir($GIT_WORK_TREE, strlen(cwd), strlen(cwd), cwd, NULL) ->
> set_git_dir(".")
>
> Result:
>
> GIT_DIR=.
> GIT_WORK_TREE=/tmp/git
> inside_work_tree = -1
This is temporary. when is_inside_worktree() is called this variable
should either 0 or 1 (more likely 1)
> prefix = NULL
> cwd = /tmp/git
Hmm.. I think cwd is /tmp/git/.git becase cwd has not been changed
yet. (Haven't had time to test it yet)
> Should the result be rather
>
> GIT_DIR=/tmp/git/.git
Better be relative path here.
> prefix=.git
> inside_work_tree = 1
[and cwd = /tmp/git ?]
Why do you think cwd should be moved to /tmp/git? If it follows the
current order of gitdir detection, .git (as cwd) will be recognized as
gitdir and the detection process stops. prefix calculation is not
correct. I should fix that with my long forgotten tp/setup series. But
cwd should stay in /tmp/git/.git and GIT_DIR should be ".".
--
Duy
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]