git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jens Lehmann <Jens.Lehmann@web.de>
Cc: Git Mailing List <git@vger.kernel.org>,
	Antony Male <antony.male@gmail.com>,
	Phil Hord <phil.hord@gmail.com>
Subject: Re: [PATCH v2 2/2] submodules: always use a relative path from gitdir to work tree
Date: Mon, 13 Feb 2012 11:59:37 -0800	[thread overview]
Message-ID: <7vlio6ec7q.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4F338156.9090507@web.de> (Jens Lehmann's message of "Thu, 09 Feb 2012 09:18:30 +0100")

Jens Lehmann <Jens.Lehmann@web.de> 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?

  reply	other threads:[~2012-02-13 19:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08 22:08 [PATCH 0/2] submodules: Use relative paths to gitdir and work tree Jens Lehmann
2012-02-08 22:11 ` [PATCH 1/2] submodules: always use a relative path to gitdir Jens Lehmann
2012-02-09  8:18   ` [PATCH v2 " Jens Lehmann
2012-02-09 19:40     ` Junio C Hamano
2012-02-09 19:52       ` Junio C Hamano
2012-02-09 20:13       ` Jens Lehmann
2012-02-08 22:17 ` [PATCH 2/2] submodules: always use a relative path from gitdir to work tree Jens Lehmann
2012-02-09  8:18   ` [PATCH v2 " Jens Lehmann
2012-02-13 19:59     ` Junio C Hamano [this message]
2012-02-14 17:36       ` Jens Lehmann
2012-02-14 20:24         ` Junio C Hamano
2012-02-14 20:34           ` Junio C Hamano
2012-02-15 22:18             ` Jens Lehmann
2012-02-26 17:38 ` [PATCH 0/2] submodules: Use relative paths to gitdir and " Johannes Sixt
2012-02-26 19:58   ` Jens Lehmann
2012-02-27 21:19     ` Johannes Sixt
2012-02-27 21:41       ` [msysGit] " Johannes Schindelin
2012-02-28 18:58       ` Johannes Sixt
2012-02-28 19:14         ` Junio C Hamano
2012-02-28 19:33           ` Jens Lehmann
2012-02-28 19:21         ` Jens Lehmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vlio6ec7q.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Jens.Lehmann@web.de \
    --cc=antony.male@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phil.hord@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).