Skip to content

Commit 48f0f10

Browse files
authored
Merge pull request #35 from EventAccess/pr-update
Improve update.sh
2 parents b535b91 + d993474 commit 48f0f10

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

update.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ function update_default_branch() {
1616
if ! git pull --ff-only origin "${default_branch}" \
1717
&& [ -z "$current_branch" ] \
1818
&& [ -n "$(git status --porcelain --ignore-submodules=dirty)" ]; then
19-
# Not sure exactly how this happened,
20-
# possibly due to failed dev:dev fetch in an earlier iteration.
19+
# We get into detached head with git submodule update --init
2120
echo
2221
pwd
2322
echo
@@ -38,10 +37,22 @@ function update_default_branch() {
3837

3938
# Set up (ssh) push access for submodules
4039
function ensure_ssh_push_submodules() {
40+
if test -f .git-blame-ignore-revs; then
41+
git config --local blame.ignoreRevsFile .git-blame-ignore-revs
42+
else
43+
git config --local blame.ignoreRevsFile ""
44+
fi
45+
4146
if test -f .gitmodules; then
47+
# Initialize git submodules
48+
git submodule init
49+
4250
IN=$(sed -Ezn 's!\[submodule\ "[^"]+"\].*?(\s*(path\s*=\s*([^\n]+)|url\s*=\s*([^\n]+))){2}!\3\t\4!gmp' .gitmodules)
4351

4452
while IFS= read -r line; do
53+
if test -z "${line[@]}"; then
54+
continue
55+
fi
4556
IFS=$'\t' read -ra LINE <<< "${line[@]}"
4657
dir="${LINE[0]}"
4758
url="${LINE[1]}"
@@ -63,7 +74,7 @@ function ensure_ssh_push_submodules() {
6374
update_default_branch
6475

6576
# Initialize git submodules
66-
git submodule update --init --recursive
77+
git submodule init
6778

6879
ensure_ssh_push_submodules
6980

0 commit comments

Comments
 (0)