mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-18 21:13:56 +01:00
git-srv-admin.sh: Add command update-descriptions
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
8477f45390
commit
f74fdbba17
1 changed files with 30 additions and 0 deletions
|
|
@ -94,6 +94,33 @@ create_repo()
|
||||||
git init --bare --shared=0640 || fatal "git init failed"
|
git init --bare --shared=0640 || fatal "git init failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_descriptions()
|
||||||
|
{
|
||||||
|
[ -d $pdir ] || return 0
|
||||||
|
cd $pdir || return 1
|
||||||
|
local projs="$*"
|
||||||
|
[ "$projs" = all ] && projs=`list_repos`
|
||||||
|
local proj
|
||||||
|
for proj in $projs; do
|
||||||
|
umask 0022
|
||||||
|
[ -d "$proj" ] || fatal "Failed to find project $pdir/$proj"
|
||||||
|
local tmp=`mktemp /tmp/$myname-XXXXXXX`
|
||||||
|
local descr=$proj/description
|
||||||
|
git -C $proj show HEAD:make/project.conf | sed -n '/^\[description\]/,/^\[/ p' | grep -v '\[' | cat -s | sed '${/^$/d;}' > $tmp
|
||||||
|
if [ -s "$tmp" ] && ! diff -q "$tmp" "$descr" >/dev/null 2>&1; then
|
||||||
|
chown --reference=$proj $tmp
|
||||||
|
chmod 640 $tmp
|
||||||
|
echo "====== Changing description of $proj"
|
||||||
|
echo '-- old --'
|
||||||
|
cat $descr
|
||||||
|
echo '-- new --'
|
||||||
|
cat $tmp
|
||||||
|
mv $tmp $descr
|
||||||
|
fi
|
||||||
|
rm -f $tmp
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
list_repos()
|
list_repos()
|
||||||
{
|
{
|
||||||
[ -d $pdir ] || return 0
|
[ -d $pdir ] || return 0
|
||||||
|
|
@ -188,6 +215,9 @@ create-personal-project|create-repo)
|
||||||
check_user_is_self
|
check_user_is_self
|
||||||
create_repo "$@"
|
create_repo "$@"
|
||||||
;;
|
;;
|
||||||
|
update-descriptions|update-descr)
|
||||||
|
update_descriptions "$@"
|
||||||
|
;;
|
||||||
list-personal-projects|list-repos)
|
list-personal-projects|list-repos)
|
||||||
list_repos "$@"
|
list_repos "$@"
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue