mirror of
https://git.ludikovsky.name/git/fugitive.git
synced 2024-10-05 15:35:29 +02:00
added an install-config options to be used in pair with --install-hooks to transform any repos into a fugitive repos
This commit is contained in:
parent
fc7302f193
commit
65ffc98b87
44
install.sh
44
install.sh
|
@ -35,20 +35,9 @@ EOF
|
||||||
echo "done."
|
echo "done."
|
||||||
}
|
}
|
||||||
|
|
||||||
fugitive_install() {
|
fugitive_install_config() {
|
||||||
DIR="."
|
echo -n "Adding default fugitive settings to git config... "
|
||||||
if [ "$1" != "" ]; then DIR="$1"; fi
|
if [ "$1" = "remote" ]; then
|
||||||
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
|
|
||||||
git config --add receive.denyCurrentBranch "ignore"
|
git config --add receive.denyCurrentBranch "ignore"
|
||||||
fi
|
fi
|
||||||
git config --add fugitive.blog-url ""
|
git config --add fugitive.blog-url ""
|
||||||
|
@ -57,7 +46,19 @@ fugitive_install() {
|
||||||
git config --add fugitive.public-dir "_public"
|
git config --add fugitive.public-dir "_public"
|
||||||
git config --add fugitive.preproc ""
|
git config --add fugitive.preproc ""
|
||||||
echo "done."
|
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... "
|
echo -n "Preventing git to track temporary and generated files... "
|
||||||
cat >> .git/info/exclude <<EOF
|
cat >> .git/info/exclude <<EOF
|
||||||
*~
|
*~
|
||||||
|
@ -66,7 +67,7 @@ _public/archives.html
|
||||||
_public/feed.xml
|
_public/feed.xml
|
||||||
EOF
|
EOF
|
||||||
echo "done."
|
echo "done."
|
||||||
if [ "$2" = "local" ]; then
|
if [ "$1" = "local" ]; then
|
||||||
echo -n "Creating default directory tree... "
|
echo -n "Creating default directory tree... "
|
||||||
mkdir -p _drafts _articles _templates _public
|
mkdir -p _drafts _articles _templates _public
|
||||||
echo "done."
|
echo "done."
|
||||||
|
@ -110,7 +111,6 @@ EOF
|
||||||
fi
|
fi
|
||||||
echo "Installation complete, please set your blog url using"
|
echo "Installation complete, please set your blog url using"
|
||||||
echo '`git config fugitive.blog-url "<url>"`.'
|
echo '`git config fugitive.blog-url "<url>"`.'
|
||||||
cd - >/dev/null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fugitive_usage() {
|
fugitive_usage() {
|
||||||
|
@ -131,10 +131,16 @@ fugitive_help() {
|
||||||
fugitive_usage
|
fugitive_usage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DIR="."
|
||||||
|
if [ "$2" != "" ]; then DIR="$2"; fi
|
||||||
|
if [ ! -d "$DIR" ]; then mkdir -p "$DIR"; fi
|
||||||
|
cd "$DIR"
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"--help"|"-h") fugitive_help >&2;;
|
"--help"|"-h") fugitive_help >&2;;
|
||||||
"--install"|"--install-local") fugitive_install "$2" "local";;
|
"--install"|"--install-local") fugitive_install "local";;
|
||||||
"--install-remote") fugitive_install "$2" "remote";;
|
"--install-remote") fugitive_install "remote";;
|
||||||
"--install-hooks") fugitive_install_hooks ;;
|
"--install-hooks") fugitive_install_hooks ;;
|
||||||
|
"--install-config") fugitive_install_config "local";;
|
||||||
*) fugitive_usage >&2;;
|
*) fugitive_usage >&2;;
|
||||||
esac
|
esac
|
||||||
|
cd - >/dev/null
|
||||||
|
|
Loading…
Reference in a new issue