Re: [msysGit] Re: [PATCH 0/2] submodules: Use relative paths to gitdir and work tree
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Feb 27, 2012, 21:41 UTC
- Message-ID
- <alpine.DEB.1.00.1202271538230.3340@s15462909.onlinehome-server.info>
- In-Reply-To
- <4F4BF357.8020407@kdbg.org>
Hi,
On Mon, 27 Feb 2012, Johannes Sixt wrote:
Show 7 quoted lines
> Am 26.02.2012 20:58, schrieb Jens Lehmann: > > > - gitdir=$(git rev-parse --git-dir) > > + gitdir=$(git rev-parse --git-dir | sed -e 's,^\([a-z]\):/,/\1/,') > > I don't like pipelines of this kind because they fork yet another > process. But it looks like there are not that many alternatives...
Not many, but some rather straight-forward ones. E.g.
# quoted to preserve tabs & newslines (Windows users are creative)
gitdir="$(git rev-parse --git-dir)"
case "$gitdir" in
[A-Za-z]:*)
gitdir="/${gitdir%%:*}${gitdir#?:}"
;;
esacNote: untested.
Note2: I did not add error handling, either.
Note3: yes, ${...} is available in bash and it does not fork. Neither does
case ... esacCiao, Johannes