aboutsummaryrefslogtreecommitdiffstats
path: root/t/test-lib-functions.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-01-29 14:05:08 -0800
committerJunio C Hamano <gitster@pobox.com>2025-01-29 14:05:09 -0800
commitf046ab2dd4c59aed786da0067f1af68ea1b003eb (patch)
tree1502ac92a5faca49fd4fdde99835d3cbc2083235 /t/test-lib-functions.sh
parentThe fourth batch (diff)
parentpath-walk: drop redundant parse_tree() call (diff)
downloadgit-f046ab2dd4c59aed786da0067f1af68ea1b003eb.tar.gz
git-f046ab2dd4c59aed786da0067f1af68ea1b003eb.zip
Merge branch 'ds/path-walk-1'
Introduce a new API to visit objects in batches based on a common path, or by type. * ds/path-walk-1: path-walk: drop redundant parse_tree() call path-walk: reorder object visits path-walk: mark trees and blobs as UNINTERESTING path-walk: visit tags and cached objects path-walk: allow consumer to specify object types t6601: add helper for testing path-walk API test-lib-functions: add test_cmp_sorted path-walk: introduce an object walk by path
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r--t/test-lib-functions.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index c25cee0ad8..14d511f509 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1268,6 +1268,16 @@ test_cmp () {
eval "$GIT_TEST_CMP" '"$@"'
}
+# test_cmp_sorted runs test_cmp on sorted versions of the two
+# input files. Uses "$1.sorted" and "$2.sorted" as temp files.
+
+test_cmp_sorted () {
+ sort <"$1" >"$1.sorted" &&
+ sort <"$2" >"$2.sorted" &&
+ test_cmp "$1.sorted" "$2.sorted" &&
+ rm "$1.sorted" "$2.sorted"
+}
+
# Check that the given config key has the expected value.
#
# test_cmp_config [-C <dir>] <expected-value>