summaryrefslogtreecommitdiff
path: root/t/t6050-replace.sh
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2012-11-13 11:34:11 +0100
committerJeff King <peff@peff.net>2012-11-13 08:34:14 -0500
commit9dfc36841b3f1a2669f0513676cc4d72ef1220a1 (patch)
tree45007aa220439f0e3c5cb9e7d62109ac12683676 /t/t6050-replace.sh
parentb0b00a3ee43b4813eb85728a482500f6422499fd (diff)
downloadgit-9dfc36841b3f1a2669f0513676cc4d72ef1220a1.tar.gz
replace: parse revision argument for -d
'git replace' parses the revision arguments when it creates replacements (so that a sha1 can be abbreviated, e.g.) but not when deleting replacements. Make it parse the argument to 'replace -d' in the same way. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 't/t6050-replace.sh')
-rwxr-xr-xt/t6050-replace.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh
index 5c87f28e4e..decdc33c52 100755
--- a/t/t6050-replace.sh
+++ b/t/t6050-replace.sh
@@ -140,6 +140,17 @@ test_expect_success '"git replace" replacing' '
test "$HASH2" = "$(git replace)"
'
+test_expect_success '"git replace" resolves sha1' '
+ SHORTHASH2=$(git rev-parse --short=8 $HASH2) &&
+ git replace -d $SHORTHASH2 &&
+ git replace $SHORTHASH2 $R &&
+ git show $HASH2 | grep "O Thor" &&
+ test_must_fail git replace $HASH2 $R &&
+ git replace -f $HASH2 $R &&
+ test_must_fail git replace -f &&
+ test "$HASH2" = "$(git replace)"
+'
+
# This creates a side branch where the bug in H2
# does not appear because P2 is created by applying
# H2 and squashing H5 into it.