Re: [PATCHv3 2/2] git submodule: Fix adding of submodules at paths with ./, .. and //
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Mar 3, 2009, 13:08 UTC
- Message-ID
- <49AD2BE6.1000105@viscovery.net>
- In-Reply-To
- <1236083989-20526-3-git-send-email-git@drmicha.warpmail.net>
Michael J Gruber schrieb:
Show 9 quoted lines
> + # normalize path: > + # multiple //; leading ./; /./; /../; trailing / > + path=$(printf '%s/\n' "$path" | > + sed -e ' > + s|//*|/|g > + s|^\(\./\)*|| > + s|/\./|/|g > + :start > + s|\([^/]*\)/\.\./||g
Sorry to say: not yet. This turns "a/b/c/d/../../../d" into "a/b/c/d" instead of "a/d". Drop the 'g'.
Once this is fixed, I have to ask what should happen with path names like "../a/b", "../../a/b"? Should there be a warning or error?
Other than that, this expression works on AIX 4.3.3! Note in particular that '\n' in the printf format string is essential!
> + tstart > + s|/*$|| > + ')
-- Hannes