Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9123156
dir-git-repo-meta.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
605 B
Subscribers
None
dir-git-repo-meta.sh
View Options
#!/usr/bin/env bash
# count the number of type (tree, blob, tag, commit)
REPO
=
${
1
-
`
pwd
`
}
TYPE
=
${
2
-
"all"
}
data
()
{
git
rev-list
--objects
--all
\
|
git
cat-file
--batch-check
=
'%(objectname) %(objecttype) %(rest)'
\
|
cut
-f2
-d
' '
\
|
grep
$1
\
|
wc
-l
}
cd
$REPO
if
[
"
$TYPE
"
=
"all"
]
;
then
NB_BLOBS
=
$(
data
"blob"
)
NB_TREES
=
$(
data
"tree"
)
NB_COMMITS
=
$(
data
"commit"
)
NB_TAGS
=
$(
data
"tag"
)
cat
<<EOC
blob $NB_BLOBS
tree $NB_TREES
commit $NB_COMMITS
tag $NB_TAGS
EOC
else
NUM
=
$(
data
$TYPE
)
echo
"
$TYPE
$NUM
"
fi
File Metadata
Details
Attached
Mime Type
text/x-shellscript
Expires
Sat, Jun 21, 5:06 PM (2 w, 7 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3240056
Attached To
rDLDG Git loader
Event Timeline
Log In to Comment