aboutsummaryrefslogtreecommitdiffstats
path: root/modules/gitmirror/templates/rsync-metadata.sh
blob: 7176cc5416a1f76f236aa9415096af3242787ffa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash

REPO="$1"
GITROOT="/git"
RSYNCROOT="rsync://valstar.mageia.org/git"

if [ ! -d "$GITROOT/$REPO" ]; then
	echo "No repository found $REPO" >&2
	exit 1
fi

cp -af "$GITROOT/$REPO/config" "$GITROOT/$REPO/config.orig"
/usr/bin/rsync -a --delete --include="description" --include="config" --include="info" --include="info/web" --include="info/web/last-modified" --exclude="*" "$RSYNCROOT/$REPO/" "$GITROOT/$REPO/"
cp -af "$GITROOT/$REPO/config" "$GITROOT/$REPO/config.upstream"
mv -f "$GITROOT/$REPO/config.orig" "$GITROOT/$REPO/config"

OWNER=$(git config --file "$GITROOT/$REPO/config.upstream" gitweb.owner)
DESC=$(git config --file "$GITROOT/$REPO/config.upstream" gitweb.description)
rm -f "$GITROOT/$REPO/config.upstream"

CUROWNER=$(git config --file "$GITROOT/$REPO/config" gitweb.owner)
if [ "$CUROWNER" != "$OWNER" ]; then
	git config --file "$GITROOT/$REPO/config" gitweb.owner "$OWNER"
fi

CURDESC=$(git config --file "$GITROOT/$REPO/config" gitweb.description)
if [ "$CURDESC" != "$DESC" ]; then
	git config --file "$GITROOT/$REPO/config" gitweb.owner "$DESC"
fi