Re: [PATCH 3/9] setup: split off $GIT_DIR-set case from setup_git_directory_gently

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

 



2010/7/24 Jonathan Nieder <jrnieder@xxxxxxxxx>:
> +static const char *setup_explicit_git_dir(const char *gitdirenv,
> +                               const char *work_tree_env, int *nongit_ok)
> +{
> +       static char buffer[1024 + 1];
> +       const char *retval;
> +
> +       if (PATH_MAX - 40 < strlen(gitdirenv))
> +               die("'$%s' too big", GIT_DIR_ENVIRONMENT);
> +       if (!is_git_directory(gitdirenv)) {
> +               if (nongit_ok) {
> +                       *nongit_ok = 1;
> +                       return NULL;
> +               }
> +               die("Not a git repository: '%s'", gitdirenv);
> +       }
> +       if (!work_tree_env) {
> +               retval = set_work_tree(gitdirenv);
> +               /* config may override worktree */
> +               if (check_repository_format_gently(nongit_ok))
> +                       return NULL;
> +               return retval;
> +       }
> +       if (check_repository_format_gently(nongit_ok))
> +               return NULL;
> +       retval = get_relative_cwd(buffer, sizeof(buffer) - 1,
> +                       get_git_work_tree());

Note to self, cwd should be passed to setup_explicit_git_dir, then
drop get_relative_cwd() in favor of prefixcmp(). One less getcwd call,
buffer will not be not needed. And probably easier to understand.
-- 
Duy
��.n��������+%������w��{.n��������n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�

[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]