diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-07-31 13:34:17 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-07-31 13:34:17 -0700 |
| commit | d71121c060dc1a76cb5be1674e4f719f5c58136e (patch) | |
| tree | b9ce9ca630f467d8c67876e4d0a777a079d5f497 /t/t3701-add-interactive.sh | |
| parent | 2794ac123d2d0498878d8e47ff4a2e1675557317 (diff) | |
| parent | 60cf761ed14298d618597e87e50f25bb61171e84 (diff) | |
| download | git-d71121c060dc1a76cb5be1674e4f719f5c58136e.tar.xz | |
Merge branch 'pw/add-patch-with-suppress-blank-empty'
"git add -p" by users with diff.suppressBlankEmpty set to true
failed to parse the patch that represents an unmodified empty line
with an empty line (not a line with a single space on it), which
has been corrected.
* pw/add-patch-with-suppress-blank-empty:
add-patch: use normalize_marker() when recounting edited hunk
add-patch: handle splitting hunks with diff.suppressBlankEmpty
Diffstat (limited to 't/t3701-add-interactive.sh')
| -rwxr-xr-x | t/t3701-add-interactive.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh index 5d78868ac1..9a48933cec 100755 --- a/t/t3701-add-interactive.sh +++ b/t/t3701-add-interactive.sh @@ -1164,4 +1164,23 @@ test_expect_success 'reset -p with unmerged files' ' test_must_be_empty staged ' +test_expect_success 'hunk splitting works with diff.suppressBlankEmpty' ' + test_config diff.suppressBlankEmpty true && + write_script fake-editor.sh <<-\EOF && + tr F G <"$1" >"$1.tmp" && + mv "$1.tmp" "$1" + EOF + + test_write_lines a b "" c d "" e f "" >file && + git add file && + test_write_lines A b "" c D "" e F "" >file && + ( + test_set_editor "$(pwd)/fake-editor.sh" && + test_write_lines s n y e q | git add -p file + ) && + git cat-file blob :file >actual && + test_write_lines a b "" c D "" e G "" >expect && + test_cmp expect actual +' + test_done |
