@@ -9,7 +9,7 @@ function init_header() {
9
9
#
10
10
# Developed and maintained by @gehaxelt from @internetwache
11
11
#
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.
13
13
# Only for educational purposes!
14
14
###########
15
15
@@ -82,6 +82,10 @@ function start_download() {
82
82
QUEUE+=(' info/exclude' )
83
83
QUEUE+=(' refs/wip/wtree/refs/heads/master' )
84
84
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
+
85
89
# Iterate through QUEUE until there are no more files to download
86
90
while [ ${# QUEUE[*]} -gt 0 ]
87
91
do
@@ -112,7 +116,7 @@ function download_item() {
112
116
113
117
# Download file
114
118
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
+
116
120
# Mark as downloaded and remove it from the queue
117
121
DOWNLOADED+=(" $objname " )
118
122
if [ ! -f " $target " ]; then
@@ -122,23 +126,23 @@ function download_item() {
122
126
echo -e " \033[32m[+] Downloaded: $objname \033[0m"
123
127
124
128
# 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
126
130
# Switch into $BASEDIR and save current working directory
127
131
cwd=$( pwd)
128
132
cd " $BASEDIR "
129
-
133
+
130
134
# Restore hash from $objectname
131
135
hash=$( echo " $objname " | sed -e ' s~objects~~g' | sed -e ' s~/~~g' )
132
-
136
+
133
137
# Check if it's valid git object
134
138
type=$( git cat-file -t " $hash " 2> /dev/null)
135
139
if [ $? -ne 0 ]; then
136
140
# Delete invalid file
137
141
cd " $cwd "
138
142
rm " $target "
139
- return
143
+ return
140
144
fi
141
-
145
+
142
146
# Parse output of git cat-file -p $hash. Use strings for blobs
143
147
if [[ " $type " != " blob" ]]; then
144
148
hashes+=($( git cat-file -p " $hash " | grep -oE " ([a-f0-9]{40})" ) )
@@ -147,8 +151,8 @@ function download_item() {
147
151
fi
148
152
149
153
cd " $cwd "
150
- fi
151
-
154
+ fi
155
+
152
156
# Parse file for other objects
153
157
hashes+=($( cat " $target " | strings -a | grep -oE " ([a-f0-9]{40})" ) )
154
158
for hash in ${hashes[*]}
@@ -159,7 +163,7 @@ function download_item() {
159
163
# Parse file for packs
160
164
packs+=($( cat " $target " | strings -a | grep -oE " (pack\-[a-f0-9]{40})" ) )
161
165
for pack in ${packs[*]}
162
- do
166
+ do
163
167
QUEUE+=(" objects/pack/$pack .pack" )
164
168
QUEUE+=(" objects/pack/$pack .idx" )
165
169
done
0 commit comments