tests/test-import.t
changeset 34964 7ebf850d3166
parent 34661 eb586ed5d8ce
child 35186 aef2b98d9352
--- a/tests/test-import.t	Sat Oct 21 17:01:20 2017 +0900
+++ b/tests/test-import.t	Sat Oct 21 16:50:57 2017 +0900
@@ -1346,6 +1346,93 @@
 
   $ cd ..
 
+commit message that looks like a diff header (issue1879)
+
+  $ hg init headerlikemsg
+  $ cd headerlikemsg
+  $ touch empty
+  $ echo nonempty >> nonempty
+  $ hg ci -qAl - <<EOF
+  > blah blah
+  > diff blah
+  > blah blah
+  > EOF
+  $ hg --config diff.git=1 log -pv
+  changeset:   0:c6ef204ef767
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  files:       empty nonempty
+  description:
+  blah blah
+  diff blah
+  blah blah
+  
+  
+  diff --git a/empty b/empty
+  new file mode 100644
+  diff --git a/nonempty b/nonempty
+  new file mode 100644
+  --- /dev/null
+  +++ b/nonempty
+  @@ -0,0 +1,1 @@
+  +nonempty
+  
+
+ (without --git, empty file is lost, but commit message should be preserved)
+
+  $ hg init plain
+  $ hg export 0 | hg -R plain import -
+  applying patch from stdin
+  $ hg --config diff.git=1 -R plain log -pv
+  changeset:   0:60a2d231e71f
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  files:       nonempty
+  description:
+  blah blah
+  diff blah
+  blah blah
+  
+  
+  diff --git a/nonempty b/nonempty
+  new file mode 100644
+  --- /dev/null
+  +++ b/nonempty
+  @@ -0,0 +1,1 @@
+  +nonempty
+  
+
+ (with --git, patch contents should be fully preserved)
+
+  $ hg init git
+  $ hg --config diff.git=1 export 0 | hg -R git import -
+  applying patch from stdin
+  $ hg --config diff.git=1 -R git log -pv
+  changeset:   0:c6ef204ef767
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  files:       empty nonempty
+  description:
+  blah blah
+  diff blah
+  blah blah
+  
+  
+  diff --git a/empty b/empty
+  new file mode 100644
+  diff --git a/nonempty b/nonempty
+  new file mode 100644
+  --- /dev/null
+  +++ b/nonempty
+  @@ -0,0 +1,1 @@
+  +nonempty
+  
+
+  $ cd ..
+
 no segfault while importing a unified diff which start line is zero but chunk
 size is non-zero