-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-sys-update
executable file
·67 lines (57 loc) · 1.05 KB
/
git-sys-update
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
do_save=0
if test "x$1" = "x--save"
then
shift
do_save=1
fi
do_rebase=0
if test "x$1" = "x--rebase"
then
shift
do_rebase=1
fi
if test "x$1" = "x--help" || test "x$1" = "x-h"
then
echo "git sys-update - Get commits from a forein repository"
echo
echo "Usage: git sys-update [options] <variant1> <variant2> ..."
echo
echo "Options:"
echo " --save - Save variants to /etc/sysgit/variants and use"
echo " them as default."
echo " --rebase - Perfom git rebase instead of git merge."
echo " --help - Show this help message."
exit 2
fi
if test "x${1}" = "x"
then
variants="base"
if test -f "/etc/sysgit/variant"
then
variants="$(cat "/etc/sysgit/variant")"
fi
else
variants="$@"
fi
if test "x${do_save}" = "x1"
then
echo "$@" >"/etc/sysgit/variant"
fi
cd /
git fetch --all
for v in ${variants}
do
if test "x$(echo "${v}" | grep "/")" = "x"
then
v="upstream/${v}"
fi
echo "Updating variant: ${v}"
if test "x${do_rebase}" = "x1"
then
git rebase --fork-point "${v}"
else
git merge "${v}"
fi
done
#/.sysgit/init.sh update