From: Bert Wesarg <bert.wesarg@googlemail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: git@vger.kernel.org, pasky@suse.cz,
martin f krafft <madduck@madduck.net>
Subject: Re: [TopGit PATCHv2] provide global temporary directory
Date: Sun, 10 Oct 2010 09:47:47 +0200 [thread overview]
Message-ID: <AANLkTikuEa6TQpEnv=0y3v18W9H8sC4SQ+5vdTvBW7LF@mail.gmail.com> (raw)
In-Reply-To: <20101009215302.GR29673@pengutronix.de>
2010/10/9 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> On Sat, Oct 09, 2010 at 11:41:47PM +0200, Bert Wesarg wrote:
>> +# get_temp NAME [-d]
> I like your patch in general, but would prefer to have
>
> # get_temp [-d] NAME
But that would complicate the argument evaluation, wouldn't it:
get_temp()
{
if [ $# -eq 2 ]; then
mktemp $1 "$tg_tmp_dir/$2.XXXXXX"
else
mktemp "$tg_tmp_dir/$1.XXXXXX"
fi
}
This and the functions with [-i | -w] are internal and won't be called
by the user, so we have full control over the calling convention and
should make it easy for us. And putting the optional argument at the
end is easy. I should probably remove the die call in cat_file,
because that would be an programmer error not an user error.
>
>> +# creates a new temporary file (or directory with -d) in the global
>> +# temporary directory $tg_tmp_dir with pattern prefix NAME
>> +get_temp()
>> +{
>> + mktemp ${2-} "$tg_tmp_dir/$1.XXXXXX"
> Does the - makes any difference? If yes, is it portable (enough)?
For me its an indicator, that it doesn't matter whether $2 was given
or not. Also you could run under set -u without error. But I don't do
this.
It's in POSIX [1].
Bert
[1] Statement given without interpretation.
> Best regards
> Uwe
>
> --
> Pengutronix e.K. | Uwe Kleine-König |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
>
prev parent reply other threads:[~2010-10-10 7:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-09 21:41 [TopGit PATCHv2] provide global temporary directory Bert Wesarg
2010-10-09 21:53 ` Uwe Kleine-König
2010-10-10 7:47 ` Bert Wesarg [this message]
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='AANLkTikuEa6TQpEnv=0y3v18W9H8sC4SQ+5vdTvBW7LF@mail.gmail.com' \
--to=bert.wesarg@googlemail.com \
--cc=git@vger.kernel.org \
--cc=madduck@madduck.net \
--cc=pasky@suse.cz \
--cc=u.kleine-koenig@pengutronix.de \
/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).