Re: [PATCH v9 0/9] interactive git-clean

2013-05-14 Thread Junio C Hamano
Except for one nit in 1/9, the series seems to be nicely done.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v9 0/9] interactive git-clean

2013-05-14 Thread Jiang Xin
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.",
   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.::
   -Use customized color for 'git add --interactive'
   -output. `` 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..
   +Use customized color for 'git add --interactive' and 'git clean
   +--interactive' output. `` 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..
 
 * 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)
   +s