[darcs-users] When and how is darcs using diff? (was: Line endings opinion poll)

Michael Conrad conradme at email.uc.edu
Sun Oct 31 04:23:06 UTC 2004


On Saturday, October 30, 2004 10:40 PM, I wrote:
> The problem remains that the mess will still get recorded, and then need
to
> be fixed and a new patch generated, which will likely cause conflicts with
> Ned's repo.
>
> I had forgotten the classic issue of tabbing/spacing, though; thats
another
> annoying one.  (The working files can be fixed with a script, but not the
> patches)
>
> What about the custom-diff idea?  If I could somehow pass -b to diff, it
> would solve the irritation: darcs would only see changes involving real
> edits, and not whitespace finagling.  I forget if this will solve the ^M
> problem as well, but I could always hack up my own version of diff.
>
> I'm thinking that darcs would remain consistent if -b were applied to ALL
of
> its calls to diff.  Can anyone think of an exception?

In order to give this a test, and not have to spend time learning haskell
(which I'll do one of these days, really!) I figured I'd just force diff to
always have the -b option, the direct way.
So I tried:

$ vi darcsdiff.c
(trimmed slightly for email)
#include <unistd.h>
int main(int argc, char** argv) {
    int i;
    char** newArgs= (char**) calloc(argc+2, sizeof(char*));
    newArgs[0]= argv[0];
    newArgs[1]= "-b";
    for (i=1; i<=argc; i++)
        newArgs[i+1]= argv[i];
    execv("/usr/bin/truediff", newArgs);
}
$ gcc -o darcsdiff darcsdiff.c
# mv /usr/bin/diff /usr/bin/truediff
# mv darcsdiff /usr/bin/diff
$ mkdir temp && cd temp && darcs init
$ vi blah
12345
$ darcs record
$ vi blah
  12345

And now, "diff -r --exclude=_darcs . _darcs/current" shows nothing, but
"darcs whatsnew" shows the change as usual.  So isn't darcs using diff to
detect changes?

-Mike





More information about the darcs-users mailing list