rev-parse: fix parent shorthands with --symbolic
[gitweb.git] / t / t6007-rev-list-cherry-pick-file.sh
index 28d4f6b259c1696435698cb3826c837c8eaf90e3..1408b608eb030f0e6bcc3d531aad426da5f06b12 100755 (executable)
@@ -207,4 +207,25 @@ test_expect_success '--count --left-right' '
        test_cmp expect actual
 '
 
+# Corrupt the object store deliberately to make sure
+# the object is not even checked for its existence.
+remove_loose_object () {
+       sha1="$(git rev-parse "$1")" &&
+       remainder=${sha1#??} &&
+       firsttwo=${sha1%$remainder} &&
+       rm .git/objects/$firsttwo/$remainder
+}
+
+test_expect_success '--cherry-pick avoids looking at full diffs' '
+       git checkout -b shy-diff &&
+       test_commit dont-look-at-me &&
+       echo Hello >dont-look-at-me.t &&
+       test_tick &&
+       git commit -m tip dont-look-at-me.t &&
+       git checkout -b mainline HEAD^ &&
+       test_commit to-cherry-pick &&
+       remove_loose_object shy-diff^:dont-look-at-me.t &&
+       git rev-list --cherry-pick ...shy-diff
+'
+
 test_done