Skip to content

Commit

Permalink
Merge branch 'ah/connect-parse-feature-v0-fix' into jch
Browse files Browse the repository at this point in the history
* ah/connect-parse-feature-v0-fix:
  connect: also update offset for features without values
  • Loading branch information
gitster committed Sep 23, 2021
2 parents 545456c + e0e1dbe commit c760471
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions connect.c
Expand Up @@ -557,6 +557,8 @@ const char *parse_feature_value(const char *feature_list, const char *feature, i
if (!*value || isspace(*value)) {
if (lenp)
*lenp = 0;
if (offset)
*offset = found + len - feature_list;
return value;
}
/* feature with a value (e.g., "agent=git/1.2.3") */
Expand Down
13 changes: 13 additions & 0 deletions t/t5704-protocol-violations.sh
Expand Up @@ -32,4 +32,17 @@ test_expect_success 'extra delim packet in v2 fetch args' '
test_i18ngrep "expected flush after fetch arguments" err
'

test_expect_success 'bogus symref in v0 capabilities' '
test_commit foo &&
oid=$(git rev-parse HEAD) &&
{
printf "%s HEAD\0symref object-format=%s\n" "$oid" "$GIT_DEFAULT_HASH" |
test-tool pkt-line pack-raw-stdin &&
printf "0000"
} >input &&
git ls-remote --upload-pack="cat input; read junk;:" . >actual &&
printf "%s\tHEAD\n" "$oid" >expect &&
test_cmp expect actual
'

test_done

0 comments on commit c760471

Please sign in to comment.