Skip to content

Commit b21ebb6

Browse files
committed
Sync with Git 2.20.1
* maint: Git 2.20.1 .gitattributes: ensure t/oid-info/* has eol=lf t9902: 'send-email' test case requires PERL t4256: mark support files as LF-only parse-options: fix SunCC compiler warning help -a: handle aliases with long names gracefully help.h: fix coding style run-command: report exec failure
2 parents 85c26ae + 0d0ac38 commit b21ebb6

13 files changed

+51
-7
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/command-list.txt eol=lf
1010
/GIT-VERSION-GEN eol=lf
1111
/mergetools/* eol=lf
12+
/t/oid-info/* eol=lf
1213
/Documentation/git-merge.txt conflict-marker-size=32
1314
/Documentation/gitk.txt conflict-marker-size=32
1415
/Documentation/user-manual.txt conflict-marker-size=32

Documentation/RelNotes/2.20.1.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Git v2.20.1 Release Notes
2+
=========================
3+
4+
This release is primarily to fix brown-paper-bag breakages in the
5+
2.20.0 release.
6+
7+
Fixes since v2.20
8+
-----------------
9+
10+
* A few newly added tests were not portable and caused minority
11+
platforms to report false breakages, which have been fixed.
12+
13+
* Portability fix for a recent update to parse-options API.
14+
15+
* "git help -a" did not work well when an overly long alias is
16+
defined, which has been corrected.
17+
18+
* A recent update accidentally squelched an error message when the
19+
run_command API failed to run a missing command, which has been
20+
corrected.

builtin/blame.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
850850
case PARSE_OPT_HELP:
851851
case PARSE_OPT_ERROR:
852852
exit(129);
853+
case PARSE_OPT_COMPLETE:
854+
exit(0);
853855
case PARSE_OPT_DONE:
854856
if (ctx.argv[0])
855857
dashdash_pos = ctx.cpidx;

builtin/shortlog.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
287287
case PARSE_OPT_HELP:
288288
case PARSE_OPT_ERROR:
289289
exit(129);
290+
case PARSE_OPT_COMPLETE:
291+
exit(0);
290292
case PARSE_OPT_DONE:
291293
goto parse_done;
292294
}

builtin/update-index.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
10861086
case PARSE_OPT_HELP:
10871087
case PARSE_OPT_ERROR:
10881088
exit(129);
1089+
case PARSE_OPT_COMPLETE:
1090+
exit(0);
10891091
case PARSE_OPT_NON_OPTION:
10901092
case PARSE_OPT_DONE:
10911093
{

help.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ static void print_command_list(const struct cmdname_help *cmds,
8383

8484
for (i = 0; cmds[i].name; i++) {
8585
if (cmds[i].category & mask) {
86+
size_t len = strlen(cmds[i].name);
8687
printf(" %s ", cmds[i].name);
87-
mput_char(' ', longest - strlen(cmds[i].name));
88+
mput_char(' ', longest > len ? longest - len : 1);
8889
puts(_(cmds[i].help));
8990
}
9091
}
@@ -526,6 +527,13 @@ void list_all_cmds_help(void)
526527

527528
git_config(get_alias, &alias_list);
528529
string_list_sort(&alias_list);
530+
531+
for (i = 0; i < alias_list.nr; i++) {
532+
size_t len = strlen(alias_list.items[i].string);
533+
if (longest < len)
534+
longest = len;
535+
}
536+
529537
if (alias_list.nr) {
530538
printf("\n%s\n", _("Command aliases"));
531539
ALLOC_ARRAY(aliases, alias_list.nr + 1);

help.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct cmdnames {
1515

1616
static inline void mput_char(char c, unsigned int num)
1717
{
18-
while(num--)
18+
while (num--)
1919
putchar(c);
2020
}
2121

parse-options.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ static int show_gitcomp(struct parse_opt_ctx_t *ctx,
516516
show_negated_gitcomp(original_opts, -1);
517517
show_negated_gitcomp(original_opts, nr_noopts);
518518
fputc('\n', stdout);
519-
exit(0);
519+
return PARSE_OPT_COMPLETE;
520520
}
521521

522522
static int usage_with_options_internal(struct parse_opt_ctx_t *,
@@ -638,6 +638,8 @@ int parse_options(int argc, const char **argv, const char *prefix,
638638
case PARSE_OPT_HELP:
639639
case PARSE_OPT_ERROR:
640640
exit(129);
641+
case PARSE_OPT_COMPLETE:
642+
exit(0);
641643
case PARSE_OPT_NON_OPTION:
642644
case PARSE_OPT_DONE:
643645
break;

parse-options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ extern int opterror(const struct option *opt, const char *reason, int flags);
208208
/*----- incremental advanced APIs -----*/
209209

210210
enum {
211+
PARSE_OPT_COMPLETE = -2,
211212
PARSE_OPT_HELP = -1,
212213
PARSE_OPT_DONE,
213214
PARSE_OPT_NON_OPTION,

run-command.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,8 @@ int start_command(struct child_process *cmd)
728728
if (prepare_cmd(&argv, cmd) < 0) {
729729
failed_errno = errno;
730730
cmd->pid = -1;
731+
if (!cmd->silent_exec_failure)
732+
error_errno("cannot run %s", cmd->argv[0]);
731733
goto end_of_spawn;
732734
}
733735

t/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ t[0-9][0-9][0-9][0-9]/* -whitespace
1616
/t4135/* eol=lf
1717
/t4211/* eol=lf
1818
/t4252/* eol=lf
19+
/t4256/1/* eol=lf
1920
/t5100/* eol=lf
2021
/t5515/* eol=lf
2122
/t556x_common eol=lf

t/t0061-run-command.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ cat >hello-script <<-EOF
1313
EOF
1414

1515
test_expect_success 'start_command reports ENOENT (slash)' '
16-
test-tool run-command start-command-ENOENT ./does-not-exist
16+
test-tool run-command start-command-ENOENT ./does-not-exist 2>err &&
17+
test_i18ngrep "\./does-not-exist" err
1718
'
1819

1920
test_expect_success 'start_command reports ENOENT (no slash)' '
20-
test-tool run-command start-command-ENOENT does-not-exist
21+
test-tool run-command start-command-ENOENT does-not-exist 2>err &&
22+
test_i18ngrep "does-not-exist" err
2123
'
2224

2325
test_expect_success 'run_command can run a command' '
@@ -33,7 +35,8 @@ test_expect_success 'run_command is restricted to PATH' '
3335
write_script should-not-run <<-\EOF &&
3436
echo yikes
3537
EOF
36-
test_must_fail test-tool run-command run-command should-not-run
38+
test_must_fail test-tool run-command run-command should-not-run 2>err &&
39+
test_i18ngrep "should-not-run" err
3740
'
3841

3942
test_expect_success !MINGW 'run_command can run a script without a #! line' '

t/t9902-completion.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ test_expect_success 'complete tree filename with metacharacters' '
15391539
EOF
15401540
'
15411541

1542-
test_expect_success 'send-email' '
1542+
test_expect_success PERL 'send-email' '
15431543
test_completion "git send-email --cov" "--cover-letter " &&
15441544
test_completion "git send-email ma" "master "
15451545
'

0 commit comments

Comments
 (0)