[darcs-devel] darcs patch: Fix handling of --repo with relative
paths.
Eric Kow
eric.kow at loria.fr
Sat Jul 14 01:15:49 PDT 2007
Sat Jul 14 09:54:32 CEST 2007 Eric Kow <eric.kow at loria.fr>
* Fix handling of --repo with relative paths.
We did not correctly deal with the case where the user passes in a directory
path via the --repo flag (which allows the user specify either a URL or a
directory, in contrast with --repodir, which only allows for directories).
Darcs.Commands.Changes has special routines to detect the --repo flag; they are
executed after the findRepository prerequisite. The prereq does not take the
--repo flag into account. This was by (mistaken) design because --repo could
well be a URL. However, one characteristic of the findRepository prereq is
that it changes the current directory whilst hunting for _darcs, so if you pass
in a *relative* path via 'repo', the --repo flag will fail to find the
directory you want.
For example if you have
* repo - a darcs repository
* repo/intervening - a subdir
* repo/intervening/nested - a nested repository (like test/temp1 in darcs)
Then this does not work
[] $ cd repo/intervening
[repo/intervening] $ darcs changes --repo=nested
Darcs will hunt upwards, repeatedly doing a cd.. until it finds a _darcs
directory. Then it interprets the --repo flag and finds the argument 'nested';
however, the current directory has been changed by findRepository, so now the
relative path is meaningless!
The fix is to make findRepository properly aware of the --repo flag. This way,
we avoid calling seekRepo if we realises that we have been passed the --repo
argument with a directory. Note that we still have to keep the old code
around too, to cover the case where --repo is a URL.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-darcs-patch
Size: 102673 bytes
Desc: A darcs patch for your repository!
Url : http://lists.osuosl.org/pipermail/darcs-devel/attachments/20070714/e0244469/attachment-0001.bin
More information about the darcs-devel
mailing list