Skip to content

Commit

Permalink
Changed grep -oP to grep -oE for better mac compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
gehaxelt committed Feb 12, 2017
1 parent 682638b commit e8a7f3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Dumper/gitdumper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function download_item() {
local target="$BASEGITDIR$objname"

#Create folder
dir=$(echo "$objname" | grep -oP "^(.*)/")
dir=$(echo "$objname" | grep -oE "^(.*)/")
if [ $? -ne 1 ]; then
mkdir -p "$BASEGITDIR/$dir"
fi
Expand Down Expand Up @@ -97,20 +97,20 @@ function download_item() {
fi

#Parse output of git cat-file -p $hash
hashes+=($(git cat-file -p "$hash" | grep -oP "([a-f0-9]{40})"))
hashes+=($(git cat-file -p "$hash" | grep -oE "([a-f0-9]{40})"))

cd "$cwd"
fi

#Parse file for other objects
hashes+=($(cat "$target" | grep -oP "([a-f0-9]{40})"))
hashes+=($(cat "$target" | grep -oE "([a-f0-9]{40})"))
for hash in ${hashes[*]}
do
QUEUE+=("objects/${hash:0:2}/${hash:2}")
done

#Parse file for packs
packs+=($(cat "$target" | grep -oP "(pack\-[a-f0-9]{40})"))
packs+=($(cat "$target" | grep -oE "(pack\-[a-f0-9]{40})"))
for pack in ${packs[*]}
do
QUEUE+=("objects/pack/$pack.pack")
Expand Down
6 changes: 3 additions & 3 deletions Extractor/extractor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ function traverse_tree() {
#Read blobs/tree information from root tree
git ls-tree $tree |
while read leaf; do
type=$(echo $leaf | grep -oP "^\d+\s+\K\w{4}");
hash=$(echo $leaf | grep -oP "^\d+\s+\w{4}\s+\K\w{40}");
name=$(echo $leaf | grep -oP "^\d+\s+\w{4}\s+\w{40}\s+\K.*");
type=$(echo $leaf | grep -oE "^\d+\s+\K\w{4}");
hash=$(echo $leaf | grep -oE "^\d+\s+\w{4}\s+\K\w{40}");
name=$(echo $leaf | grep -oE "^\d+\s+\w{4}\s+\w{40}\s+\K.*");

# Get the blob data
git cat-file -e $hash;
Expand Down

0 comments on commit e8a7f3b

Please sign in to comment.