[PATCH] Be tolerant to repos without .git/remotes/ or .git/branches/.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



__remotes_from_dir() was not robust against non-existent dirs.
This a Git 1.5 compat issue, since repos do not have .git/remotes any
more.

Signed-off-by: Yann Dirson <ydirson@xxxxxxxxxx>
---

This problem prevented me from seeing the t1200 regression you
reported, but once this one is fixed I do hit a problem there.

 stgit/git.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/stgit/git.py b/stgit/git.py
index 022d607..069833d 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -904,7 +904,11 @@ def __remotes_from_config():
     return config.sections_matching(r'remote\.(.*)\.url')
 
 def __remotes_from_dir(dir):
-    return os.listdir(os.path.join(basedir.get(), dir))
+    absdir=os.path.join(basedir.get(), dir)
+    if os.path.isdir(absdir):
+        return os.listdir(absdir)
+    else:
+        return []
 
 def remotes_list():
     """Return the list of remotes in the repository
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]