[darcs-users] 'darcs add' loses inital file contents, a timestamp problem?

Philip Martin philip at codematters.co.uk
Thu Apr 17 16:44:06 UTC 2003


Hello

darcs 0.9.6woody-1 again.  If I run the following commands from a
script it doesn't work the way I would expect

  #!/bin/sh
  rm -rf foo1 foo2
  mkdir foo1 foo2
  cd foo1
  darcs inittree
  echo zig > foo
  darcs add foo
  #sleep 1
  darcs record -a -m add_foo -A x
  cd ../foo2
  darcs inittree
  darcs pull ../foo1
  cd ..

When run it creates a file foo2/foo that is empty, and if I look in
foo1/_darcs/patches I see that the patch records the add but doesn't
record the file content.

The problem goes away if I uncomment the 'sleep 1' command between the
add and record commands.  I suspect that darcs is relying on file
timestamps somewhere, and not getting it quite right.

A related (probably) problem is this script

  #!/bin/sh
  rm -rf foo1 foo2
  mkdir foo1 foo2
  cd foo1
  darcs inittree
  echo zig > foo
  darcs add foo
  sleep 1
  darcs record -a -m add_foo -A x
  #sleep 1
  echo zag >> foo
  darcs record -a -m mod_foo -A x
  cd ..

In this case the second record doesn't recognise that the file has
changed, it outputs "No changes!" and doesn't make a patch.  If I
uncomment the second 'sleep 1' command the script works as expected.

Now obviously I can always explicitly set timestamps and cause a
timestamp based system to misbehave, but I would classify that as
deliberate "abuse".  I don't consider either of the above cases to
fall into that category.

-- 
Philip Martin




More information about the darcs-users mailing list