From 064dbf0753958f9260d31015db31fe11dcda0e1d Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Mon, 29 May 2017 16:49:42 +0300 Subject: [PATCH] - Fix issues in bashrc when sourced in a script (like the post-merge git hook). - Fix issue with failure to source bashrc in the post-merge git hook (file not found issue). --- .bashrc | 4 ++-- .githooks/post-merge | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.bashrc b/.bashrc index c931ffb..b9cbac3 100644 --- a/.bashrc +++ b/.bashrc @@ -7,7 +7,7 @@ export HISTCONTROL=ignoreboth:erasedups export HISTSIZE=100000 export HISTFILESIZE=100000 export PROMPT_COMMAND="history -a; $PROMPT_COMMAND" -if [ -n "$BASH" ] +if [ -n "${BASH:-}" ] then shopt -s histappend shopt -s checkwinsize @@ -26,7 +26,7 @@ fi [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # set variable identifying the chroot you work in (used in the prompt below) -if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi diff --git a/.githooks/post-merge b/.githooks/post-merge index 75d4c20..eca1139 100755 --- a/.githooks/post-merge +++ b/.githooks/post-merge @@ -1,4 +1,5 @@ #!/bin/sh set -eu -. .bashrc +cd "$(git rev-parse --show-toplevel)" +. ./.bashrc gen-ssh-config -- GitLab