blob: 47b4937e9fb9d6ab959444a25b6092412b18340c (
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
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
|
#!/usr/bin/env bash
# The common script is only meant to be included from other LLVM helper scripts
if [[ $LLVM_SRC = '' ]]; then
echo "Please, define \$LLVM_SRC"
exit -1
fi
if [[ $LLVM_BLD = '' ]]; then
echo "Please, define \$LLVM_BLD"
exit -1
fi
if [[ $LLVM_GITRW = '' ]]; then
echo "Please, define \$LLVM_GITRW"
exit -1
fi
if [[ $LLVM_GITUSER = '' ]]; then
echo "Please, define \$LLVM_GITUSER to access Linaro's Git server"
exit 1
fi
if [[ $LLVM_GITRW = 'yes' ]] && [[ $LLVM_SVNUSER = '' ]]; then
echo "Please, define \$LLVM_SVNUSER when using GITRW=yes"
echo "SVNUSER is your upstream LLVM commit user"
exit 1
fi
get_branch() {
branch=`git rev-parse --abbrev-ref HEAD`
if [[ $? != 0 ]]; then
local dir=`pwd`
echo "Source dir '$dir' is not in a git repository" 1>&2
exit -1
fi
echo $branch
}
get_branches() {
branches=`git for-each-ref --sort=-committerdate refs/heads/ --format='%(refname:short)'`
if [[ $? != 0 ]]; then
local dir=`pwd`
echo "Source dir '$dir' is not in a git repository" 1>&2
exit -1
fi
echo $branches
}
safe_run() {
"$@"
if [[ $? != 0 ]]; then
echo "'$@' failed, bailing out"
exit 1
fi
}
is_git() {
test -d `git rev-parse --show-toplevel`/.git
}
is_git_svn() {
test -f `git rev-parse --show-toplevel`/.git/svn/.metadata
}
|