Patchwork D10000: tests: add a test to demonstrate a bug in `hg diff --git` (issue6486)

login
register
mail settings
Submitter phabricator
Date Feb. 16, 2021, 10:26 a.m.
Message ID <differential-rev-PHID-DREV-apjt3m2zumitl5flh3gm-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48315/
State Superseded
Headers show

Comments

phabricator - Feb. 16, 2021, 10:26 a.m.
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Issue url: https://bz.mercurial-scm.org/show_bug.cgi?id=6486
  This will be fixed in next patch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10000

AFFECTED FILES
  tests/test-diff-unified.t

CHANGE DETAILS




To: khanchi97, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-diff-unified.t b/tests/test-diff-unified.t
--- a/tests/test-diff-unified.t
+++ b/tests/test-diff-unified.t
@@ -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 ..