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

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

 



Andy Parkins wrote:
On Wednesday 2006 December 20 13:29, Johannes Sixt wrote:

+       cat "$GITMODULES" |
useless-use-of-cat-syndrome

I tried
 while
do done < file1 > file1

And that didn't work.

It wouldn't, since the redirection overwrites the file at the same time 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.

e.g.

0 $ echo true > t
0 $ sed 's/true/false/g' < t > t~ && mv t~ t || rm t~
0 $ cat t
false

and

0 $ echo true > t
0 $ (sed 's/true/false/g' < t > t~; false) && mv t~ t || rm t~
0 $ cat t
true
0 $ ls t~
ls: t~: No such file or directory
2 $

Rogan
-
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]