On Sun, Sep 2, 2012 at 7:12 AM, Adam Spiers <g...@adamspiers.org> wrote:
> --- a/builtin/add.c
> +++ b/builtin/add.c
> @@ -273,7 +273,7 @@ static int add_files(struct dir_struct *dir, int flags)
>                 fprintf(stderr, _(ignore_error));
>                 for (i = 0; i < dir->ignored_nr; i++)
>                         fprintf(stderr, "%s\n", dir->ignored[i]->name);
> -               fprintf(stderr, _("Use -f if you really want to add 
> them.\n"));
> +               fprintf(stderr, _("Use -f if you really want to add them, or 
> git check-ignore to see\nwhy they're ignored.\n"));
>                 die(_("no files added"));
>         }

String too long (> 80 chars).

> +static const char * const check_ignore_usage[] = {
> +"git check-ignore pathname...",
> +"git check-ignore --stdin [-z] < <list-of-paths>",
> +NULL
> +};
> +
> +static const struct option check_ignore_options[] = {
> +       OPT_BOOLEAN(0 , "stdin", &stdin_paths, "read file names from stdin"),
> +       OPT_BOOLEAN('z', NULL, &null_term_line,
> +               "input paths are terminated by a null character"),
> +       OPT_END()
> +};

You may want to mark help strings ("read file names from stdin" and
"input paths... null character") and check_ignore_usage[] for
translation. Just wrap those strings with N_() and you'll be fine. For
similar changes, check out nd/i18n-parseopt-help on branch 'pu'.

> +static void output_exclude(const char *path, struct exclude *exclude)
> +{
> +       char *type = exclude->to_exclude ? "excluded" : "included";
> +       char *bang = exclude->to_exclude ? "" : "!";
> +       char *dir  = (exclude->flags & EXC_FLAG_MUSTBEDIR) ? "/" : "";
> +       printf(_("%s: %s %s%s%s "), path, type, bang, exclude->pattern, dir);

These English words "excluded" and "included" make the translator me
want to translate them. But they could be the markers for scripts, so
they may not be translated. How about using non alphanumeric letters
instead?

> +static void check_ignore(const char *prefix, const char **pathspec)
> +{
> +       struct dir_struct dir;
> +       const char *path;
> +       char *seen = NULL;
> +
> +       /* read_cache() is only necessary so we can watch out for submodules. 
> */
> +       if (read_cache() < 0)
> +               die(_("index file corrupt"));
> +
> +       memset(&dir, 0, sizeof(dir));
> +       dir.flags |= DIR_COLLECT_IGNORED;
> +       setup_standard_excludes(&dir);

You should support ignore rules from files and command line arguments
too, like ls-files. For quick testing.

> +static NORETURN void error_with_usage(const char *msg)
> +{
> +       error("%s", msg);
> +       usage_with_options(check_ignore_usage, check_ignore_options);
> +}

Interesting. We have usage_msg_opt() in parse-options.c, but it's more
verbose. Perhaps this function should be moved to parse-options.c
because it may be useful to other commands as well?
-- 
Duy
--
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

Reply via email to