summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2023-05-28 22:14:04 -0500
committerCase Duckworth2023-05-28 22:14:04 -0500
commit75a4fcbb3e220c2154044d966d5f8de2eeb96014 (patch)
tree02c90acc4dee3822f560d88d62c66b5d0d67802a
downloadgit-init-remote-75a4fcbb3e220c2154044d966d5f8de2eeb96014.tar.gz
git-init-remote-75a4fcbb3e220c2154044d966d5f8de2eeb96014.zip
Initial commit
-rwxr-xr-xgit-init-remote33
-rwxr-xr-xpost-update.hook15
2 files changed, 48 insertions, 0 deletions
diff --git a/git-init-remote b/git-init-remote new file mode 100755 index 0000000..4d8cb29 --- /dev/null +++ b/git-init-remote
@@ -0,0 +1,33 @@
1#!/bin/sh
2
3GITREMOTE=git.acdw.net
4GITROOT=/git
5
6git ls-files > /dev/null || exit 1
7
8# consider --git-dir as well .. however --git-dir would require more massaging
9# of the output.
10local="$(git rev-parse --show-toplevel)"
11name="${local##*/}"
12
13remote="$GITROOT/$name.git"
14
15## Remote work
16
17# Initiate the repository
18echo "ssh \"$GITREMOTE\" git init --bare \"$remote\""
19ssh "$GITREMOTE" git init --bare "$remote"
20
21# Add a description
22echo -n "Repo description: "; read
23echo "ssh \"$GITREMOTE\" sh -c \"echo '$REPLY' > '$remote'\""
24ssh "$GITREMOTE" sh -c "echo '$REPLY' > '$remote'"
25
26# Add post-update-hook
27echo "scp post-update.hook \"$GITREMOTE:$remote/hooks/post-update\""
28scp post-update.hook "$GITREMOTE:$remote/hooks/post-update"
29
30## Local work
31
32echo "git remote add origin \"$GITREMOTE:$remote\""
33git remote add origin "$GITREMOTE:$remote"
diff --git a/post-update.hook b/post-update.hook new file mode 100755 index 0000000..a68bf65 --- /dev/null +++ b/post-update.hook
@@ -0,0 +1,15 @@
1#!/bin/sh
2
3# Update "agefile" for cgit
4# The default location is <git-dir>/info/web/last-modified
5
6agefile="$(git rev-parse --git-dir)/info/web/last-modified"
7mkdir -p "$(dirname "$agefile")"
8
9git for-each-ref > "$agefile" \
10 --sort=-authordate --count=1 \
11 --format='%(authordate:iso8601)'
12
13# Prepare a packed repository for use over dumb transports
14
15git update-server-info