aboutsummaryrefslogtreecommitdiff
path: root/rsup
blob: 7ce96872b0f32592e6e77c223b6f426c65369ee0 (plain)
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
#!/bin/bash
#
# Recursively commit submodule changes
#
# Usage:
#
# From a submodule folder:
#
#   sup <message> # go upwards commit, until there's no parent repository

# Parameters
DIRNAME="`dirname $0`"
BASENAME="`basename $0`"
MESSAGE="$*"
GIT="hit"

# Check if it is a git repository
if [ ! -d ".git" ]; then
  echo "$BASENAME: not a git repository"
  exit 1
fi

# Default message
if [ -z "$MESSAGE" ]; then
  BASE="$(basename `pwd`)"
  MESSAGE="Updates $BASE"
fi

# Commit
commit $MESSAGE

# Got up
while -d "../.git"; do
  sup
  cd ..
done