From: Jonathan Nieder <jrnieder@uchicago.edu>
To: git@vger.kernel.org
Cc: pasky@suse.cz
Subject: [TopGit PATCH/RFC fixup] suppress "cannot overwrite existing file" error
Date: Tue, 12 Aug 2008 13:21:13 -0500 (CDT) [thread overview]
Message-ID: <Pine.GSO.4.62.0808121317110.18832@harper.uchicago.edu> (raw)
In-Reply-To: <Pine.GSO.4.62.0808121309000.18832@harper.uchicago.edu>
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@uchicago.edu>
---
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
next prev parent reply other threads:[~2008-08-12 18:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-12 18:14 [TopGit PATCH/RFC] Do not use mktemp Jonathan Nieder
2008-08-12 18:21 ` Jonathan Nieder [this message]
2008-08-12 20:44 ` Petr Baudis
2008-08-12 21:07 ` Jonathan Nieder
2008-08-13 0:17 ` [TopGit PATCH] supply template argument to mktemp Jonathan Nieder
2008-08-13 5:16 ` [TopGit PATCH] tg-info: fix sed typo Jonathan Nieder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.GSO.4.62.0808121317110.18832@harper.uchicago.edu \
--to=jrnieder@uchicago.edu \
--cc=git@vger.kernel.org \
--cc=pasky@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).