Make path references OS independent

Change-Id: I5573995adfd52fd54bddc62d1d1ea78fb1328130
diff --git a/repo b/repo
index ff7c418..3a545cc 100755
--- a/repo
+++ b/repo
@@ -432,10 +432,14 @@
   dir = os.getcwd()
   repo = None
 
-  while dir != '/' and not repo:
+  olddir = None
+  while dir != '/' \
+    and dir != olddir \
+    and not repo:
     repo = os.path.join(dir, repodir, REPO_MAIN)
     if not os.path.isfile(repo):
       repo = None
+      olddir = dir
       dir = os.path.dirname(dir)
   return (repo, os.path.join(dir, repodir))