@@ -13,15 +13,15 @@ repo=origin
13
13
14
14
# Parse arg flags
15
15
while : ; do
16
- if [[ $1 = " -v" || $1 = " --verbose" ]]; then
17
- verbose=true
18
- shift
19
- elif [[ $1 = " -s" || $1 = " --setup" ]]; then
20
- setup=true
21
- shift
22
- else
23
- break
24
- fi
16
+ if [[ $1 = " -v" || $1 = " --verbose" ]]; then
17
+ verbose=true
18
+ shift
19
+ elif [[ $1 = " -s" || $1 = " --setup" ]]; then
20
+ setup=true
21
+ shift
22
+ else
23
+ break
24
+ fi
25
25
done
26
26
27
27
# echo expanded commands as they are executed (for debugging)
@@ -40,26 +40,8 @@ function disable_expanded_output {
40
40
fi
41
41
}
42
42
43
- function setup_repo {
44
- mkdir -p $deploy_directory
45
- git --work-tree $deploy_directory checkout --orphan $deploy_branch
46
- git --work-tree $deploy_directory rm -r " *"
47
- git --work-tree $deploy_directory add --all
48
- git --work-tree $deploy_directory commit -m " initial publish"
49
- git push origin $deploy_branch
50
- git symbolic-ref HEAD refs/heads/master && git reset --mixed
51
- }
52
-
53
43
enable_expanded_output
54
44
55
- if [ $setup ]; then
56
- setup_repo
57
- exit
58
- fi
59
-
60
- commit_title=` git log -n 1 --format=" %s" HEAD`
61
- commit_hash=` git log -n 1 --format=" %H" HEAD`
62
-
63
45
function set_user_id {
64
46
if [[ -z ` git config user.name` ]]; then
65
47
git config user.name " $default_username "
@@ -69,8 +51,21 @@ function set_user_id {
69
51
fi
70
52
}
71
53
54
+ commit_title=` git log -n 1 --format=" %s" HEAD`
55
+ commit_hash=` git log -n 1 --format=" %H" HEAD`
72
56
previous_branch=` git rev-parse --abbrev-ref HEAD`
73
57
58
+ if [ $setup ]; then
59
+ mkdir -p $deploy_directory
60
+ git --work-tree $deploy_directory checkout --orphan $deploy_branch
61
+ git --work-tree $deploy_directory rm -r " *"
62
+ git --work-tree $deploy_directory add --all
63
+ git --work-tree $deploy_directory commit -m " initial publish"
64
+ git push origin $deploy_branch
65
+ git symbolic-ref HEAD refs/heads/master && git reset --mixed
66
+ exit
67
+ fi
68
+
74
69
if ! git diff --exit-code --quiet --cached; then
75
70
echo Aborting due to uncommitted changes in the index
76
71
exit 1
0 commit comments