monotone

Issue 11: Monotone does not handle symlinks

Reported by Unknown User, Jun 6, 2004

(This entry was imported from the savannah tracker, original 
location: https://savannah.nongnu.org/bugs/index.php?9231)

Hi!

I just tried to import my homedir (8GiB of misc files) into 
monotone. It worked out surprisingly well!

One thing I found annoying though is that MOnotone can not handle 
symlinks. It would be nice to have that added. This would allow for 
managing your /etc dir with monotone;-)

Comment 1 by Unknown User, Jun 21, 2004

Just read the manual in its entirety. This should actually be very 
easy to add with some addition to the hook that handles the 
.mt-attrs file...

It would be nice if the .mt-attrs file would be handled 
automatically. I.e. by adding a hook that creates/updates the file 
on commits.

Comment 2 by Unknown User, Apr 21, 2005

Does anyone have existing Lua code that handles symlinks via a hook 
function / the .mt-attrs file?

Comment 3 by Unknown User, Jun 27, 2005

[PATCH] Symbolic link support for monotone.

An all Lua solution is not possible AFAICT.
You must patch/compile the monotone c++ sources.
This is because monotone will walk directories pointed to by 
symlinks, or complain if the linked path does not exist.

The implementation here adds the symlink as if it were a normal 
file, containing SyMlInK:<linked path>
This file will be written out by monotone.
When symlink "true" is present in .mt-attrs (added by the 
add command),
the file is read, unlinked, then a symbolic link created in its 
place.

If you set the symlink attr of a normal file to true, then the file 
is checked for the "SyMlInK:" and a warning is issued if 
not found. So if you value your sanity, do not set the symlink attr 
on normal files starting with "SyMlInK:"
If you are already insane, feel free to change SYMLINK_MAGIC in 
unix/process.cc to something like "#include"

On Win32, not tested, but on checkout the normal file should be 
written out as above, but not unlinked.

Comment 4 by Stephen Leake, May 8, 2010

I'm not clear what the original problem is.

Win32 certainly does not support symlinks; trying to add mtn code to 
fake that is not a good idea.

Cygwin does support symlinks; use that instead.

Comment 5 by Thomas Keller, May 8, 2010

The problem is that symlinks are simply lost, while they should get 
a special file attribute which stores the original symlink and 
creates that instead on update / checkout / revert on supported 
platforms:

$ mtn setup .
$ touch foo
$ ln -s foo bar
$ mtn add bar
$ mtn ci -m "test"
$ file -h bar
bar: symbolic link to foo
$ rm bar
$ mtn revert --missing
$ file -h bar
bar: UTF-8 Unicode text

Comment 6 by Stephen Leake, May 8, 2010

Just to clarify; this is talking about symlinks within the 
workspace, not symlinks to files outside the workspace. It would be 
useful for mtn to preserve in-workspace symlinks. For example, /etc 
often has them.

Created: 20 years 5 months ago by Unknown User

Updated: 14 years 6 months ago

Status: New

Labels:
Type:Feature Request
Component:Working Copy
Priority:Medium

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status