Re: [RFC PATCH] Fix gitdir detection when in subdir of gitdir

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

 



SZEDER Gábor schrieb:
>  		if (is_git_directory(".")) {
> +			char gd_rel_path[PATH_MAX];
>  			inside_git_dir = 1;
>  			if (!work_tree_env)
>  				inside_work_tree = 0;
> -			setenv(GIT_DIR_ENVIRONMENT, ".", 1);
> +			if (cdup_count) {
> +				char *p = gd_rel_path;
> +				while (cdup_count-- > 1) {
> +					*p++ = '.'; *p++ = '.'; *p++ = '/';
> +				}
> +				*p++ = '.'; *p++ = '.';
> +				*p = '\0';
> +			} else {
> +				gd_rel_path[0] = '.';
> +				gd_rel_path[1] = '\0';
> +			}
> +			setenv(GIT_DIR_ENVIRONMENT, gd_rel_path, 1);
>  			check_repository_format_gently(nongit_ok);
>  			return NULL;
>  		}

This does not make sense because you don't chdir back to where you
started, so the relative path would be incorrect.

I have the feeling that it is not worth to support this particular
use-case with so many lines of code.

-- Hannes
--
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