tests: add a test to demonstrate a bug in `hg diff --git` (issue6486) stable
authorSushil khanchi <sushilkhanchi97@gmail.com>
Tue, 16 Feb 2021 15:37:19 +0530
branchstable
changeset 46528 df44bac9413d
parent 46522 6c8faeea6652
child 46529 33350debb480
tests: add a test to demonstrate a bug in `hg diff --git` (issue6486) Issue url: https://bz.mercurial-scm.org/show_bug.cgi?id=6486 This will be fixed in next patch. Differential Revision: https://phab.mercurial-scm.org/D10000
tests/test-diff-unified.t
--- a/tests/test-diff-unified.t	Fri Feb 19 10:04:53 2021 -0500
+++ b/tests/test-diff-unified.t	Tue Feb 16 15:37:19 2021 +0530
@@ -456,3 +456,26 @@
     .
 
   $ cd ..
+
+Make sure `hg diff --git` differentiate "file did not exists" and "file is empty"
+for git blob oids
+
+  $ hg init bloboids
+  $ cd bloboids
+
+  $ touch a
+  $ hg ci -Am "empty a"
+  adding a
+  $ hg diff -c 0 --git --config experimental.extendedheader.index=full | grep index
+  index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644
+
+Make sure `hg diff --git` differentiate "file was empty" and "file is removed"
+for git blob oids
+
+  $ rm a
+  $ hg ci -Am "removed a"
+  removing a
+  $ hg diff -c 1 --git --config experimental.extendedheader.index=full | grep index
+  index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644
+
+  $ cd ..