git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fredrik Gustafsson <iveqy@iveqy.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] format-patch: remove existing output-directory
Date: Fri, 14 Jun 2013 15:16:29 +0200	[thread overview]
Message-ID: <20130614131629.GA1086@paksenarrion.iveqy.com> (raw)
In-Reply-To: <1371213813-7925-1-git-send-email-artagnon@gmail.com>

Hi,
just some questions about your patch.

On Fri, Jun 14, 2013 at 06:13:33PM +0530, Ramkumar Ramachandra wrote:
> The following command
> 
>   $ git format-patch -o outgoing master
> 
> does not ensure that the output-directory outgoing doesn't already
> exist.  As a result, it's possible for patches from two different series
> to get mixed up if the user is not careful.  Fix the problem by
> unconditionally removing the output-directory before writing to it.

I'm not entirely happy about removing untracked stuff without asking
the user. What if the output directory isn't empty? What if a user just
want them in ~?

However I think this patch can improve the workflow for experienced
developers. Can we tweak this in some way to get the best out of both
worlds?

> +		struct strbuf buf = STRBUF_INIT;
> +
>  		if (use_stdout)
>  			die(_("standard output, or directory, which one?"));
> +		strbuf_addstr(&buf, output_directory);
> +		remove_dir_recursively(&buf, 0);

Should we have a strbuf_release here?

-- 
Med vänliga hälsningar
Fredrik Gustafsson

tel: 0733-608274
e-post: iveqy@iveqy.com

  parent reply	other threads:[~2013-06-14 13:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-14 12:43 [PATCH] format-patch: remove existing output-directory Ramkumar Ramachandra
2013-06-14 13:10 ` John Keeping
2013-06-14 13:15   ` Ramkumar Ramachandra
2013-06-14 13:21     ` John Keeping
2013-06-14 13:58       ` Junio C Hamano
2013-06-14 13:55   ` Junio C Hamano
2013-06-14 13:16 ` Fredrik Gustafsson [this message]
2013-06-14 13:34   ` Ramkumar Ramachandra
2013-06-14 13:48     ` Fredrik Gustafsson
2013-06-14 13:52       ` Ramkumar Ramachandra
2013-06-14 13:50     ` SZEDER Gábor
2013-06-14 13:51       ` Ramkumar Ramachandra

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=20130614131629.GA1086@paksenarrion.iveqy.com \
    --to=iveqy@iveqy.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).