[PATCH] dirstate: add dir/file collision test

Joshua Redstone joshua.redstone at fb.com
Mon Jul 2 11:02:00 CDT 2012


# HG changeset patch
# User Joshua Redstone <joshua.redstone at fb.com>
# Date 1340825306 25200
# Node ID d4dd49973b40bfd989c27f370d88b2efceafbd1b
# Parent  2f02917a5f6ea7e6a8fbd55e4c90c3cf1d61fe94
dirstate:  add dir/file collision test

Add a test exercising collisions in add between files and directories of the
same name.

diff --git a/tests/test-dirstate.t b/tests/test-dirstate.t
--- a/tests/test-dirstate.t
+++ b/tests/test-dirstate.t
@@ -14,6 +14,21 @@
   moving a/b/c/d/x to z/b/c/d/x (glob)
   moving a/b/c/d/y to z/b/c/d/y (glob)
   moving a/b/c/d/z to z/b/c/d/z (glob)
+
+Test name collisions
+
+  $ rm z/b/c/d/x
+  $ mkdir z/b/c/d/x
+  $ touch z/b/c/d/x/y
+  $ hg add z/b/c/d/x/y
+  abort: file 'z/b/c/d/x' in dirstate clashes with 'z/b/c/d/x/y'
+  [255]
+  $ rm -rf z/b/c/d
+  $ touch z/b/c/d
+  $ hg add z/b/c/d
+  abort: directory 'z/b/c/d' already in dirstate
+  [255]
+
   $ cd ..
 
 Issue1790: dirstate entry locked into unset if file mtime is set into


More information about the Mercurial-devel mailing list