Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions artifacts/scripts/construct.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,28 @@ git gc --auto
# Lines not starting with '^' caret are printed as-is. Lines
# that do not start with a caret are printed ONLY if the previous
# line did not start with a caret
echo "Cleaning .git/packed-refs"
cp .git/packed-refs .git/packed-refs.bak
awk '
NR == 1 {
prev_line_start_with_caret = 0
}
/^[^^]/ {
prev_line_start_with_caret = 0
print
}
/^\^/ {
if (!prev_line_start_with_caret) {
if [ -f .git/packed-refs ]; then
echo "Cleaning .git/packed-refs"
cp .git/packed-refs .git/packed-refs.bak
awk '
NR == 1 {
prev_line_start_with_caret = 0
}
/^[^^]/ {
prev_line_start_with_caret = 0
Comment on lines +111 to +116
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like we are adding whitespace in front of the awk instructions each line. Will awk not be confused by that? Should it be

Suggested change
awk '
NR == 1 {
prev_line_start_with_caret = 0
}
/^[^^]/ {
prev_line_start_with_caret = 0
awk '
NR == 1 {
prev_line_start_with_caret = 0
}
/^[^^]/ {
prev_line_start_with_caret = 0

... etc?

print
}
prev_line_start_with_caret = 1
}
' .git/packed-refs.bak > .git/packed-refs
rm .git/packed-refs.bak
/^\^/ {
if (!prev_line_start_with_caret) {
print
}
prev_line_start_with_caret = 1
}
' .git/packed-refs.bak > .git/packed-refs
rm .git/packed-refs.bak
else
echo "No .git/packed-refs file, skipping cleanup."
fi

echo "Fetching from origin."
git fetch origin --no-tags --prune
Expand Down
Loading