git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Yann Dirson <ydirson@altern.org>
Date
Feb 2, 2007, 23:00 UTC
Message-ID
<20070202225900.30628.17382.stgit@gandelf.nowhere.earth>

__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@altern.org>
---

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
Next: Catalin Marinas
Message 1 of 2 in “Be tolerant to repos without .git/remotes/ or .git/branches/.”
  1. Be tolerant to repos without .git/remotes/ or .git/branches/.Yann Dirson, Feb 2, 2007
  2. Catalin MarinasFeb 2, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.