Skip to content

Commit ccc6ad5

Browse files
committed
Adding Magit catching lines
1 parent 7fa45a2 commit ccc6ad5

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

Dumper/gitdumper.sh

+14-10
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function init_header() {
99
#
1010
# Developed and maintained by @gehaxelt from @internetwache
1111
#
12-
# Use at your own risk. Usage might be illegal in certain circumstances.
12+
# Use at your own risk. Usage might be illegal in certain circumstances.
1313
# Only for educational purposes!
1414
###########
1515
@@ -82,6 +82,10 @@ function start_download() {
8282
QUEUE+=('info/exclude')
8383
QUEUE+=('refs/wip/wtree/refs/heads/master')
8484

85+
#Add refs that might be there if the remote uses Magit
86+
QUEUE+=('/refs/wip/index/refs/heads/master')
87+
QUEUE+=('/refs/wip/wtree/refs/heads/master')
88+
8589
#Iterate through QUEUE until there are no more files to download
8690
while [ ${#QUEUE[*]} -gt 0 ]
8791
do
@@ -112,7 +116,7 @@ function download_item() {
112116

113117
#Download file
114118
curl -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36" -f -k -s "$url" -o "$target"
115-
119+
116120
#Mark as downloaded and remove it from the queue
117121
DOWNLOADED+=("$objname")
118122
if [ ! -f "$target" ]; then
@@ -122,23 +126,23 @@ function download_item() {
122126
echo -e "\033[32m[+] Downloaded: $objname\033[0m"
123127

124128
#Check if we have an object hash
125-
if [[ "$objname" =~ /[a-f0-9]{2}/[a-f0-9]{38} ]]; then
129+
if [[ "$objname" =~ /[a-f0-9]{2}/[a-f0-9]{38} ]]; then
126130
#Switch into $BASEDIR and save current working directory
127131
cwd=$(pwd)
128132
cd "$BASEDIR"
129-
133+
130134
#Restore hash from $objectname
131135
hash=$(echo "$objname" | sed -e 's~objects~~g' | sed -e 's~/~~g')
132-
136+
133137
#Check if it's valid git object
134138
type=$(git cat-file -t "$hash" 2> /dev/null)
135139
if [ $? -ne 0 ]; then
136140
#Delete invalid file
137141
cd "$cwd"
138142
rm "$target"
139-
return
143+
return
140144
fi
141-
145+
142146
#Parse output of git cat-file -p $hash. Use strings for blobs
143147
if [[ "$type" != "blob" ]]; then
144148
hashes+=($(git cat-file -p "$hash" | grep -oE "([a-f0-9]{40})"))
@@ -147,8 +151,8 @@ function download_item() {
147151
fi
148152

149153
cd "$cwd"
150-
fi
151-
154+
fi
155+
152156
#Parse file for other objects
153157
hashes+=($(cat "$target" | strings -a | grep -oE "([a-f0-9]{40})"))
154158
for hash in ${hashes[*]}
@@ -159,7 +163,7 @@ function download_item() {
159163
#Parse file for packs
160164
packs+=($(cat "$target" | strings -a | grep -oE "(pack\-[a-f0-9]{40})"))
161165
for pack in ${packs[*]}
162-
do
166+
do
163167
QUEUE+=("objects/pack/$pack.pack")
164168
QUEUE+=("objects/pack/$pack.idx")
165169
done

0 commit comments

Comments
 (0)