summaryrefslogtreecommitdiff
path: root/t/t6050-replace.sh
diff options
context:
space:
mode:
authorChristian Couder <chriscool@tuxfamily.org>2013-12-11 07:46:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-12-12 19:53:49 (GMT)
commitbbbb4afc26cd3d711e07a345d1e5f9eedc68100f (patch)
treef90ba7b6aae6590b8aaf8616291f3208f70cac14 /t/t6050-replace.sh
parent44f9f850e8ee6e2824ceb1855d836d484340edf7 (diff)
downloadgit-bbbb4afc26cd3d711e07a345d1e5f9eedc68100f.zip
git-bbbb4afc26cd3d711e07a345d1e5f9eedc68100f.tar.gz
git-bbbb4afc26cd3d711e07a345d1e5f9eedc68100f.tar.bz2
t6050: add tests for listing with --format
This patch adds tests for "git replace -l --format=<fmt>". 'short', 'medium' and 'full' are the only allowed values for <fmt>. 'short' is the same as with no --format option. Tests for 'medium' and 'full' are the most needed. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6050-replace.sh')
-rwxr-xr-xt/t6050-replace.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh
index bb785ec..e1cc3b8 100755
--- a/t/t6050-replace.sh
+++ b/t/t6050-replace.sh
@@ -281,6 +281,43 @@ test_expect_success 'git cat-file --batch works on replace objects' '
echo $PARA3 | git cat-file --batch
'
+test_expect_success 'test --format bogus' '
+ test_must_fail git replace --format bogus >/dev/null 2>&1
+'
+
+test_expect_success 'test --format short' '
+ git replace --format=short >actual &&
+ git replace >expected &&
+ test_cmp expected actual
+'
+
+test_expect_success 'test --format medium' '
+ H1=$(git --no-replace-objects rev-parse HEAD~1) &&
+ HT=$(git --no-replace-objects rev-parse HEAD^{tree}) &&
+ MYTAG=$(git --no-replace-objects rev-parse mytag) &&
+ {
+ echo "$H1 -> $BLOB" &&
+ echo "$BLOB -> $REPLACED" &&
+ echo "$HT -> $H1" &&
+ echo "$PARA3 -> $S" &&
+ echo "$MYTAG -> $HASH1"
+ } | sort >expected &&
+ git replace -l --format medium | sort > actual &&
+ test_cmp expected actual
+'
+
+test_expect_failure 'test --format full' '
+ {
+ echo "$H1 (commit) -> $BLOB (blob)" &&
+ echo "$BLOB (blob) -> $REPLACED (blob)" &&
+ echo "$HT (tree) -> $H1 (commit)" &&
+ echo "$PARA3 (commit) -> $S (commit)" &&
+ echo "$MYTAG (tag) -> $HASH1 (commit)"
+ } | sort >expected &&
+ git replace --format=full | sort > actual &&
+ test_cmp expected actual
+'
+
test_expect_success 'replace ref cleanup' '
test -n "$(git replace)" &&
git replace -d $(git replace) &&