Re: symbolic link management in git-archive
- From
Sergio Callegari <sergio.callegari@gmail.com>
- Date
- Mar 27, 2008, 18:34 UTC
- Message-ID
- <loom.20080327T175844-199@post.gmane.org>
- In-Reply-To
- <7v3aqcb02s.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster <at> pobox.com> writes:
Show 13 quoted lines
> > Sergio Callegari <sergio.callegari <at> gmail.com> writes: > > > I guess the answer is "no" or "not yet", but is there a way to tell the > > zip > > backend of git-archive to follow symbolic links rather than to store > > them? > > I am not sure what you mean. Are you tracking a symbolic link X that > points at Y in your revision and expecting git-archive to include > whatever > happens to be at Y (which may or may not even exist) when you run the > command?
Yes, this is the case.
> If that is the case, the answer is "no" and "will never happen". If you > are tracking a symbolic link X that points at Y, the information git > tracks is the fact that there is a symbolic link X that points at Y,
... I obviously agree with this!
> and > not what Y happens to look like at a random moment.
Well, certainly if the zip backend of git-archive in addition to the -1 ... -9 switches also supported a --dereference switch, I would not run git-archive --format=zip --dereference at "random moments". I would run it when I am sure that things pointed at by the symbolic links in the tracked project actually point at sensible things.
> Change to Y is not > tracked by git
Unless Y is also in the tracked project...
> so why should you get different output from git-archive of > the same revision before and after you modify Y which is not part of the > revision to begin with?
Basically, because if I make a zip archive instead of a git bundle, I want to store (and probably give to someone else) a copy of what _I see_ at a certain instant in time which might not exactly coincide with the tracked state.
Note that if Y is outside of the tracked project and I make an archive, and then I give the archive to my friend X, Mr. X will see the same symbolic link, but still a completely and randomly different content than I do, depending on where he is unpacking the archive.
But to get to a more practical case, my situation is this:
I have a project where I need to have the same content in multiple places, otherwise development tools are not happy. Since I do most of the development on Linux, I use symbolic links. This is very good, not just because I save space, but particularly because I am sure that the content cannot loose coherency (which would be very bad) at the different places.
Every now and then, to distribute snapshots of the project, I run git archive to make a zip file, that I give to other people. Unfortunately, some of them use Windows, where the symbolic links appear as one-liner text files. And obviously they cannot compile anything and they complain.
So I would like git archive to be able to make zip archives with the symbolic links /resolved/.
what I am asking is not to modify the standard behaviour of git archive to follow links, rather to have a switch to activate the dereferencing behaviour only when needed. In the end git archive is a nice shorthand for a checkout and a successive run of zip or tar and both zip and tar have a switch to control this dereferencing behaviour (BTW, zip on my distro dereferences by default, the switch is to store symbolic links).
Sergio