commit 83c166df135cd30b9a1f1750a96b1e23cf6950d8
parent c34d315930c845d8a651e4f953eee6d2f46a06ca
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Wed, 1 May 2024 16:14:18 +0200
Give user more information on repo creation
Diffstat:
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/bin/git_create_repo.sh b/bin/git_create_repo.sh
@@ -27,6 +27,13 @@ if [ -d "${1}/${2}/${3}.git" ]; then
exit 1;
fi
+# Retrieve URL if set
+if [ -f "${1}/url" ]; then
+ URL=`cat ${1}/url`
+else
+ URL=""
+fi
+
# Create Folders
mkdir -p "${1}/${2}/${3}/"
mkdir -p "${1}/${2}/${3}/exports/"
@@ -66,3 +73,5 @@ echo "exec ~/bin/git_post_push.sh \"${1}\" \"${2}\" \"${3}\"" >> "$PUH_FILE"
# make branch cloneable via http(s)
git update-server-info
+# User output
+echo "The repository is available via git clone ${URL}/${2}/${3}.git"
diff --git a/create_repo/index.php b/create_repo/index.php
@@ -56,12 +56,13 @@ $repo_owner = preg_replace(
<?php
- # check whether type and name are given (description and owner may be empty)
- if ($repo_type == "" || $repo_name == "") {
+ # check whether all variables are set
+ if ($repo_type == "" || $repo_name == "" || $repo_desc == "" || $repo_owner == "") {
$content = "<p id=\"status\"></p>";
} else {
passthru(
$_SERVER['DOCUMENT_ROOT'] . "/bin/git_create_repo.sh " .
+ "\"" . $_SERVER['DOCUMENT_ROOT'] . "\" " .
"\"" . $repo_type . "\" " .
"\"" . $repo_name . "\" " .
"\"" . $repo_desc . "\" " .
@@ -76,11 +77,11 @@ $repo_owner = preg_replace(
<form method="GET">
<label for="name">Repository Name</label><br>
- <input type="text" id="name" name="name" maxlength="30" placeholder="my_new_project" required><br>
+ <input type="text" id="name" name="name" maxlength="30" placeholder="my_new_project" default=<?php echo "\"" . $repo_name . "\""; ?>required><br>
<label for="description">Repository Description</label><br>
- <input type="text" id="description" name="description" maxlength="100" placeholder="This project is about..."><br>
+ <input type="text" id="description" name="description" maxlength="100" placeholder="This project is about..." default=<?php echo "\"" . $repo_desc . "\""; ?>><br>
<label for="owner" >Repository Owner</label><br>
- <input type="text" id="owner" name="owner"maxlength="30"placeholder="Me"><br>
+ <input type="text" id="owner" name="owner"maxlength="30"placeholder="Me" default=<?php echo "\"" . $repo_owner . "\""; ?>><br>
<label for="type">Repository Type</label><br>
<select name="type" required>
<option value="priv" selected>Private</option>