Revisions
-
asymmetric revised this gist
May 30, 2010 . 2 changed files with 2 additions and 4 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +0,0 @@ This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,11 +28,11 @@ function is_bare_repo () { pushd "$1" &>/dev/null if [ "$(git rev-parse --is-inside-git-dir 2>/dev/null)" == "true" ]; then if [ "$(git rev-parse --is-bare-repository 2>/dev/null)" == "true" ]; then popd >/dev/null return $? fi fi popd >/dev/null return 1 } -
asymmetric revised this gist
May 30, 2010 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,11 +28,11 @@ function is_bare_repo () { pushd "$1" &>/dev/null if [ "$(git rev-parse --is-inside-git-dir 2>/dev/null)" == "true" ]; then if [ "$(git rev-parse --is-bare-repository 2>/dev/null)" == "true" ]; then popd 1>/dev/null return $? fi fi popd 1>/dev/null return 1 } -
asymmetric revised this gist
May 30, 2010 . 2 changed files with 3 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ *.*~ *.swp This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,7 +29,7 @@ function is_bare_repo () { if [ "$(git rev-parse --is-inside-git-dir 2>/dev/null)" == "true" ]; then if [ "$(git rev-parse --is-bare-repository 2>/dev/null)" == "true" ]; then popd &>/dev/null return $? fi fi popd &>/dev/null -
crmne revised this gist
May 29, 2010 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,11 @@ #!/bin/bash -e # Your user web directory, typically "${HOME}/public_html" or "${HOME}/Sites" PUBLIC_HTML="${HOME}/Sites" # Subfolder of $PUBLIC_HTML where to put your shared repositories PUBLIC_GIT="git" # Save the shared repository with this remote name REMOTE="public" # The branch that will be pushed to your shared repository BRANCH="master" function get_public_paths () { -
crmne created this gist
May 28, 2010 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,85 @@ #!/bin/bash -e PUBLIC_HTML="${HOME}/Sites" PUBLIC_GIT="git" REMOTE="public" BRANCH="master" function get_public_paths () { repo_name="$(basename "$top_level_dir").git" public_dir="${PUBLIC_HTML}/${PUBLIC_GIT}/${repo_name}" public_url="http://$(hostname)/~${USER}/${PUBLIC_GIT}/${repo_name}" } function get_top_level_dir () { if [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" == "true" ]; then top_level_dir="$(git rev-parse --show-toplevel)" else echo "This is not a directory managed by git" exit 1 fi } # Takes the complete path of the public repo, including .git function is_bare_repo () { pushd "$1" &>/dev/null if [ "$(git rev-parse --is-inside-git-dir 2>/dev/null)" == "true" ]; then if [ "$(git rev-parse --is-bare-repository 2>/dev/null)" == "true" ]; then popd &>/dev/null return 0 fi fi popd &>/dev/null return 1 } # Takes the complete path of the public repo, including .git function create_public_repo () { mkdir -p "$1" pushd "$1" &>/dev/null git --bare init popd &>/dev/null } # Takes the complete path of the public repo, including .git function push_to_public_repo () { until git remote add $REMOTE "$1"; do echo -n "Enter a new remote name: " read REMOTE done git push $REMOTE $BRANCH } # Takes the complete path of the public repo, including .git function enable_http_sharing () { pushd "$1" &>/dev/null git --bare update-server-info # chmod a+x hooks/post-update popd &>/dev/null } function clean () { if [ was_unpublished ]; then rm -rf "$public_dir" fi exit 1 } get_top_level_dir get_public_paths trap clean INT if [ -d "$public_dir" ]; then if is_bare_repo "$public_dir"; then echo "Already published in $public_dir" echo "Public URL: $public_url" else echo "Directory $public_dir already exists but it's not a git bare repo" fi else was_unpublished=1 create_public_repo $public_dir push_to_public_repo $public_dir enable_http_sharing $public_dir echo "Public URL: $public_url" fi