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

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

 



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
andyparkins@xxxxxxxxx
-
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]