]> git.phdru.name Git - git-scripts.git/commitdiff
Add script `init`
authorOleg Broytman <phd@phdru.name>
Thu, 20 Mar 2025 08:37:03 +0000 (11:37 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 20 Mar 2025 08:37:03 +0000 (11:37 +0300)
The primary goal is to automatically add the new repository
to `locate-all.list`.

init [new file with mode: 0755]

diff --git a/init b/init
new file mode 100755 (executable)
index 0000000..849ba89
--- /dev/null
+++ b/init
@@ -0,0 +1,17 @@
+#! /bin/sh
+
+if [ -n "$2" ]; then
+   echo "Usage: $0 [subdir]" >&2
+   exit 1
+fi
+
+set -e
+subdir="$1"
+
+if [ -n "$subdir" ]; then
+    mkdir -p "$subdir"
+    cd "$subdir"
+fi
+
+git init
+pwd >> "`dirname \"$0\"`"/locate-all.list