Skip to content

Commit 5446e33

Browse files
Lukas Fleischergitster
authored andcommitted
bundle: Accept prerequisites without commit messages
While explicitly stating that the commit message in a prerequisite line is optional, we required all lines with 40 or more characters to contain a space after the object name, bailing out if a line consisted of an object name only. This was to allow bundling a history to a commit without an message, but the code forgot that it already called rtrim() to remove that whitespace. As a workaround, only check for SP when the line has more than 40 characters. Signed-off-by: Lukas Fleischer <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2137ce0 commit 5446e33

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

bundle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static int parse_bundle_header(int fd, struct bundle_header *header,
5757
* followed by SP and subject line.
5858
*/
5959
if (get_sha1_hex(buf.buf, sha1) ||
60-
(40 <= buf.len && !isspace(buf.buf[40])) ||
60+
(buf.len > 40 && !isspace(buf.buf[40])) ||
6161
(!is_prereq && buf.len <= 40)) {
6262
if (report_path)
6363
error(_("unrecognized header: %s%s (%d)"),

t/t5704-bundle.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,14 @@ test_expect_success 'ridiculously long subject in boundary' '
5858
grep "^-[0-9a-f]\\{40\\} " boundary
5959
'
6060

61+
test_expect_success 'prerequisites with an empty commit message' '
62+
: >file1 &&
63+
git add file1 &&
64+
test_tick &&
65+
git commit --allow-empty-message -m "" &&
66+
test_commit file2 &&
67+
git bundle create bundle HEAD^.. &&
68+
git bundle verify bundle
69+
'
70+
6171
test_done

0 commit comments

Comments
 (0)