Re: [PATCH] rev-parse --show-prefix: add in trailing newline
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Apr 10, 2012, 14:04 UTC
- Message-ID
- <20120410140421.GC2444@burratino>
- In-Reply-To
- <7v1unwwwov.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 5 quoted lines
> But it will break existing scripts if they expect the following to work: > > file="$(git rev-parse --show-prefix)/$1" > cd_to_toplevel > test -f "$file"
Huh? I tried this:
$ foo="$(printf '\n')/bar" $ printf '%s\n' "$foo" /bar
If that didn't work, it would mean that "git rev-parse --show-prefix" would never work when the prefix is nonempty, because it is followed by a newline.