From: Junio C Hamano Date: Sun, 8 Mar 2009 06:34:13 +0000 (-0800) Subject: Merge branch 'maint' X-Git-Tag: v1.6.3-rc0~189 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/934f788981de941814e821217f32451a5c715d5d?ds=inline;hp=-c Merge branch 'maint' * maint: builtin-revert.c: release index lock when cherry-picking an empty commit document config --bool-or-int t1300: use test_must_fail as appropriate cleanup: add isascii() Documentation: fix badly indented paragraphs in "--bisect-all" description --- 934f788981de941814e821217f32451a5c715d5d diff --combined Documentation/git-config.txt index 7d140073b1,6ab2af4b61..82ce89eae8 --- a/Documentation/git-config.txt +++ b/Documentation/git-config.txt @@@ -22,7 -22,6 +22,7 @@@ SYNOPSI 'git config' [] [-z|--null] -l | --list 'git config' [] --get-color name [default] 'git config' [] --get-colorbool name [stdout-is-tty] +'git config' [] -e | --edit DESCRIPTION ----------- @@@ -131,6 -130,10 +131,10 @@@ See also <> in the config file will cause the value to be multiplied by 1024, 1048576, or 1073741824 prior to output. + --bool-or-int:: + 'git-config' will ensure that the output matches the format of + either --bool or --int, as described above. + -z:: --null:: For all options that output values and/or keys, always @@@ -158,11 -161,6 +162,11 @@@ output. The optional `default` parameter is used instead, if there is no color configured for `name`. +-e:: +--edit:: + Opens an editor to modify the specified config file; either + '--system', '--global', or repository (default). + [[FILES]] FILES ----- diff --combined pretty.c index f49929479f,e9540e46da..c018408099 --- a/pretty.c +++ b/pretty.c @@@ -10,15 -10,6 +10,15 @@@ static char *user_format; +static void save_user_format(struct rev_info *rev, const char *cp, int is_tformat) +{ + free(user_format); + user_format = xstrdup(cp); + if (is_tformat) + rev->use_terminator = 1; + rev->commit_format = CMIT_FMT_USERFORMAT; +} + void get_commit_format(const char *arg, struct rev_info *rev) { int i; @@@ -42,7 -33,12 +42,7 @@@ return; } if (!prefixcmp(arg, "format:") || !prefixcmp(arg, "tformat:")) { - const char *cp = strchr(arg, ':') + 1; - free(user_format); - user_format = xstrdup(cp); - if (arg[0] == 't') - rev->use_terminator = 1; - rev->commit_format = CMIT_FMT_USERFORMAT; + save_user_format(rev, strchr(arg, ':') + 1, arg[0] == 't'); return; } for (i = 0; i < ARRAY_SIZE(cmt_fmts); i++) { @@@ -54,10 -50,6 +54,10 @@@ return; } } + if (strchr(arg, '%')) { + save_user_format(rev, arg, 1); + return; + } die("invalid --pretty format: %s", arg); } @@@ -83,8 -75,7 +83,7 @@@ static int get_one_line(const char *msg /* High bit set, or ISO-2022-INT */ int non_ascii(int ch) { - ch = (ch & 0xff); - return ((ch & 0x80) || (ch == 0x1b)); + return !isascii(ch) || ch == '\033'; } static int is_rfc2047_special(char ch) @@@ -576,16 -567,16 +575,16 @@@ static size_t format_commit_item(struc return end - placeholder + 1; } if (!prefixcmp(placeholder + 1, "red")) { - strbuf_addstr(sb, "\033[31m"); + strbuf_addstr(sb, GIT_COLOR_RED); return 4; } else if (!prefixcmp(placeholder + 1, "green")) { - strbuf_addstr(sb, "\033[32m"); + strbuf_addstr(sb, GIT_COLOR_GREEN); return 6; } else if (!prefixcmp(placeholder + 1, "blue")) { - strbuf_addstr(sb, "\033[34m"); + strbuf_addstr(sb, GIT_COLOR_BLUE); return 5; } else if (!prefixcmp(placeholder + 1, "reset")) { - strbuf_addstr(sb, "\033[m"); + strbuf_addstr(sb, GIT_COLOR_RESET); return 6; } else return 0;