Web lists-archives.com

[PATCH v2 10/19] t6112: rev-list object filtering test




From: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx>

Signed-off-by: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx>
---
 t/t6112-rev-list-filters-objects.sh | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 t/t6112-rev-list-filters-objects.sh

diff --git a/t/t6112-rev-list-filters-objects.sh b/t/t6112-rev-list-filters-objects.sh
new file mode 100644
index 0000000..ded2b04
--- /dev/null
+++ b/t/t6112-rev-list-filters-objects.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+test_description='git rev-list with object filtering'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+	for n in 1 2 3 4 5 ; do \
+		echo $n > file.$n ; \
+		git add file.$n ; \
+		git commit -m "$n" ; \
+	done
+'
+
+test_expect_success 'omit-all-blobs omitted 5 blobs' '
+	git rev-list HEAD --objects --filter-print-manifest --filter-omit-all-blobs >omit_all &&
+	grep "^~" omit_all >omitted &&
+	test $(cat omitted | wc -l) = 5
+'
+
+test_expect_success 'omit-all-blobs blob sha match' '
+	git rev-list HEAD --objects >normal &&
+	awk "/file/ {print \$1;}" <normal | sort >normal_sha &&
+	sed "s/~//" <omitted | awk "{print \$1;}" | sort >omit_all_sha &&
+	test_cmp normal_sha omit_all_sha
+'
+
+test_expect_success 'omit-all-blobs nothing else changed' '
+	grep -v "file" <normal | sort >normal_other &&
+	grep -v "~" <omit_all | sort >omit_other &&
+	test_cmp normal_other omit_other
+'
+
+# TODO test filter-omit-large-blobs
+# TODO test filter-use-sparse
+
+test_done
-- 
2.9.3