From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Pierre Habouzit <madcoder@madism.org>
Cc: git@vger.kernel.org
Subject: Re: [wishlist] git-archive -L
Date: Thu, 05 Feb 2009 00:00:18 +0100 [thread overview]
Message-ID: <498A1E02.6020707@lsrfire.ath.cx> (raw)
In-Reply-To: <4987FC03.60607@lsrfire.ath.cx>
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é
next prev parent reply other threads:[~2009-02-04 23:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-02 14:34 [wishlist] git-archive -L Pierre Habouzit
2009-02-03 8:10 ` René Scharfe
2009-02-04 23:00 ` René Scharfe [this message]
2009-02-05 15:04 ` Pierre Habouzit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=498A1E02.6020707@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=git@vger.kernel.org \
--cc=madcoder@madism.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).