[darcs-devel] Expanding Slurpy
Juliusz Chroboczek
Juliusz.Chroboczek at pps.jussieu.fr
Fri Apr 29 07:43:27 PDT 2005
David, Ian,
In SlurpDirectory.lhs, you say:
data Slurpy = SlurpDir FileName (Maybe (IO ())) [Slurpy]
| SlurpFile FileName Bool (EpochTime,FileOffset) FileContents
Would it be okay with you if I changed the Slurpy type in the
following ways:
- replace the mtime field in SlurpFile, which is currently of type
EpochTime, to be a Maybe Epochtime, and add a Maybe Epochtime field
to SlurpDir;
- add a field ``hash'' of type Maybe String to both of those.
The net effect would be
data Slurpy = SlurpDir FileName
(Maybe EpochTime, Maybe String)
(Maybe (IO ())) [Slurpy]
| SlurpFile FileName Bool
(Maybe EpochTime, FileOffset, Maybe String)
FileContents
Here are the reasons for that. Git has a data structure called ``the
cache'', which is analogous to Darcs' pristine cache. Unlike Darcs'
cache, however, Git's cache is not guaranteed to be up-to-date, or
even to exist. For reasons that the margin of this e-mail is too
narrow to contain, I cannot refresh the cache when I find it's not
up-to-date.
Hence,
- when slurping the pristine tree from Git and there's no Git cache
available, I don't have any time information. I'm currently just
putting an EpochTime of 0, but that will lead to trouble if the
user actually has files with a time of 0;
- when slurping the pristine tree from Git and there *is* a Git cache
available, I can get the sha1 very easily. This will allow me to
make commits faster as I won't need to rehash the file that I'm
committing;
- when slurping the current tree from Git and there is a Git cache
available, I can, under some circumstances, notice that given files
and even full subtrees as being up-to-date, and generate the
correct sha1 hashes. This will allow me to make things like
``darcs whatsnew'' much faster.
Juliusz
More information about the darcs-devel
mailing list