File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -1100,6 +1100,42 @@ test_expect_success 'cat-file --batch="batman" with --batch-all-objects will wor
1100
1100
cmp expect actual
1101
1101
'
1102
1102
1103
+ test_expect_success ' cat-file %(objectsize:disk) with --batch-all-objects' '
1104
+ # our state has both loose and packed objects,
1105
+ # so find both for our expected output
1106
+ {
1107
+ find .git/objects/?? -type f |
1108
+ awk -F/ "{ print \$0, \$3\$4 }" |
1109
+ while read path oid
1110
+ do
1111
+ size=$(test_file_size "$path") &&
1112
+ echo "$oid $size" ||
1113
+ return 1
1114
+ done &&
1115
+ rawsz=$(test_oid rawsz) &&
1116
+ find .git/objects/pack -name "*.idx" |
1117
+ while read idx
1118
+ do
1119
+ git show-index <"$idx" >idx.raw &&
1120
+ sort -nr <idx.raw >idx.sorted &&
1121
+ packsz=$(test_file_size "${idx%.idx}.pack") &&
1122
+ end=$((packsz - rawsz)) &&
1123
+ while read start oid rest
1124
+ do
1125
+ size=$((end - start)) &&
1126
+ end=$start &&
1127
+ echo "$oid $size" ||
1128
+ return 1
1129
+ done <idx.sorted ||
1130
+ return 1
1131
+ done
1132
+ } >expect.raw &&
1133
+ sort <expect.raw >expect &&
1134
+ git cat-file --batch-all-objects \
1135
+ --batch-check="%(objectname) %(objectsize:disk)" >actual &&
1136
+ test_cmp expect actual
1137
+ '
1138
+
1103
1139
test_expect_success ' set up replacement object' '
1104
1140
orig=$(git rev-parse HEAD) &&
1105
1141
git cat-file commit $orig >orig &&
You can’t perform that action at this time.
0 commit comments