From 5571c94c54512e8f851e68fb73f7ad83d80c9df5 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Fri, 27 Apr 2007 21:55:10 +0200 Subject: [PATCH] Fix few obscure fork-related bugs --- clone.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/clone.sh b/clone.sh index 3b7e0d9..738faad 100755 --- a/clone.sh +++ b/clone.sh @@ -22,7 +22,7 @@ bang() { # This removes any remnants from /srv/git/$proj.git _and_ gets rid # of the group record. perl -I/home/repo/repomgr/cgi -MGit::RepoCGI -e 'Git::RepoCGI::Project->ghost('"'$proj'"')->delete;' - cd .. && rm -r "$proj" + cd "$basedir" && rm -r "$proj"/* && rmdir -p "$proj" rm "$log" exit 1 fi @@ -33,7 +33,6 @@ if [ -s objects/info/alternates ]; then ref=(--reference "$(cat objects/info/alternates | sed 's/\.\.\/\.\.\/\.\./\/srv\/git/;s/objects$//')") fi bang git clone "${ref[@]}" --bare "$url" repodir -GIT_DIR=repodir bang git repack -a -d ! [ -d /srv/git/"$proj".git ] lproj="$(echo "$proj" | sed 's/^\(.*\/\)\(.*\)/\1/')" if [ z"$lproj" != z"$proj" ]; then @@ -45,13 +44,15 @@ bang mv base_url owner description homepage README.html /srv/git/"$proj".git/ #bang mv objects/info/alternates /srv/git/"$proj".git/objects/info/alternates # git clone should've set up that for us GIT_DIR=/srv/git/"$proj".git bang git config --bool --add mirror.allowed true GIT_DIR=/srv/git/"$proj".git bang git update-server-info -cd .. && rm -r "$proj" +cd "$basedir" && rm -r "$proj"/* && rmdir -p "$proj" # NO bang AT THIS POINT! rm -r depends on cwd. echo "Congratulations! You can adjust the project settings in the future at http://repo.or.cz/m/p/editproj.cgi." | mail -s "[repo.or.cz] $proj clone completed" "$mail",pasky@ucw.cz rm "$log" } -if [ -f base_url ]; then +basedir=$(pwd) + +if [ -f "$proj"/base_url ]; then cd "$proj" clone_project else -- 2.11.4.GIT