-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.sh
More file actions
executable file
·98 lines (83 loc) · 3.86 KB
/
config.sh
File metadata and controls
executable file
·98 lines (83 loc) · 3.86 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
# GIT_GLOBAL_CONFIG allow to specify if config shall be applied globally or locally
[[ ${GIT_GLOBAL_CONFIG} ]] && GIT_GLOBAL_CONFIG_SWITCH="--global"
echo "INF Installing GIT Configuration"
if [[ -e config.env ]]
then
source config.env
git config ${GIT_GLOBAL_CONFIG_SWITCH} user.email "${GIT_USER_EMAIL}"
[[ -e private-config.env ]] && source private-config.env
# AUTH
git config ${GIT_GLOBAL_CONFIG_SWITCH} user.name "${GIT_USER_NAME}"
git config ${GIT_GLOBAL_CONFIG_SWITCH} credential.https://github.com.username ${GIT_CRED_GITHUB_NAME:-GIT_CRED_DEFAULT_NAME}
git config ${GIT_GLOBAL_CONFIG_SWITCH} credential.https://gitlab.com.username ${GIT_CRED_GITLAB_NAME:-GIT_CRED_DEFAULT_NAME}
git config ${GIT_GLOBAL_CONFIG_SWITCH} credential.username "${GIT_CRED_DEFAULT_NAME:-$GIT_USER_NAME}"
# because credential is cumulative, reset all occurrences before adding new cache
git config ${GIT_GLOBAL_CONFIG_SWITCH} --unset-all credential.helper
# cache passwords for 1 days
git config ${GIT_GLOBAL_CONFIG_SWITCH} credential.helper 'cache --timeout 86400'
else
echo "INF Please set up your configuration in config.env file"
fi
# Proxy configuration
#git config ${GIT_GLOBAL_CONFIG_SWITCH} http.proxy $PROXY_INFO
#git config ${GIT_GLOBAL_CONFIG_SWITCH} https.proxy $PROXY_INFO
# SIGN
SIGN_SWITCH=""
if [[ "${GIT_SIGNING_KEY}" ]]
then
echo "INF Installing signing key"
git config ${GIT_GLOBAL_CONFIG_SWITCH} user.signingkey ${GIT_SIGNING_KEY}
git config ${GIT_GLOBAL_CONFIG_SWITCH} commit.gpgsign true
# Cache the passphrase for 10min
sed -i 's/default-cache-ttl.*/default-cache-ttl 600/' ~/.gnupg/gpg-agent.conf 2>/dev/null || echo "default-cache-ttl 600" >> ~/.gnupg/gpg-agent.conf
SIGN_SWITCH="-s"
if hash gpg2 > /dev/null 2>&1
then
git config ${GIT_GLOBAL_CONFIG_SWITCH} gpg.program gpg2
else
echo "WAR Please install gpg2 !"
fi
else
git config ${GIT_GLOBAL_CONFIG_SWITCH} --unset user.signingkey
git config ${GIT_GLOBAL_CONFIG_SWITCH} commit.gpgsign false
echo "WAR No signingKey found !"
fi
export SIGN_SWITCH
# PUSH METHOD
git config ${GIT_GLOBAL_CONFIG_SWITCH} push.default current
# Push tags automatically
git config ${GIT_GLOBAL_CONFIG_SWITCH} push.followTags
git config ${GIT_GLOBAL_CONFIG_SWITCH} core.autocrlf input
# VIZ
# Colorize outputs
git config ${GIT_GLOBAL_CONFIG_SWITCH} color.ui true
git config ${GIT_GLOBAL_CONFIG_SWITCH} color.branch true
git config ${GIT_GLOBAL_CONFIG_SWITCH} color.diff true
git config ${GIT_GLOBAL_CONFIG_SWITCH} color.grep true
git config ${GIT_GLOBAL_CONFIG_SWITCH} color.pager true
# Use VI as default editor
git config ${GIT_GLOBAL_CONFIG_SWITCH} core.editor vi
# Enable the recording of resolved conflicts, so that identical hunks can be resolved automatically later on
git config ${GIT_GLOBAL_CONFIG_SWITCH} rerere.enabled true
# Always show a diffstat at the end of a merge
git config ${GIT_GLOBAL_CONFIG_SWITCH} merge.stat true
# DIFF / MERGE
if test ${GIT_GRAPHICAL}
then
git config ${GIT_GLOBAL_CONFIG_SWITCH} diff.tool 'meld'
git config ${GIT_GLOBAL_CONFIG_SWITCH} merge.tool 'meld'
fi
# Compute a better diff (see http://stackoverflow.com/questions/32365271/whats-the-difference-between-git-diff-patience-and-git-diff-histogram/32367597#32367597)
git config ${GIT_GLOBAL_CONFIG_SWITCH} diff.algorithm histogram
# Group diff elements smarter
git config ${GIT_GLOBAL_CONFIG_SWITCH} diff.compactionHeuristic true
# Check for renames/moves
git config ${GIT_GLOBAL_CONFIG_SWITCH} diff.renames true
# Display
git config ${GIT_GLOBAL_CONFIG_SWITCH} core.whitespace -trailing-space,-indent-with-non-tab,-tab-in-indent
# Git flow
git config ${GIT_GLOBAL_CONFIG_SWITCH} gitflow.feature.finish.no-ff true
git config ${GIT_GLOBAL_CONFIG_SWITCH} gitflow.bugfix.finish.no-ff true
git config ${GIT_GLOBAL_CONFIG_SWITCH} gitflow.hotfix.finish.no-ff true
git config ${GIT_GLOBAL_CONFIG_SWITCH} gitflow.support.finish.no-ff true