Compare commits

...

4 commits
master ... main

Author SHA1 Message Date
71d0bc5445 Remove bash-isms from set-main
Signed-off-by: William Brawner <me@wbrawner.com>
2021-09-16 21:38:12 -06:00
5b2422cf21 Add help entry for set-main
Signed-off-by: William Brawner <me@wbrawner.com>
2021-09-16 21:36:16 -06:00
61c1cdaf52 Add script to rename master branch to main
Signed-off-by: William Brawner <me@wbrawner.com>
2021-09-16 21:35:31 -06:00
1fc7d00b82 Remove .git suffix from repos
Signed-off-by: William Brawner <me@wbrawner.com>
2021-09-16 21:35:16 -06:00
6 changed files with 29 additions and 9 deletions

4
delete
View file

@ -7,11 +7,11 @@ if [[ -z "$1" ]]; then
exit 1
fi
if [[ ! -d "$1.git" ]]; then
if [[ ! -d "$1" ]]; then
echo "Repo $1 doesn't exist"
exit 1
fi
rm -rf "$1.git"
rm -rf "$1"
echo "Successfully deleted repository $1"

View file

@ -7,10 +7,10 @@ if [[ -z "$1" ]]; then
exit 1
fi
if [[ ! -d "$1.git" ]]; then
if [[ ! -d "$1" ]]; then
echo "Repo $1 doesn't exist"
exit 1
fi
vim "$1.git/description"
vim "$1/description"

1
help
View file

@ -11,5 +11,6 @@ Welcome to the Brawner home private git server. The available commands are liste
new [REPOSITORY_NAME] - create a new repository
notify-jenkins [REPOSITORY_NAME] - configure a repository to notify Jenkins of new commits
rename [OLD_REPOSITORY_NAME] [NEW_REPOSITORY_NAME] - rename a repository
set-main [REPOSITORY_NAME] - rename a repository's master branch to main
EOF

6
new
View file

@ -7,12 +7,12 @@ if [[ -z "$1" ]]; then
exit 1
fi
if [[ -d "$1.git" ]]; then
if [[ -d "$1" ]]; then
echo "Repo $1 already exists"
exit 1
fi
/usr/bin/git init --bare "$1.git"
/usr/bin/git -C "$1.git" config http.receivepack true
/usr/bin/git init --bare "$1"
/usr/bin/git -C "$1" config http.receivepack true
echo "Successfully created repository $1"

4
rename
View file

@ -10,11 +10,11 @@ if [[ -z "$2" ]]; then
exit 1
fi
if [[ -d "$2.git" ]]; then
if [[ -d "$2" ]]; then
echo "Repo $2 already exists"
exit 1
fi
mv "$1.git" "$2.git"
mv "$1" "$2"
echo "Successfully renamed repository $1 to $2"

19
set-main Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env sh
source "$(dirname "$0")/pre-script"
if [[ -z "$1" ]]; then
echo "Please enter a repository name"
exit 1
fi
if [[ ! -d "$1" ]]; then
echo "Repo $1 doesn't exist"
exit 1
fi
RET="$(pwd)"
cd $1
git symbolic-ref HEAD refs/heads/main
cd "$RET"