From c562e291c0adca7cb7dd2e1ce5ac26e1cd405603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= 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 From 791d3e1553d0a8b4103bb499fce26688b8cf217a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Sat, 8 Sep 2012 20:11:43 -0300 Subject: Retrieve help --- git-shell-commands/create-bare-repo | 5 +++-- 1 file changed, 3 insertions(+), 2 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 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 -- cgit v1.2.3 From 2a5839d898d5f029e7a8c0c276be9bac822e480d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= 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 From 2de9e49f22008c25fccfe79396e42e80b7c56cef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= 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 From 47d4a9eaa9f66aded2f0729d33b29d36e080ec05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= 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 From d1bdb09e361ec4a057356d9055068c837d0005ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= 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 From 76571cb2dc2644e9eb23758cd8da6d281d573994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Tue, 8 Oct 2013 11:58:22 -0300 Subject: Allow hidden repos --- git-shell-commands/create-bare-repo | 4 ++-- 1 file changed, 2 insertions(+), 2 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 -- cgit v1.2.3