Re: [PATCH v2] stash: handle specifying stashes with spaces
- From
Øystein Walle <oystwa@gmail.com>
- Date
- Nov 30, 2013, 15:29 UTC
- Message-ID
- <loom.20131130T153012-412@post.gmane.org>
- In-Reply-To
- <878uw6dha7.fsf@thomasrast.ch>
Thomas Rast <tr <at> thomasrast.ch> writes:
Show 5 quoted lines
> 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".
If I drop --symbolic then all hell breaks loose. Removing it very naively led to 29 failed tests. I managed to get that down quite a bit though.
After the function ends $REV is supposed to expand to a symbolic reference, and the test for whether the given argument is a valid stash reference is to see if running `git rev-parse --symbolic-full-name "${REV%@*}"` expands to 'refs/stash' or not. So we have to do both with and without --symbolic and keep both around. For example `git stash drop` had problems because git-reflog doesn't let you remove entries in the log by SHA1:
$ git reflog delete --updateref --rewrite $(git rev-parse stash@{0})
error: Not a reflog: 418af27beea220ad8a2fd3b8286959b1ec9c8852I think a not entirely accurate but succinct way of putting it is that if foo is a valid ref or valid entry in the reflog then
git rev-parse --symbolic $(git rev-parse foo)
does *not* output 'foo' but the SHA1 of 'foo'. So we cannot simply convert everything to hashes and proceed from there.
Øsse