Handle the .gitconfig-* files in .bashrc.
This commit is contained in:
parent
ce7fd7a1d8
commit
bc6373332e
1 changed files with 20 additions and 0 deletions
20
.bashrc
20
.bashrc
|
|
@ -558,6 +558,26 @@ hash ssh ssh-add >/dev/null 2>&1 && ssh() {
|
|||
command "${_EXEC:-${FUNCNAME[0]}}" "$@"
|
||||
}
|
||||
|
||||
# Handle the ~/.gitconfig link.
|
||||
if [[ -e "$HOME/.gitconfig-$USER@$HOSTNAME" ]]; then
|
||||
FILENAME=".gitconfig-$USER@$HOSTNAME"
|
||||
elif [[ -e "$HOME/.gitconfig-$USER@*.${HOSTNAME#*.}" ]]; then
|
||||
FILENAME=".gitconfig-$USER@*.${HOSTNAME#*.}"
|
||||
elif [[ -e "$HOME/.gitconfig-$USER@*" ]]; then
|
||||
FILENAME=".gitconfig-$USER@*"
|
||||
elif [[ -e "$HOME/.gitconfig-*@$HOSTNAME" ]]; then
|
||||
FILENAME=".gitconfig-*@$HOSTNAME"
|
||||
elif [[ -e "$HOME/.gitconfig-*.${HOSTNAME#*.}" ]]; then
|
||||
FILENAME=".gitconfig-*.${HOSTNAME#*.}"
|
||||
elif [[ -e "$HOME/.gitconfig-default" ]]; then
|
||||
FILENAME=".gitconfig-default"
|
||||
else
|
||||
(cd "$HOME" && [[ -L ".gitconfig" ]] && rm -f ".gitconfig")
|
||||
printf "%s: %s\\n" "${BASH_SOURCE##*/}" "failed to update .gitconfig symlink" >&2
|
||||
fi
|
||||
[[ -n "$FILENAME" ]] && (cd "$HOME" && ln -sf "$FILENAME" ".gitconfig")
|
||||
unset FILENAME
|
||||
|
||||
# Platform specific set up.
|
||||
if [[ "$PLATFORM" = "Linux" ]]; then
|
||||
# Linux specific functions.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue