forked from DFHack/dfhack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-submodules.bash
More file actions
executable file
·40 lines (33 loc) · 864 Bytes
/
Copy pathupdate-submodules.bash
File metadata and controls
executable file
·40 lines (33 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -e
message_file=.git/COMMIT_EDITMSG
get_git_root() {
git rev-parse --show-toplevel
}
write_msg() {
echo "$@" >> "${message_file}"
}
git_root="$(get_git_root)"
cd "${git_root}"
rm -f "${message_file}"
write_msg "Auto-update submodules"
write_msg ""
cat ci/update-submodules.manifest | while read path branch; do
cd "${git_root}/${path}"
test "${git_root}" != "$(get_git_root)"
git fetch origin "${branch}:${branch}"
git checkout "${branch}"
git branch --set-upstream-to="origin/${branch}" "${branch}"
git pull --ff-only
cd "${git_root}"
if ! git diff --quiet --ignore-submodules=dirty -- "${path}"; then
git add "${path}"
write_msg "${path}: ${branch}"
fi
done
if ! git diff --exit-code --cached; then
git commit --file "${message_file}" --no-edit
exit 0
else
exit 1
fi