Re: [PATCH v2] stash: handle specifying stashes with spaces
- From
Thomas Rast <tr@thomasrast.ch>
- Date
- Nov 29, 2013, 21:33 UTC
- Message-ID
- <878uw6dha7.fsf@thomasrast.ch>
- In-Reply-To
- <1385758845-8627-1-git-send-email-oystwa@gmail.com>
Thanks for looking into this!
Øystein Walle <oystwa@gmail.com> writes:
> - REV=$(git rev-parse --quiet --symbolic --verify $1 2>/dev/null) || {
> + REV=$(git rev-parse --quiet --symbolic --verify "$1" 2>/dev/null) || {
> reference="$1"It's somewhat ironic that the one place where the original did use quoting is where it's actually not required.
> - i_commit=$(git rev-parse --quiet --verify $REV^2 2>/dev/null) && > - set -- $(git rev-parse $REV $REV^1 $REV: $REV^1: $REV^2: 2>/dev/null) && > + i_commit=$(git rev-parse --quiet --verify "$REV^2" 2>/dev/null) && > + set -- $(git rev-parse "$REV" "$REV^1" "$REV:" "$REV^1:" "$REV^2:" 2>/dev/null) &&
Thanks for being careful here.
I wonder what we would lose by dropping the --symbolic in the line I quoted above (which is the second parsing pass), so that it resolves to a SHA1. We would gain some robustness, as I'm not sure "$REV:" works correctly in the face of weird revision expressions like ":/foo".
-- Thomas Rast tr@thomasrast.ch