2010/10/19 Nguyen Thai Ngoc Duy <pclo...@gmail.com>:
> 2010/10/19 Jonathan Nieder <jrnie...@gmail.com>:
>> 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)

Replying to myself. setup_git_directory() moves cwd to /tmp/git
because it finds out cwd is inside worktree. Gaah.. all chdir() should
better be handled inside gently_1() to avoid this mess.

I once made setup_git_directory() a thin wrapper of _gently() (i.e no
logic at all). What happened to that patch, hm...
-- 
Duy



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to