Hi all, I prefer to ask instead of submit a patch because maybe there is a
good reason for the following:

In Darcs.Patch.Prim

> isSuperdir :: FileName -> FileName -> Bool

isSuperdir d1 d2 = isd (fn2fp d1) (fn2fp d2)

    where isd s1 s2 =

              length s2 >= length s1 + 1 && take (length s1 + 1) s2 == s1 ++
> "/"


In Darcs.Patch.FileName

> movedirfilename :: FileName -> FileName -> FileName -> FileName

movedirfilename old new name =

    if name' == old' then new

                     else if *length name' > length old' &&*

*                             take (length old'+1) name' == old'++"/"*

                          then fp2fn ("./"++new'++drop (length old') name')

                          else name

    where old' = fn2fp $ normPath old

          new' = fn2fp $ normPath new

          name' = fn2fp $ normPath name


I think movedirfilename will be more readable if the bold code is replaced
by "name" `isSuperdir` "old". Since some normalization is performed I don't
know if the use of isSuperdir :: FileName -> FileName -> Bool is the best
choice, but anyway, I think a where clause "where isSuperdir = ..." will be
very appreciated when reading movedirfilename.

-- 
Iago Abal Rivas
_______________________________________________
darcs-users mailing list
darcs-users@darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to