Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
aports
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Milan P. Stanić
aports
Commits
328ee5e6
Commit
328ee5e6
authored
Dec 29, 2017
by
Jakub Jirutka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
githooks: fix checksum comparison in pre-commit hook
The previous method didn't work for larger files.
parent
65010e4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
.githooks/pre-commit
.githooks/pre-commit
+7
-6
No files found.
.githooks/pre-commit
View file @
328ee5e6
...
...
@@ -57,22 +57,23 @@ check_local_sources() {
local
apkbuild
=
"
$1
"
local
startdir
=
"
${
apkbuild
%/*
}
"
local
status
=
0
local
checksum content filename line sources
local
checksum
_act checksum_exp
content filename line sources
sources
=
$(
abuild_local_sources
"
$apkbuild
"
)
for
line
in
$sources
;
do
filename
=
${
line
%%
:
*
}
checksum
=
${
line
#*
:
}
checksum
_exp
=
${
line
#*
:
}
content
=
$(
git show
":
$startdir
/
$filename
"
2>/dev/null
)
||
{
if
!
git cat-file
-e
":
$startdir
/
$filename
"
2>/dev/null
;
then
error
"
$startdir
: missing file
\"
$filename
\"
"
status
=
1
continue
}
[
"
$(
printf
'%s\n'
"
$content
"
|
sha512sum
)
"
=
"
$checksum
-"
]
||
{
fi
checksum_act
=
$(
git show
":
$startdir
/
$filename
"
|
sha512sum
)
if
[
"
$checksum_act
"
!=
"
$checksum_exp
-"
]
;
then
error
"
$startdir
: bad checksum for file
\"
$filename
\"
(hint: run abuild checksum)"
status
=
1
}
fi
done
return
$status
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment