From: Junio C Hamano Date: Mon, 13 Feb 2012 19:59:37 GMT Subject: Re: [PATCH v2 2/2] submodules: always use a relative path from gitdir to work tree Message-ID: <7vlio6ec7q.fsf@alter.siamese.dyndns.org> In-Reply-To: <4F338156.9090507@web.de> Jens Lehmann 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?