[darcs-users] Behaviour of add, with non-existent filenames

JohnMark de Mello demellj at gmail.com
Thu Jun 9 13:38:53 UTC 2011


Hi folks,

Might I suggest you make the operation atomic, in the sense if the file
addition fails, then neither is the directory added. Ideally all user driven
commands should behave likewise, i.e. nothing should succeeds partially. It
should either entirely succeed or entirely fail.

Regards,
JohnMark

On Thu, Jun 9, 2011 at 7:35 AM, Owen Stephens <darcs at owenstephens.co.uk>wrote:

> Currently, Darcs will implicitly add the directory containing a to-be-added
> file, if it is not known by Darcs. This is desirable, but has shown up some
> strange bugs.
>
> Particularly, adding a non-existent file within a newly-added directory
> will
> cause Darcs to print an error message, but it will exit successfully.
> Something
> like:
>
> $ mkdir subdir
> $ cd subdir
> $ darcs add foo
> File subdir/foo does not exist!
> $ echo $?
> 0
> $ darcs wh
> adddir ./subdir
> $ darcs add foo
> File subdir/foo does not exist!
>
> darcs failed:  No files were added
> $ echo $?
> 2
>
> The second time add is called, Darcs exits with a non-zero status, since
> the
> directory has already been added.
>
> The current fix I have coded will only add files/directories if all the
> files
> specified exist (if any fail to be added, no changes will be made).
> However,
> this could be somewhat heavy-handed - someone might want to specify a long
> list
> of possibly-existing files, and tolerate the failures.
>
> I can't think of an instance of this use-case (mainly because I tend to add
> files using shell-globbing, which wouldn't cause a non-existent name to be
> specified), but I'd like to know if anyone has used something that is
> similar, where
> my change would break the expected behaviour.
>
> What should Darcs do in the case where non-existent files are added?
>
> Cheers,
> Owen.
>
> _______________________________________________
> darcs-users mailing list
> darcs-users at darcs.net
> http://lists.osuosl.org/mailman/listinfo/darcs-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20110609/3eab0621/attachment.html>


More information about the darcs-users mailing list