Skip to content

Commit 28bf4ba

Browse files
committed
Merge branch 'maint-1.6.6' into maint-1.7.0
* maint-1.6.6: request-pull.txt: Document -p option Check size of path buffer before writing into it rev-parse: fix --parse-opt --keep-dashdash --stop-at-non-option
2 parents 4b2343f + ad33605 commit 28bf4ba

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

Documentation/git-request-pull.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ git-request-pull - Generates a summary of pending changes
77

88
SYNOPSIS
99
--------
10-
'git request-pull' <start> <url> [<end>]
10+
'git request-pull' [-p] <start> <url> [<end>]
1111

1212
DESCRIPTION
1313
-----------
@@ -17,6 +17,9 @@ the given URL in the generated summary.
1717

1818
OPTIONS
1919
-------
20+
-p::
21+
Show patch text
22+
2023
<start>::
2124
Commit to start at.
2225

builtin-rev-parse.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
407407
ALLOC_GROW(opts, onb + 1, osz);
408408
memset(opts + onb, 0, sizeof(opts[onb]));
409409
argc = parse_options(argc, argv, prefix, opts, usage,
410-
keep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0 |
411-
stop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0);
410+
(keep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0) |
411+
(stop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0));
412412

413413
strbuf_addf(&parsed, " --");
414414
sq_quote_argv(&parsed, argv, 0);

setup.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ static int is_git_directory(const char *suspect)
169169
char path[PATH_MAX];
170170
size_t len = strlen(suspect);
171171

172+
if (PATH_MAX <= len + strlen("/objects"))
173+
die("Too long path: %.*s", 60, suspect);
172174
strcpy(path, suspect);
173175
if (getenv(DB_ENVIRONMENT)) {
174176
if (access(getenv(DB_ENVIRONMENT), X_OK))

t/t1502-rev-parse-parseopt.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,22 @@ test_expect_success 'test --parseopt --keep-dashdash' '
7979
test_cmp expect output
8080
'
8181

82+
cat >expect <<EOF
83+
set -- --foo -- '--' 'arg' '--spam=ham'
84+
EOF
85+
86+
test_expect_success 'test --parseopt --keep-dashdash --stop-at-non-option with --' '
87+
git rev-parse --parseopt --keep-dashdash --stop-at-non-option -- --foo -- arg --spam=ham <optionspec >output &&
88+
test_cmp expect output
89+
'
90+
91+
cat > expect <<EOF
92+
set -- --foo -- 'arg' '--spam=ham'
93+
EOF
94+
95+
test_expect_success 'test --parseopt --keep-dashdash --stop-at-non-option without --' '
96+
git rev-parse --parseopt --keep-dashdash --stop-at-non-option -- --foo arg --spam=ham <optionspec >output &&
97+
test_cmp expect output
98+
'
99+
82100
test_done

0 commit comments

Comments
 (0)