git_refspec_transform: Handle NULL dst#4699
Conversation
|
|
||
| if (!spec->pattern) | ||
| return git_buf_puts(out, spec->dst); | ||
| return git_buf_puts(out, spec->dst ? spec->dst : ""); |
There was a problem hiding this comment.
Do you want to write a test for it? I think it should be rather easy to do as there is already precedence of testing this function in "tests/network/refspecs.c".
Verified that this breaks before the fix and passes afterwards.
|
Thanks for the test! I think I need a second opinion on the new behaviour. Thing is, when you parse a refspec "refs/heads/master:" with Going a bit deeper: what would a caller of @ethomson, do you have some thoughts? |
| assert_valid_transform("refs/*:refs/*", "refs/heads/master", "refs/heads/master"); | ||
| } | ||
|
|
||
| void test_network_refspecs__no_dst(void) { |
There was a problem hiding this comment.
The opening brace of functions should actually start on their own line :)
|
Backing up from the question of
We have the question of: “What would a caller of In that case, the input string of
We reach the conclusion that We could alternately relax (2) and make |
|
Thanks for your reasoning and this change! |
per
libgit2/src/refspec.c
Lines 85 to 90 in b121b7a
Found via triggering the assertion failure in
git_buf_putsin my work-in-progress fuzzer.