[TopGit PATCH/RFC fixup] suppress "cannot overwrite existing file" error

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

 



We had been using sh -C ": >filename" to atomically create a file,
but this has the unfortunate side effect of producing an error
message if the file already exists.  So suppress the error.

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxxxxx>
---
	Here's a fix to a mistake in the patch I just sent.  If the
	patch was meant for application, I would be suggesting
	squashing this change in.  Sorry for the noise.

 tg.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tg.sh b/tg.sh
index c31256f..65375d6 100644
--- a/tg.sh
+++ b/tg.sh
@@ -85,14 +85,14 @@ branch_contains()
 # nonzero status on failure
 temp_filename()
 {
-	set -C && umask 077
+	umask 077
 	prefix=$1
 	i=0
 	suffix=$(awk 'BEGIN { srand(); rand(); print int(rand()*99999) }')
 	while test $i -lt 256
 	do
 		tmp=$prefix$suffix
-		: >"$tmp" && break
+		sh -C -c ': >"$tmp"' 2>/dev/null && break
 		i=$(($i+1))
 		suffix=$(($suffix+1))
 	done
-- 
1.6.0.rc2.531.g79a96

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

  Powered by Linux