aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-02-18 15:30:32 -0800
committerJunio C Hamano <gitster@pobox.com>2025-02-18 15:30:32 -0800
commit7722b997c65b99aa824f83fd8e674ae77ea698f3 (patch)
tree5eb23240d10b98e715f719fe533626dff8d558e9 /t
parent345aaf3976a6abc491026c8a465b5e8ccbc8da5a (diff)
parent3295c3539896750f742a56de0c4ac965f8d96303 (diff)
downloadgit-7722b997c65b99aa824f83fd8e674ae77ea698f3.tar.gz
Merge branch 'jt/rev-list-missing-print-info'
"git rev-list --missing=" learned to accept "print-info" that gives known details expected of the missing objects, like path and type. * jt/rev-list-missing-print-info: rev-list: extend print-info to print missing object type rev-list: add print-info action to print missing object path
Diffstat (limited to 't')
-rwxr-xr-xt/t6022-rev-list-missing.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/t/t6022-rev-list-missing.sh b/t/t6022-rev-list-missing.sh
index 7553a9cca2..3e2790d4c8 100755
--- a/t/t6022-rev-list-missing.sh
+++ b/t/t6022-rev-list-missing.sh
@@ -145,4 +145,57 @@ do
done
done
+for obj in "HEAD~1" "HEAD^{tree}" "HEAD:foo" "HEAD:foo/bar" "HEAD:baz baz"
+do
+ test_expect_success "--missing=print-info with missing '$obj'" '
+ test_when_finished rm -rf missing-info &&
+
+ git init missing-info &&
+ (
+ cd missing-info &&
+ git commit --allow-empty -m first &&
+
+ mkdir foo &&
+ echo bar >foo/bar &&
+ echo baz >"baz baz" &&
+ echo bat >bat\" &&
+ git add -A &&
+ git commit -m second &&
+
+ oid="$(git rev-parse "$obj")" &&
+ path=".git/objects/$(test_oid_to_path $oid)" &&
+ type_info=" type=$(git cat-file -t $oid)" &&
+
+ case $obj in
+ HEAD:foo)
+ path_info=" path=foo"
+ ;;
+ HEAD:foo/bar)
+ path_info=" path=foo/bar"
+ ;;
+ "HEAD:baz baz")
+ path_info=" path=\"baz baz\""
+ ;;
+ "HEAD:bat\"")
+ path_info=" path=\"bat\\\"\""
+ ;;
+ esac &&
+
+ # Before the object is made missing, we use rev-list to
+ # get the expected oids.
+ git rev-list --objects --no-object-names \
+ HEAD ^"$obj" >expect.raw &&
+ echo "?$oid$path_info$type_info" >>expect.raw &&
+
+ mv "$path" "$path.hidden" &&
+ git rev-list --objects --no-object-names \
+ --missing=print-info HEAD >actual.raw &&
+
+ sort actual.raw >actual &&
+ sort expect.raw >expect &&
+ test_cmp expect actual
+ )
+ '
+done
+
test_done