git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Shawn Bohrer <shawn.bohrer@gmail.com>
Cc: git@vger.kernel.org, frank@lichtenheld.de, gitster@pobox.com
Subject: Re: [PATCH] Make git-clean a builtin
Date: Mon, 8 Oct 2007 04:57:38 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0710080450570.4174@racer.site> (raw)
In-Reply-To: <11918014664038-git-send-email-shawn.bohrer@gmail.com>

Hi,

On Sun, 7 Oct 2007, Shawn Bohrer wrote:

> +	if (ignored && ignored_only)
> +		usage(builtin_clean_usage);

Maybe a helpful message in that case, too?  (It is not apparent from the 
usage what the user has done wrong here.)

> +	if (disabled) {
> +		die("clean.requireForce set and -n or -f not given; refusing to clean");
> +	}

Please lose the curly brackets here.  They are absolutely useless, and the 
rest of the git source code avoids unnecessary curly brackets.

> +	/* Paths (argc - i) + 8 (Possible arguments)*/
> +	argv_ls_files = xmalloc((argc - i + 8) * sizeof(const char *));
> +	argv_ls_files[0] = "ls-files";
> +	argv_ls_files[1] = "--others";
> +	argv_ls_files[2] = "--directory";
> [...]

As Linus already noted, it is probably easy, and much more efficient, to 
call read_directory() here.  The best example how to use 
read_directory() is... builtin-ls-files.c.

> diff --git a/git.c b/git.c
> index d7c6bca..4e39169 100644
> --- a/git.c
> +++ b/git.c
> @@ -320,6 +320,7 @@ static void handle_internal_command(int argc, const char **argv)
>  		{ "check-attr", cmd_check_attr, RUN_SETUP | NEED_WORK_TREE },
>  		{ "cherry", cmd_cherry, RUN_SETUP },
>  		{ "cherry-pick", cmd_cherry_pick, RUN_SETUP | NEED_WORK_TREE },
> +		{ "clean", cmd_clean, RUN_SETUP },

You definitely want to have NEED_WORK_TREE here, too.

Ciao,
Dscho

  reply	other threads:[~2007-10-08  3:58 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-07 23:57 [PATCH] Make git-clean a builtin Shawn Bohrer
2007-10-08  3:57 ` Johannes Schindelin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-11-12  1:48 Shawn Bohrer
2007-11-07  5:18 Shawn Bohrer
2007-11-07 11:10 ` Johannes Schindelin
2007-11-07 13:29   ` Bill Lear
2007-11-07 14:17     ` Johannes Schindelin
2007-11-07 14:45     ` Matthieu Moy
2007-11-07 19:46     ` Jon Loeliger
2007-11-10 22:43     ` Miles Bader
2007-11-07 14:54   ` Shawn Bohrer
2007-11-07 15:04     ` Johannes Schindelin
2007-11-07 20:51       ` Brian Downing
2007-11-07 21:49         ` Junio C Hamano
2007-11-07 20:42 ` Junio C Hamano
2007-11-08  5:37   ` Shawn Bohrer
2007-11-04 19:02 [RFC] Second attempt at making " Shawn Bohrer
2007-11-04 19:02 ` [PATCH] Add more tests for git-clean Shawn Bohrer
2007-11-04 19:02   ` [PATCH] Make git-clean a builtin Shawn Bohrer
2007-11-04 19:41     ` Pierre Habouzit
2007-11-05 21:14     ` Junio C Hamano
2007-11-05 22:10       ` Carlos Rica
2007-11-05 23:54         ` Junio C Hamano
2007-11-06  5:05       ` Shawn Bohrer
2007-11-06  5:30         ` Junio C Hamano
2007-10-07  1:17 Shawn Bohrer
2007-10-07  1:31 ` Linus Torvalds
2007-10-07 15:41   ` Shawn Bohrer
2007-10-07 16:42     ` rae l
2007-10-07 16:38 ` Johannes Schindelin
2007-10-06 20:54 Shawn Bohrer
2007-10-06 21:52 ` Frank Lichtenheld
2007-10-07  1:13   ` Shawn Bohrer
2007-10-08  2:04 ` Jeff King
2007-10-08  2:08   ` Jeff King
2007-10-08  2:17   ` Linus Torvalds
2007-10-08  2:22     ` Jeff King
2007-10-08  6:37       ` Johannes Sixt
2007-10-08 18:27         ` Linus Torvalds

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.LNX.4.64.0710080450570.4174@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=frank@lichtenheld.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=shawn.bohrer@gmail.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).