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, 14:34 UTC
Message-ID
<tnxr7bh188q.fsf@arm.com>
In-Reply-To
<4332BA3E.2080607@drzeus.cx>
Pierre Ossman <drzeus-list@drzeus.cx> wrote:
Show 8 quoted lines
>>Unfortunately, if the '---' line is missing, it consumes all the input
>>lines. Is this the case with your patch?
>
> Nope. It consumes the correct ammount of lines. The problem is that I
> have to give it a kick (^D) to start things twice. The first for
> __parse_patch() and the second for _input(). I put some debug-prints in
> there and the for-loops will not start executing on the first complete
> line, only EOF.
I tried it with reading from the terminal directly and you are right.

Using 'stg import -n patch < patch-file' is fine since the stdin is not re-opened and the _input() loop starts automatically.

'cat | stg import -n patch' also works fine since cat exits when stdin receives EOF.

It looks like a problem with Python since it re-opens sys.stdin once it receives EOF.

Show 8 quoted lines
>>>If you would cache the input to a file (or memory) you would remove both
>>>of these problems.
>>
>>True, but it requires more work than simply writing the patch to a
>>file and reading it twice.
>
> If it supports everything when given a filename then shouldn't adding a
> preprocessing step to dump stdin to disk give the same code path?

I was referring to the 'cache the input to memory' variant, which is a bit more complicated. Caching to a file is simple but do you need to read patches from the terminal directly?

-- 
Catalin
Previous: Pierre OssmanNext: Pierre Ossman
Message 6 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.