Re: [wishlist] git-archive -L

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



René Scharfe schrieb:
> Anyway, I'll try to resurrect my old, incomplete symlink following code,
> but I don't have much time, either. :-/

After a second and a third look I don't see any salvageable parts in the
old code any more.  It was a just prototype that taught me something I
should have been able to find out by thinking alone: that to follow
links within tracked content we can't simply jump to the target, but we
have to walk the whole path step by step.

E.g., consider a repository with these four entries:

	Type	Name	Target
	-------	-------	------
	file	a/f
	symlink	a/x	f
	symlink a/y	../b/f
	symlink	b	a

Let's say our goal is to follow symlinks pointing to tracked content.

We can easily follow "a/x" to get to its target "f" by concatenating the
directory part of the symlink's path ("a/") with the target ("f"), i.e.
we only need to do a simple string operation.

If we do the same for "a/y", we'd arrive at "b/f", which is not a
tracked file by itself, though.  We need to look up each path element
one by one and follow symlinks at each step.  That can't be done with
our existing tree walkers, AFAICS, so we'd need to write a new one.

The decision to follow a link can be made by the callback and passed to
read_tree_recursive() as a return value, with, e.g., READ_TREE_FOLLOW
and READ_TREE_FOLLOW_NON_MATCHES meaning to follow all internal symlinks
and to follow only those whose target doesn't match the specified paths,
respectively.

René
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux