Skip to content

Commit ad33605

Browse files
committed
Merge branch 'maint-1.6.5' into maint-1.6.6
* maint-1.6.5: 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 b756864 + d8e3ac7 commit ad33605

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
@@ -403,8 +403,8 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
403403
ALLOC_GROW(opts, onb + 1, osz);
404404
memset(opts + onb, 0, sizeof(opts[onb]));
405405
argc = parse_options(argc, argv, prefix, opts, usage,
406-
keep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0 |
407-
stop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0);
406+
(keep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0) |
407+
(stop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0));
408408

409409
strbuf_addf(&parsed, " --");
410410
sq_quote_argv(&parsed, argv, 0);

setup.c

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

161+
if (PATH_MAX <= len + strlen("/objects"))
162+
die("Too long path: %.*s", 60, suspect);
161163
strcpy(path, suspect);
162164
if (getenv(DB_ENVIRONMENT)) {
163165
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)