Skip to content

Commit 8dbce83

Browse files
committed
The ERE grep mode didn't match the git ls-tree data, so to fix the parsing, we'll use awk now.
1 parent bfe6497 commit 8dbce83

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Extractor/extractor.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ function traverse_tree() {
2525
#Read blobs/tree information from root tree
2626
git ls-tree $tree |
2727
while read leaf; do
28-
type=$(echo $leaf | grep -oE "^\d+\s+\K\w{4}");
29-
hash=$(echo $leaf | grep -oE "^\d+\s+\w{4}\s+\K\w{40}");
30-
name=$(echo $leaf | grep -oE "^\d+\s+\w{4}\s+\w{40}\s+\K.*");
28+
type=$(echo $leaf | awk -F' ' '{print $2}') #grep -oP "^\d+\s+\K\w{4}");
29+
hash=$(echo $leaf | awk -F' ' '{print $3}') #grep -oP "^\d+\s+\w{4}\s+\K\w{40}");
30+
name=$(echo $leaf | awk '{$1=$2=$3=""; print substr($0,4)}') #grep -oP "^\d+\s+\w{4}\s+\w{40}\s+\K.*");
3131

32-
# Get the blob data
32+
# Get the blob data
3333
git cat-file -e $hash;
3434
#Ignore invalid git objects (e.g. ones that are missing)
3535
if [ $? -ne 0 ]; then

0 commit comments

Comments
 (0)