summaryrefslogtreecommitdiffstats
path: root/submodule.sh
blob: e5792cd505d0e55b44f7f0b610fb28bcb9ef4c0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env fish

set -l updated
set -l msgs
for submodule in (git submodule | awk '{ print $2 }')
  set diff_msg (git diff --submodule "$submodule")
  if test -n "$diff_msg"
    set -a updated "$submodule"
    set -a msgs $diff_msg
  end
end

if test -n "$updated"
  git add $updated
  git commit -m "Updated submodules: $(string join ', ' $updated)" \
    -m "$(string collect -N $msgs)"
end