git-gc.txt: fix typo about gc.writeCommitGraph
[git/raj.git] / t / t4064-diff-oidfind.sh
blob3bdf317af8d92fa87c108e662dbde4ff7ca9f8f1
1 #!/bin/sh
3 test_description='test finding specific blobs in the revision walking'
4 . ./test-lib.sh
6 test_expect_success 'setup ' '
7 git commit --allow-empty -m "empty initial commit" &&
9 echo "Hello, world!" >greeting &&
10 git add greeting &&
11 git commit -m "add the greeting blob" && # borrowed from Git from the Bottom Up
12 git tag -m "the blob" greeting $(git rev-parse HEAD:greeting) &&
14 echo asdf >unrelated &&
15 git add unrelated &&
16 git commit -m "unrelated history" &&
18 git revert HEAD^ &&
20 git commit --allow-empty -m "another unrelated commit"
23 test_expect_success 'find the greeting blob' '
24 cat >expect <<-EOF &&
25 Revert "add the greeting blob"
26 add the greeting blob
27 EOF
29 git log --format=%s --find-object=greeting^{blob} >actual &&
31 test_cmp expect actual
34 test_expect_success 'setup a tree' '
35 mkdir a &&
36 echo asdf >a/file &&
37 git add a/file &&
38 git commit -m "add a file in a subdirectory"
41 test_expect_success 'find a tree' '
42 cat >expect <<-EOF &&
43 add a file in a subdirectory
44 EOF
46 git log --format=%s -t --find-object=HEAD:a >actual &&
48 test_cmp expect actual
51 test_expect_success 'setup a submodule' '
52 test_create_repo sub &&
53 test_commit -C sub sub &&
54 git submodule add ./sub sub &&
55 git commit -a -m "add sub"
58 test_expect_success 'find a submodule' '
59 cat >expect <<-EOF &&
60 add sub
61 EOF
63 git log --format=%s --find-object=HEAD:sub >actual &&
65 test_cmp expect actual
68 test_done