From c562e291c0adca7cb7dd2e1ce5ac26e1cd405603 Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Sat, 8 Sep 2012 20:00:33 -0300 Subject: Exit on error --- git-shell-commands/create-bare-repo | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'git-shell-commands/create-bare-repo') diff --git a/git-shell-commands/create-bare-repo b/git-shell-commands/create-bare-repo index 14a640b..b0174e2 100755 --- a/git-shell-commands/create-bare-repo +++ b/git-shell-commands/create-bare-repo @@ -2,15 +2,15 @@ # Allows users to create repo.git # $ ssh git@host create-bare-repo repo1 repo2 ... -set -E +set -e for i in $@; do # Cleanup names - i="`echo "$i" | sed "s/[^a-z0-9\.\-\_]//gi"`" + repo="`echo "$i" | sed "s/[^a-z0-9\.\-\_]//gi"`" - if [ -z "$i" ]; then continue; fi + if [ -z "$repo" ]; then continue; fi - mkdir "$i".git - pushd "$i".git + mkdir "$repo".git + pushd "$repo".git git init --bare done -- cgit v1.2.3-54-g00ecf From 791d3e1553d0a8b4103bb499fce26688b8cf217a Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Sat, 8 Sep 2012 20:11:43 -0300 Subject: Retrieve help --- git-shell-commands/change-description | 5 +++-- git-shell-commands/create-bare-repo | 5 +++-- git-shell-commands/help | 12 ++++++++++++ git-shell-commands/mirror | 5 +++-- 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100755 git-shell-commands/help (limited to 'git-shell-commands/create-bare-repo') diff --git a/git-shell-commands/change-description b/git-shell-commands/change-description index d29eaa8..c8abdab 100755 --- a/git-shell-commands/change-description +++ b/git-shell-commands/change-description @@ -1,6 +1,7 @@ #!/bin/sh -# Allows users to change project description -# $ ssh git@host change-description repo "description" +# * change-description +# Allows users to change project description +# ssh git@host change-description repo "description" set -e diff --git a/git-shell-commands/create-bare-repo b/git-shell-commands/create-bare-repo index b0174e2..ec98b33 100755 --- a/git-shell-commands/create-bare-repo +++ b/git-shell-commands/create-bare-repo @@ -1,6 +1,7 @@ #!/bin/sh -# Allows users to create repo.git -# $ ssh git@host create-bare-repo repo1 repo2 ... +# * create-bare-repo +# Allows users to create repo.git +# ssh git@host create-bare-repo repo1 repo2 ... set -e diff --git a/git-shell-commands/help b/git-shell-commands/help new file mode 100755 index 0000000..45f0bd6 --- /dev/null +++ b/git-shell-commands/help @@ -0,0 +1,12 @@ +#!/bin/sh +# * help +# Gets available commands +# ssh git@host help + +set -e + +# Gets three lines from every git-shell-command +for c in `dirname $0`/*; do + head -q -n4 $c | tail -n3 | sed "s/^..//" + echo +done diff --git a/git-shell-commands/mirror b/git-shell-commands/mirror index 6a2c254..c634b9e 100755 --- a/git-shell-commands/mirror +++ b/git-shell-commands/mirror @@ -1,6 +1,7 @@ #!/bin/sh -# Mirrors a repository -# ssh git@host mirror git://url/repo.git +# * mirror +# Mirrors a repository +# ssh git@host mirror git://url/repo.git set -E -- cgit v1.2.3-54-g00ecf From 2a5839d898d5f029e7a8c0c276be9bac822e480d Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Sun, 9 Sep 2012 17:06:10 -0300 Subject: Allow dashes on repo names --- git-shell-commands/create-bare-repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git-shell-commands/create-bare-repo') diff --git a/git-shell-commands/create-bare-repo b/git-shell-commands/create-bare-repo index ec98b33..6c83bc6 100755 --- a/git-shell-commands/create-bare-repo +++ b/git-shell-commands/create-bare-repo @@ -7,7 +7,7 @@ set -e for i in $@; do # Cleanup names - repo="`echo "$i" | sed "s/[^a-z0-9\.\-\_]//gi"`" + repo="`echo "$i" | sed "s/[^a-z0-9\._-]//gi"`" if [ -z "$repo" ]; then continue; fi -- cgit v1.2.3-54-g00ecf From 2de9e49f22008c25fccfe79396e42e80b7c56cef Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Wed, 11 Sep 2013 01:27:48 -0300 Subject: Since we're at it secure create-bare-repo too --- git-shell-commands/create-bare-repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git-shell-commands/create-bare-repo') diff --git a/git-shell-commands/create-bare-repo b/git-shell-commands/create-bare-repo index 6c83bc6..1e06580 100755 --- a/git-shell-commands/create-bare-repo +++ b/git-shell-commands/create-bare-repo @@ -7,7 +7,7 @@ set -e for i in $@; do # Cleanup names - repo="`echo "$i" | sed "s/[^a-z0-9\._-]//gi"`" + repo="`echo "$repo" | sed -e "s,^[/\.]\+,,g" -e "s,[^a-z0-9\./_-],,gi"`" if [ -z "$repo" ]; then continue; fi -- cgit v1.2.3-54-g00ecf From 47d4a9eaa9f66aded2f0729d33b29d36e080ec05 Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Wed, 11 Sep 2013 01:29:41 -0300 Subject: More fixups --- git-shell-commands/create-bare-repo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'git-shell-commands/create-bare-repo') diff --git a/git-shell-commands/create-bare-repo b/git-shell-commands/create-bare-repo index 1e06580..a6e49e3 100755 --- a/git-shell-commands/create-bare-repo +++ b/git-shell-commands/create-bare-repo @@ -5,13 +5,13 @@ set -e -for i in $@; do +for repo in $@; do # Cleanup names repo="`echo "$repo" | sed -e "s,^[/\.]\+,,g" -e "s,[^a-z0-9\./_-],,gi"`" + test ! -d "$repo".git && continue - if [ -z "$repo" ]; then continue; fi - - mkdir "$repo".git + mkdir -p "$repo".git pushd "$repo".git git init --bare + popd done -- cgit v1.2.3-54-g00ecf From d1bdb09e361ec4a057356d9055068c837d0005ba Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Tue, 17 Sep 2013 13:38:35 -0300 Subject: The test was inverted --- git-shell-commands/create-bare-repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git-shell-commands/create-bare-repo') diff --git a/git-shell-commands/create-bare-repo b/git-shell-commands/create-bare-repo index a6e49e3..7559fc3 100755 --- a/git-shell-commands/create-bare-repo +++ b/git-shell-commands/create-bare-repo @@ -8,7 +8,7 @@ set -e for repo in $@; do # Cleanup names repo="`echo "$repo" | sed -e "s,^[/\.]\+,,g" -e "s,[^a-z0-9\./_-],,gi"`" - test ! -d "$repo".git && continue + test -d "$repo".git && continue mkdir -p "$repo".git pushd "$repo".git -- cgit v1.2.3-54-g00ecf From 76571cb2dc2644e9eb23758cd8da6d281d573994 Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Tue, 8 Oct 2013 11:58:22 -0300 Subject: Allow hidden repos --- git-shell-commands/create-bare-repo | 4 ++-- git-shell-commands/delete-repo | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'git-shell-commands/create-bare-repo') diff --git a/git-shell-commands/create-bare-repo b/git-shell-commands/create-bare-repo index 7559fc3..3051c9d 100755 --- a/git-shell-commands/create-bare-repo +++ b/git-shell-commands/create-bare-repo @@ -6,8 +6,8 @@ set -e for repo in $@; do -# Cleanup names - repo="`echo "$repo" | sed -e "s,^[/\.]\+,,g" -e "s,[^a-z0-9\./_-],,gi"`" +# Cleanup names, allow hidden repos + repo="`echo "$repo" | sed -e "s/\.\.//g" -e "s,^/\+,,g" -e "s,[^a-z0-9\./_-],,gi"`" test -d "$repo".git && continue mkdir -p "$repo".git diff --git a/git-shell-commands/delete-repo b/git-shell-commands/delete-repo index 075f77a..4ca644e 100755 --- a/git-shell-commands/delete-repo +++ b/git-shell-commands/delete-repo @@ -7,7 +7,7 @@ set -e for repo in $@; do # Remove leading slashes and dots and perform cleanup - repo="`echo "$repo" | sed -e "s,^[/\.]\+,,g" -e "s,[^a-z0-9\./_-],,gi"`" + repo="`echo "$repo" | sed -e "s/\.\.//g" -e "s,^/\+,,g" -e "s,[^a-z0-9\./_-],,gi"`" test ! -d "$repo".git && continue echo "Removing ${repo}.git" -- cgit v1.2.3-54-g00ecf