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

Re: [RFC/PATCH] Implement poor-man's submodule support using commit hooks

From
APAndy Parkins <andyparkins@gmail.com>
Date
Dec 20, 2006, 14:40 UTC
Message-ID
<200612201440.41784.andyparkins@gmail.com>
In-Reply-To
<458949C4.1020207@dawes.za.net>
On Wednesday 2006 December 20 14:33, Rogan Dawes wrote:
> It wouldn't, since the redirection overwrites the file at the same time

Of course you are correct; however it wasn't completely crazy. Before now, I've replaced files in C by doing

 fd_old = open( "someexistingfile" );
 unlink( "someexistingfile" );
 fd_new = open( "someexistingfile" );
So I was really just trying it in case bash did a similar thing internally.
> as trying to read from it. A better way is to redirect to a temp file,
> and rename it if the previous operation was successful.

That's what I ended up doing; as you say it's better anyway because the error conditions don't mean that the .gitmodules file ends up half written.

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIEE
Previous: Rogan DawesNext: Randal L. Schwartz
Message 7 of 14 in “Implement poor-man's submodule support using commit hooks”
  1. Implement poor-man's submodule support using commit hooksAndy Parkins, Dec 20, 2006
  2. Johannes SixtDec 20, 2006
  3. Andy ParkinsDec 20, 2006
  4. Jakub NarebskiDec 20, 2006
  5. Andy ParkinsDec 20, 2006
  6. Rogan DawesDec 20, 2006
  7. Andy ParkinsDec 20, 2006
  8. Randal L. SchwartzDec 20, 2006
  9. Johannes SchindelinDec 20, 2006
  10. Martin WaitzDec 20, 2006
  11. Andy ParkinsDec 20, 2006
  12. Andy ParkinsDec 20, 2006
  13. Martin WaitzDec 20, 2006
  14. Johannes SixtDec 20, 2006

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.