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

Re: StGIT cannot import properly from stdin

From
CMCatalin Marinas <catalin.marinas@gmail.com>
Date
Sep 22, 2005, 15:48 UTC
Message-ID
<tnxmzm514tv.fsf@arm.com>
In-Reply-To
<b0943d9e050922084232f704d@mail.gmail.com>
Catalin Marinas <catalin.marinas@gmail.com> wrote:
> It works, thanks for this. I attached a patch if you want to try.

Oops, gmail attached it as a binary. It is inserted below (as text/plain):

====================================================== Fix importing from stdin

The current stdin patch importing expects two EOFs since the 'for' loop doesn't start before one EOF is received. As suggested, this patch changes the 'for' loop with a 'while True' loop.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
 stgit/commands/imprt.py |    6 +++++-
 stgit/git.py            |    5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/stgit/commands/imprt.py b/stgit/commands/imprt.py
--- a/stgit/commands/imprt.py
+++ b/stgit/commands/imprt.py
@@ -134,7 +134,11 @@ def __parse_patch(filename = None):
     authname = authemail = authdate = None
 
     descr = ''
-    for line in f:
+    while True:
+        line = f.readline()
+        if not line:
+            break
+
         # the first 'Signed-of-by:' is the author
         if not authname and re.match('signed-off-by:\s+', line, re.I):
             auth = re.findall('^.*?:\s+(.*)$', line)[0]
diff --git a/stgit/git.py b/stgit/git.py
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -113,7 +113,10 @@ def get_conflicts():
 
 def _input(cmd, file_desc):
     p = popen2.Popen3(cmd)
-    for line in file_desc:
+    while True:
+        line = file_desc.readline()
+        if not line:
+            break
         p.tochild.write(line)
     p.tochild.close()
     if p.wait():
Previous: Catalin Marinas
Message 9 of 9 in “StGIT cannot import properly from stdin”
  1. Pierre OssmanSep 21, 2005
  2. Catalin MarinasSep 21, 2005
  3. Pierre OssmanSep 22, 2005
  4. Catalin MarinasSep 22, 2005
  5. Pierre OssmanSep 22, 2005
  6. Catalin MarinasSep 22, 2005
  7. Pierre OssmanSep 22, 2005
  8. Catalin MarinasSep 22, 2005
  9. Catalin MarinasSep 22, 2005

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.