git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 10 in “symbolic link management in git-archive”
  1. Sergio CallegariMar 27, 2008
  2. Miklos VajnaMar 27, 2008
  3. Johannes SchindelinMar 27, 2008
  4. Sergio CallegariMar 27, 2008
  5. Junio C HamanoMar 27, 2008
  6. Sergio CallegariMar 27, 2008
  7. Junio C HamanoMar 27, 2008
  8. Sergio CallegariMar 27, 2008
  9. René ScharfeMar 31, 2008
  10. Sergio CallegariMar 31, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.