From 65ffc98b8781d2f13505c78098f5fe7499eec979 Mon Sep 17 00:00:00 2001 From: p4bl0 Date: Fri, 24 Sep 2010 15:12:41 +0200 Subject: added an install-config options to be used in pair with --install-hooks to transform any repos into a fugitive repos --- install.sh | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'install.sh') diff --git a/install.sh b/install.sh index 7a2401c..3d54d24 100644 --- a/install.sh +++ b/install.sh @@ -35,20 +35,9 @@ EOF echo "done." } -fugitive_install() { - DIR="." - if [ "$1" != "" ]; then DIR="$1"; fi - if [ ! -d "$DIR" ]; then mkdir -p "$DIR"; fi - cd "$DIR" - if [ -d ".git" ]; then - echo "There's already a git repository here, aborting install." - exit 1 - fi - echo -n "Creating new git repository... " - git init >/dev/null - echo "done." - echo -n "Adding default settings to git config... " - if [ "$2" = "remote" ]; then +fugitive_install_config() { + echo -n "Adding default fugitive settings to git config... " + if [ "$1" = "remote" ]; then git config --add receive.denyCurrentBranch "ignore" fi git config --add fugitive.blog-url "" @@ -57,7 +46,19 @@ fugitive_install() { git config --add fugitive.public-dir "_public" git config --add fugitive.preproc "" echo "done." - fugitive_install_hooks + +} + +fugitive_install() { + if [ -d ".git" ]; then + echo "There's already a git repository here, aborting install." + exit 1 + fi + echo -n "Creating new git repository... " + git init >/dev/null + echo "done." + fugitive_install_config + fugitive_install_hooks "$1" echo -n "Preventing git to track temporary and generated files... " cat >> .git/info/exclude <"`.' - cd - >/dev/null } fugitive_usage() { @@ -131,10 +131,16 @@ fugitive_help() { fugitive_usage } +DIR="." +if [ "$2" != "" ]; then DIR="$2"; fi +if [ ! -d "$DIR" ]; then mkdir -p "$DIR"; fi +cd "$DIR" case "$1" in "--help"|"-h") fugitive_help >&2;; - "--install"|"--install-local") fugitive_install "$2" "local";; - "--install-remote") fugitive_install "$2" "remote";; - "--install-hooks") fugitive_install_hooks;; + "--install"|"--install-local") fugitive_install "local";; + "--install-remote") fugitive_install "remote";; + "--install-hooks") fugitive_install_hooks ;; + "--install-config") fugitive_install_config "local";; *) fugitive_usage >&2;; esac +cd - >/dev/null -- cgit v1.2.3