X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=setup.sh;h=c2b3bb991526a65ae78e7058ef11729cc0a69d46;hb=95ec5924a6c2597f1b1a15aa9d6afcfe18bee222;hp=ff01b10bb234e5a2ece104847549010add812f91;hpb=c3582889fd9132a91a74d483dd165ed65bad47c5;p=config%2Fdotfiles.git diff --git a/setup.sh b/setup.sh index ff01b10..c2b3bb9 100755 --- a/setup.sh +++ b/setup.sh @@ -18,7 +18,7 @@ # along with this program. If not, see . -set -e +set -eu . ../lib.sh @@ -27,9 +27,28 @@ if installed git; then generate gitconfig .in simple_cpp \ PWD -- "`pwd`" - # Older Git versions don't support --patience. - if ! git diff --patience >/dev/null 2>&1; then - sed_i 's/--patience//' gitconfig + # Older Git versions don't support push.default = simple. + if ! git status >/dev/null 2>&1; then + echo 'gitconfig: removing push.default = simple' + grep_i -v '^[[:space:]]default = simple$' gitconfig + fi + # Even older Git versions don't support color.function. + if ! git status >/dev/null 2>&1; then + echo 'gitconfig: removing color.function' + sed_i 's/^[[:space:]]*function = .*//' gitconfig + fi + # Even older Git versions don't support git log --patch but only -p. + if ! git log --patch >/dev/null 2>&1; then + echo 'gitconfig: replacing git log --patch with -p' + sed_i 's/log --patch/log -p/' gitconfig + fi + + # If coloredstderr is used to color stderr then remove the workaround for + # missing output to stderr. + if test -n "${LD_PRELOAD:+set}" \ + && printf '%s' "$LD_PRELOAD" | grep libcoloredstderr.so >/dev/null; then + echo 'gitconfig: removing stderr fix' + sed_i '/^\t\(fs\|fg\) =/ s/2>&1//' gitconfig fi link gitconfig ~/.gitconfig @@ -44,5 +63,8 @@ if installed hg; then fi if installed cvs; then + # CVS doesn't support any comments nor empty lines in cvsrc. + grep -E -v '^#' cvsrc.in | grep -E -v '^$' >cvsrc + link cvsrc ~/.cvsrc fi