On Thu, 22 Dec 2011 19:00:18 -0500 Martin Gagnon wrote:

> On 2011-12-22, at 15:43, Justin Gedge <[email protected]> wrote:
> If it remove directories, what fossil should do if there's some
> untracked files in those directories, delete the whole directory with
> all those files in it?
> Just wondering. May be another case for a so multipurpose "-f"
> switch ? ;)

Fossil check-ins mirror the state of working trees and vice versa,
excluding extra files in the working tree that are not present in any
of the check-ins. All actions in Fossil related to this mirroring
(checkout, update, commit) are not destructive in these cases:

* File has changes.

* File is absent.

* Another file with the same path, but different contents exists.
  (Fossil asks to overwrite such file.)

Not deleting empty directories looks like a bug, because it breaks the
mirroring. For example, if a subsequent check-in removes a file, when
you checkout this commit (while the working tree is in the state of
previous commit), the file gets removed (unless it has changes, see
above).

Consider this case:

Check-in 1:

file.txt
dir1/file1.txt
dir1/file2.txt
dir2/another.txt

Check-in 2:

file.txt
dir1/file1.txt

The obvious way to mirror going from check-in 1 to check-in 2 in the
working tree is:

1) Remove dir1/file2.txt, because it's not present in the commit.
2) Remove dir2/another.txt, ="=

Now, it's helpful for this exercise to treat the whole path as a "file"
instead of looking at it as a directory/file structure:

3) Do we have files named dir1/* either in the commit or as extras in
the working tree? Yes, thus, not removing "dir1" part.

4) Do we have files named dir2/* in the commit or as extras? 
   a) If we have, don't remove directory.
   b) If we don't, we no longer have any files with such names, thus
      we should remove this empty directory.

Another way to look into going from ci 1 to ci 2, which is easier to
understand:

* KILL EVERYTHING in the working tree... except extra files.
* Checkout commit 2.

So, my points:

+ Fossil should remove empty directories.

+ There's no need for -f option to kill extra files. For this, we have
  `fossil clean` command.

-- 
Dmitry Chestnykh
http://www.codingrobots.com
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to