Ignore:
Timestamp:
Jun 23, 2014, 9:45:51 PM (11 years ago)
Author:
dmik
Message:

git: Merge version 2.0.0 from vendor to dmik branch.

Location:
git/branches/dmik
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • git/branches/dmik

  • TabularUnified git/branches/dmik/builtin/check-attr.c

    r626 r782  
    99static int stdin_paths;
    1010static const char * const check_attr_usage[] = {
    11 "git check-attr [-a | --all | attr...] [--] pathname...",
    12 "git check-attr --stdin [-a | --all | attr...] < <list-of-paths>",
     11N_("git check-attr [-a | --all | attr...] [--] pathname..."),
     12N_("git check-attr --stdin [-z] [-a | --all | attr...] < <list-of-paths>"),
    1313NULL
    1414};
    1515
    16 static int null_term_line;
     16static int nul_term_line;
    1717
    1818static const struct option check_attr_options[] = {
    19         OPT_BOOLEAN('a', "all", &all_attrs, "report all attributes set on file"),
    20         OPT_BOOLEAN(0,  "cached", &cached_attrs, "use .gitattributes only from the index"),
    21         OPT_BOOLEAN(0 , "stdin", &stdin_paths, "read file names from stdin"),
    22         OPT_BOOLEAN('z', NULL, &null_term_line,
    23                 "input paths are terminated by a null character"),
     19        OPT_BOOL('a', "all", &all_attrs, N_("report all attributes set on file")),
     20        OPT_BOOL(0,  "cached", &cached_attrs, N_("use .gitattributes only from the index")),
     21        OPT_BOOL(0 , "stdin", &stdin_paths, N_("read file names from stdin")),
     22        OPT_BOOL('z', NULL, &nul_term_line,
     23                 N_("terminate input and output records by a NUL character")),
    2424        OPT_END()
    2525};
     
    3939                        value = "unspecified";
    4040
    41                 quote_c_style(file, NULL, stdout, 0);
    42                 printf(": %s: %s\n", git_attr_name(check[j].attr), value);
     41                if (nul_term_line) {
     42                        printf("%s%c" /* path */
     43                               "%s%c" /* attrname */
     44                               "%s%c" /* attrvalue */,
     45                               file, 0, git_attr_name(check[j].attr), 0, value, 0);
     46                } else {
     47                        quote_c_style(file, NULL, stdout, 0);
     48                        printf(": %s: %s\n", git_attr_name(check[j].attr), value);
     49                }
     50
    4351        }
    4452}
     
    6674{
    6775        struct strbuf buf, nbuf;
    68         int line_termination = null_term_line ? 0 : '\n';
     76        int line_termination = nul_term_line ? 0 : '\n';
    6977
    7078        strbuf_init(&buf, 0);
     
    94102        struct git_attr_check *check;
    95103        int cnt, i, doubledash, filei;
     104
     105        if (!is_bare_repository())
     106                setup_work_tree();
    96107
    97108        git_config(git_default_config, NULL);
Note: See TracChangeset for help on using the changeset viewer.