[Bug 5917] New: record (e.g. `hg ci -i` and `hg split`) crashes with "bad hunk #1" if diff makes a file empty

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Wed Jun 13 19:31:42 UTC 2018


https://bz.mercurial-scm.org/show_bug.cgi?id=5917

            Bug ID: 5917
           Summary: record (e.g. `hg ci -i` and `hg split`) crashes with
                    "bad hunk #1" if diff makes a file empty
           Product: Mercurial
           Version: 4.6
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: martinvonz at google.com
                CC: mercurial-devel at mercurial-scm.org

Here's a patch showing a test case that passes:

diff --git a/tests/test-commit-interactive-curses.t
b/tests/test-commit-interactive-curses.t
--- a/tests/test-commit-interactive-curses.t
+++ b/tests/test-commit-interactive-curses.t
@@ -214,6 +214,16 @@ Amend option works
   @@ -0,0 +1,1 @@
   +hello world

+Make file empty
+  $ echo -n > x
+  $ cat <<EOF >testModeCommands
+  > X
+  > EOF
+  $ hg ci -i -m emptify -d "0 0"
+  abort: bad hunk #1
+  [255]
+  $ hg revert x
+
 Editing a hunk puts you back on that hunk when done editing (issue5041)
 To do that, we change two lines in a file, pretend to edit the second line,
 exit, toggle the line selected at the end of the edit and commit.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list