File tree 4 files changed +49
-2
lines changed
4 files changed +49
-2
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ GIT_LFS_FILENAME="$(jq --raw-output ".\"git-lfs\".files[] | select(.arch == \"$D
36
36
37
37
# shellcheck source=script/compute-checksum.sh
38
38
source " $CURRENT_DIR /compute-checksum.sh"
39
+ # shellcheck source=script/verify-lfs-contents.sh
40
+ source " $CURRENT_DIR /verify-lfs-contents.sh"
39
41
40
42
echo " -- Building git at $SOURCE to $DESTINATION "
41
43
@@ -84,6 +86,9 @@ if [[ "$GIT_LFS_VERSION" ]]; then
84
86
if [ " $COMPUTED_SHA256 " = " $GIT_LFS_CHECKSUM " ]; then
85
87
echo " Git LFS: checksums match"
86
88
SUBFOLDER=" $DESTINATION /libexec/git-core"
89
+
90
+ verify_lfs_contents " $GIT_LFS_FILE "
91
+
87
92
unzip -j $GIT_LFS_FILE -d " $SUBFOLDER " " */git-lfs"
88
93
89
94
if [[ ! -f " $SUBFOLDER /git-lfs" ]]; then
Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ GCM_URL="$(jq --raw-output ".\"git-credential-manager\".files[] | select(.arch =
63
63
source " $CURRENT_DIR /compute-checksum.sh"
64
64
# shellcheck source=script/check-static-linking.sh
65
65
source " $CURRENT_DIR /check-static-linking.sh"
66
+ # shellcheck source=script/verify-lfs-contents.sh
67
+ source " $CURRENT_DIR /verify-lfs-contents.sh"
66
68
67
69
echo " -- Building vanilla curl at $CURL_INSTALL_DIR instead of distro-specific version"
68
70
@@ -108,7 +110,10 @@ if [[ "$GIT_LFS_VERSION" ]]; then
108
110
if [ " $COMPUTED_SHA256 " = " $GIT_LFS_CHECKSUM " ]; then
109
111
echo " Git LFS: checksums match"
110
112
SUBFOLDER=" $DESTINATION /libexec/git-core"
111
- tar -xvf $GIT_LFS_FILE -C " $SUBFOLDER " --strip-components=1 --exclude=' *.sh' --exclude=" *.md"
113
+
114
+ verify_lfs_contents " $GIT_LFS_FILE "
115
+
116
+ tar -zxvf " $GIT_LFS_FILE " --strip-components=1 -C " $SUBFOLDER " --wildcards " */git-lfs"
112
117
113
118
if [[ ! -f " $SUBFOLDER /git-lfs" ]]; then
114
119
echo " After extracting Git LFS the file was not found under libexec/git-core/"
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ GIT_FOR_WINDOWS_CHECKSUM=$(jq --raw-output ".git.packages[] | select(.arch == \"
27
27
CURRENT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
28
28
# shellcheck source=script/compute-checksum.sh
29
29
source " $CURRENT_DIR /compute-checksum.sh"
30
+ # shellcheck source=script/verify-lfs-contents.sh
31
+ source " $CURRENT_DIR /verify-lfs-contents.sh"
30
32
31
33
mkdir -p " $DESTINATION "
32
34
@@ -55,7 +57,10 @@ if [[ "$GIT_LFS_VERSION" ]]; then
55
57
if [ " $COMPUTED_SHA256 " = " $GIT_LFS_CHECKSUM " ]; then
56
58
echo " Git LFS: checksums match"
57
59
SUBFOLDER=" $DESTINATION /$MINGW_DIR /libexec/git-core"
58
- unzip -j $GIT_LFS_FILE -x ' *.md' -d " $SUBFOLDER "
60
+
61
+ verify_lfs_contents " $GIT_LFS_FILE "
62
+
63
+ unzip -j $GIT_LFS_FILE -d " $SUBFOLDER " " */git-lfs.exe"
59
64
60
65
if [[ ! -f " $SUBFOLDER /git-lfs.exe" ]]; then
61
66
echo " After extracting Git LFS the file was not found under /mingw64/libexec/git-core/"
Original file line number Diff line number Diff line change
1
+ #! /bin/bash -e
2
+
3
+ verify_lfs_contents () {
4
+
5
+ CONTENTS=" "
6
+
7
+ if [[ " $1 " == * .zip ]]; then
8
+ CONTENTS=$( unzip -qql " $1 " )
9
+ elif [[ " $1 " == * .tar.gz ]]; then
10
+ CONTENTS=$( tar -tzf " $1 " )
11
+ else
12
+ echo " Unknown file type for $1 "
13
+ exit 1
14
+ fi
15
+
16
+ test -z " $CONTENTS " && {
17
+ echo " Git LFS: found no contents in LFS archive, aborting..."
18
+ exit 1
19
+ }
20
+
21
+ TOPLEVEL=$( echo " $CONTENTS " | cut -d/ -f2 | sort | uniq | grep .)
22
+
23
+ # Sanity check to make sure we react if git-lfs starts adding more stuff to
24
+ # their release packages. Note that this only looks that the top
25
+ # (technically second) level folder so new stuff in the man folder won't
26
+ # get caught here.
27
+ # shellcheck disable=SC2015
28
+ grep -qvE " ^(CHANGELOG\.md|README\.md|git-lfs(\.exe)?|install\.sh|man)$" <<< " $TOPLEVEL" && {
29
+ echo " Git LFS: unexpected files in the LFS archive, aborting..."
30
+ exit 1
31
+ } || true
32
+ }
You can’t perform that action at this time.
0 commit comments