Re: [PATCH] Move worktree setup out of setup_git_directory*

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

 



On Mon, Feb 25, 2008 at 8:13 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>   - At startup:
>
>    - If the command always need to run from a repository, call
>      setup_git_directory(), which would complain and die if you
>      are outside.
>
>    - If the command can optionally run in a repository, use
>      setup_git_directory_gently(&nongit_ok); it won't complain
>      but sets nongit_ok to true if run outside a repository.
>
>    In either case, they return prefix string to be used for
>    setup_work_tree() later.
>
>    In either case, there is no chdir() done at this point.

Interesting. It currently does chdir(). But it is pointless now as
worktree should not be accessed until setup_work_tree() is called.
setup_git_directory* should not return a prefix at all.

>   - After calling setup_git_directory(), or you made sure you are
>    in a repository after callilng setup_git_directory_gently(),
>    call setup_work_tree().  This will chdir to the top of the
>    work tree.
>
>   - When you need to know where $GIT_DIR is, call get_git_dir().
>    When you need to know where the work tree is, call
>    get_git_work_tree().  However, it is an error to call these
>    functions before calling setup_git_directory and
>    setup_work_tree.

I guess I just need to verify your statements and put them to
Doc/technical/api-setup.txt ;)
-- 
Duy
-
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]

  Powered by Linux