Re: [PATCH v2 2/2] submodules: always use a relative path from gitdir to work tree

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

 



Jens Lehmann <Jens.Lehmann@xxxxxx> writes:

> The first version was whitespace damaged, please use this instead.

Thanks.  This one looks somewhat iffy (1/2 looked perfectly fine, though).

> +	a=$(cd "$gitdir" && pwd)
> +	b=$(cd "$path" && pwd)
> +	while [ "$b" ] && [ "${a%%/*}" = "${b%%/*}" ]
> +	do
> +		a=${a#*/} b=${b#*/};
> +	done
> +	rel=$(echo $a | sed -e 's|[^/]*|..|g')
> +	(clear_local_git_env; cd "$path" && git config core.worktree "$rel/$b")
>  }


The style ([ "$b" ] vs "test -n "$b") aside, it strikes me odd that you
only check $b; it is unclear what guarantees that "$a" is always longer.
Maybe there is a reason but then a one-line comment here would not hurt?
--
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]