]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
offer to get rid of in-the-way directories
authorRudolf Polzer <divverent@xonotic.org>
Wed, 27 Jul 2011 17:53:34 +0000 (19:53 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Wed, 27 Jul 2011 17:53:34 +0000 (19:53 +0200)
all

diff --git a/all b/all
index 29928197ae8b4fdd86e78f6da91f23982c8b0e6d..9e1f3ec20c02f7792f86d381e39128fcdb6d87ed 100755 (executable)
--- a/all
+++ b/all
@@ -380,7 +380,7 @@ fix_upstream_rebase_mergefail()
 
 fix_git_config()
 {
-       if ! [ -d ".git" ]; then
+       if ! [ -f ".git/config" ]; then
                $ECHO "Not a git repository. Bailing out to not cause damage."
                exit 1
        fi
@@ -698,7 +698,7 @@ case "$cmd" in
                        url=`repourl "$d"`
                        pushurl=`repopushurl "$d"`
                        branch=`repobranch "$d"`
-                       if [ -d "$d0/$d" ]; then
+                       if [ -f "$d0/$d/.git/config" ]; then
                                # if we have .no file, skip
                                if [ -f "$d0/$d.no" ]; then
                                        msg "Repository $d disabled by a .no file, delete $d.no to enable; thus, not updated"
@@ -726,6 +726,14 @@ case "$cmd" in
                                        cd "$d0"
                                fi
                        else
+                               if [ -d "$d0/$d" ]; then
+                                       if yesno "$d0/$d is in the way, get rid of it?"; then
+                                               verbose rm -rf "$d0/$d"
+                                       else
+                                               echo "Note: $d0/$d will stay broken."
+                                               continue
+                                       fi
+                               fi
                                verbose git clone "$url" "$d0/$d"
                                enter "$d0/$d" verbose
                                fix_git_config "$url" "$pushurl"