All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiang Xin <worldhello.net@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	Matthieu Moy <Matthieu.Moy@imag.fr>,
	Git List <git@vger.kernel.org>
Cc: Jiang Xin <worldhello.net@gmail.com>
Subject: [PATCH v9 0/9] interactive git-clean
Date: Tue, 14 May 2013 16:45:14 +0800	[thread overview]
Message-ID: <cover.1368518327.git.worldhello.net@gmail.com> (raw)

Updates since v8:

 * Run interactive git-clean even if in dry_run mode. 

       -	if (interactive && !dry_run && del_list.nr > 0)
       +	if (interactive && del_list.nr > 0)
        		interactive_main_loop();
 
 * Variable menu_list is not static.
   (copy from global del_list, and forget to remove static)

        static void print_highlight_menu_stuff(struct menu_stuff *stuff, int **chosen)
        {
       -	static struct string_list menu_list = STRING_LIST_INIT_DUP;
       +	struct string_list menu_list = STRING_LIST_INIT_DUP;
        	struct strbuf menu = STRBUF_INIT;
        	int i;

 * i18n:

       @@ -567,21 +567,21 @@ static int *list_and_choose(struct menu_opts *opts, struct menu_stuff *stuff)
        		if (opts->header) {
        			printf_ln("%s%s%s",
        				  clean_get_color(CLEAN_COLOR_HEADER),
       -				  opts->header,
       +				  _(opts->header),
        				  clean_get_color(CLEAN_COLOR_RESET));
        		}
        
       ... 
       
        		if (opts->prompt) {
        			printf("%s%s%s%s",
        			       clean_get_color(CLEAN_COLOR_PROMPT),
       -			       opts->prompt,
       -			       opts->flag & MENU_OPTS_SINGLETON ? "> " : ">> ",
       +			       _(opts->prompt),
       +			       opts->flags & MENU_OPTS_SINGLETON ? "> " : ">> ",
        			       clean_get_color(CLEAN_COLOR_RESET));
        		}


       @@ -721,8 +724,8 @@ static int select_by_numbers_cmd(void)
        	int i, j;
        
       -	menu_opts.prompt = "Select items to delete";
       +	menu_opts.prompt = N_("Select items to delete");

       -		menu_opts.header = _("*** Commands ***");
       -		menu_opts.prompt = "What now";
       +		menu_opts.header = N_("*** Commands ***");
       +		menu_opts.prompt = N_("What now");
  

 * Update documentation for "color.interactive" and "color.interactive.<slot>",
   because `git clean --interactive` reuses these variables from
   `git-add--interactive`.

        color.interactive::
        	When set to `always`, always use colors for interactive prompts
       -	and displays (such as those used by "git-add --interactive").
       -	When false (or `never`), never.  When set to `true` or `auto`, use
       -	colors only when the output is to the terminal. Defaults to false.
       +	and displays (such as those used by "git-add --interactive" and
       +	"git-clean --interactive"). When false (or `never`), never.
       +	When set to `true` or `auto`, use colors only when the output is
       +	to the terminal. Defaults to false.
        
        color.interactive.<slot>::
       -	Use customized color for 'git add --interactive'
       -	output. `<slot>` may be `prompt`, `header`, `help` or `error`, for
       -	four distinct types of normal output from interactive
       -	commands.  The values of these variables may be specified as
       -	in color.branch.<slot>.
       +	Use customized color for 'git add --interactive' and 'git clean
       +	--interactive' output. `<slot>` may be `prompt`, `header`, `help`
       +	or `error`, for four distinct types of normal output from
       +	interactive commands.  The values of these variables may be
       +	specified as in color.branch.<slot>.
 
 * Update documentation for "column.clean", because we only use layout settings.

        column.clean::
       -	Specify whether to output cleaning files in `git clean -i` in columns.
       -	See `column.ui` for details.
       +	Specify the layout when list items in `git clean -i`, which always
       +	shows files and directories in columns. See `column.ui` for details.

 * Refactor: change variables' names, such as:

       @@ -57,7 +57,7 @@ enum color_clean {
        struct menu_opts {
        	const char *header;
        	const char *prompt;
       -	int flag;
       +	int flags;
        };
 

       @@ -428,7 +428,7 @@ static int parse_choice(struct menu_stuff *menu_stuff,
        			struct strbuf input,
        			int **chosen)
        {
       -	struct strbuf **choice_list, **choice_p;
       +	struct strbuf **choice_list, **ptr;
        	int nr = 0;
        	int i;

 * Refactor parse_clean_color_slot:

       @@ -80,19 +80,19 @@ struct menu_stuff {
        	void *stuff;
        };
        
       -static int parse_clean_color_slot(const char *var, int ofs)
       +static int parse_clean_color_slot(const char *var)
        {
       -	if (!strcasecmp(var+ofs, "reset"))
       +	if (!strcasecmp(var, "reset"))
        		return CLEAN_COLOR_RESET;
       -	if (!strcasecmp(var+ofs, "plain"))
       +	if (!strcasecmp(var, "plain"))
        		return CLEAN_COLOR_PLAIN;
       -	if (!strcasecmp(var+ofs, "prompt"))
       +	if (!strcasecmp(var, "prompt"))
        		return CLEAN_COLOR_PROMPT;
       -	if (!strcasecmp(var+ofs, "header"))
       +	if (!strcasecmp(var, "header"))
        		return CLEAN_COLOR_HEADER;
       -	if (!strcasecmp(var+ofs, "help"))
       +	if (!strcasecmp(var, "help"))
        		return CLEAN_COLOR_HELP;
       -	if (!strcasecmp(var+ofs, "error"))
       +	if (!strcasecmp(var, "error"))
        		return CLEAN_COLOR_ERROR;
        	return -1;
        }
       @@ -109,7 +109,8 @@ static int git_clean_config(const char *var, const char *value, void *cb)
        		return 0;
        	}
        	if (!prefixcmp(var, "color.interactive.")) {
       -		int slot = parse_clean_color_slot(var, 18);
       +		int slot = parse_clean_color_slot(var +
       +						  strlen("color.interactive."));
        		if (slot < 0)
        			return 0;
        		if (!value)

 * Withdraw PATCH v8 10/12, 11/12 and 12/12.

   - git-clean refactor: save some options in clean_flags
   - git-clean refactor: add wrapper scan_clean_candidates
   - git-clean: add toggle flags interactive action

Usage:

See: [PATCH v9 9/9] git-clean: add documentation for interactive git-clean


Jiang Xin (9):
  git-clean: refactor git-clean into two phases
  git-clean: add support for -i/--interactive
  git-clean: show items of del_list in columns
  git-clean: add colors to interactive git-clean
  git-clean: use a git-add-interactive compatible UI
  git-clean: add filter by pattern interactive action
  git-clean: add select by numbers interactive action
  git-clean: add ask each interactive action
  git-clean: add documentation for interactive git-clean

 Documentation/config.txt    |  21 +-
 Documentation/git-clean.txt |  71 +++-
 builtin/clean.c             | 802 ++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 860 insertions(+), 34 deletions(-)

-- 
1.8.3.rc1.404.gb9fcf3e

             reply	other threads:[~2013-05-14  8:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-14  8:45 Jiang Xin [this message]
2013-05-14  8:45 ` [PATCH v9 1/9] git-clean: refactor git-clean into two phases Jiang Xin
2013-05-14 23:27   ` Junio C Hamano
2013-05-15  0:40     ` Jiang Xin
2013-05-15 15:03       ` Junio C Hamano
2013-05-15 15:07         ` Jiang Xin
2013-05-15 15:18     ` [RFC 0/2] refactor relative_path in path.c Jiang Xin
2013-05-15 15:18       ` [RFC 1/2] path.c: refactor relative_path(), not only strip prefix Jiang Xin
2013-05-15 15:18       ` [RFC 2/2] quote.c: remove path_relative, use relative_path instead Jiang Xin
2013-05-15 18:24       ` [RFC 0/2] refactor relative_path in path.c Junio C Hamano
2013-05-14  8:45 ` [PATCH v9 2/9] git-clean: add support for -i/--interactive Jiang Xin
2013-05-14  8:45 ` [PATCH v9 3/9] git-clean: show items of del_list in columns Jiang Xin
2013-05-14  8:45 ` [PATCH v9 4/9] git-clean: add colors to interactive git-clean Jiang Xin
2013-05-14  8:45 ` [PATCH v9 5/9] git-clean: use a git-add-interactive compatible UI Jiang Xin
2013-05-14  8:45 ` [PATCH v9 6/9] git-clean: add filter by pattern interactive action Jiang Xin
2013-05-14  8:45 ` [PATCH v9 7/9] git-clean: add select by numbers " Jiang Xin
2013-05-14  8:45 ` [PATCH v9 8/9] git-clean: add ask each " Jiang Xin
2013-05-14  8:45 ` [PATCH v9 9/9] git-clean: add documentation for interactive git-clean Jiang Xin
2013-05-14 23:27 ` [PATCH v9 0/9] " Junio C Hamano

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=cover.1368518327.git.worldhello.net@gmail.com \
    --to=worldhello.net@gmail.com \
    --cc=Matthieu.Moy@imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.