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

Re: [wishlist] git-archive -L

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Feb 3, 2009, 08:10 UTC
Message-ID
<4987FC03.60607@lsrfire.ath.cx>
In-Reply-To
<20090202143425.GA30667@artemis.corp>
Pierre Habouzit schrieb:
Show 32 quoted lines
> Hi Rene,
> 
> I wanted to do that myself, but I sadly miss the time right now, so I
> wonder if you'd know how to do the following.
> 
> We have in our repository a kind of modular system (for a family of web
> sites) where each web-site uses a (versionned) symlink farm. IOW it
> works basically that way:
> 
>     www/module1
>     www/module2
>     product_A/www/module1 -> ../../www/module1
>     product_A/www/module_A
>     product_B/www/module1 -> ../../www/module1
>     product_B/www/module2 -> ../../www/module2
>     product_B/www/module_B
> 
> Though product_A and _B even if they share a fair amount of code, are
> separate products and when we release, we'd like to be able to perform
> from inside:
> 
>     git archive --format=tar -L product_$A
> 
> where -L basically does what it does in cp: dereference symlinks.  To
> make the thing hairier, we also have symlinks _inside_ www/ (pointing
> into the same subtree) that we'd like to keep if possible (even if it's
> not a big deal).
> 
> So I'd suggest something where -L only dereferences the symlink if it
> goes outside of the list of paths passed to git-archive, and -LL (or -L
> -L) dereferences anything. Of course this would only make sense if the
> symlinks resolve to something that is tracked :)

Last April, I was working on making archive follow all symlinks pointing to internal files. The goal was a bit different, namely to create archives for platforms without symlink support (i.e. it would resolve all symlinks pointing to tracked objects).

IIRC the code had some limitations, e.g. it couldn't follow a symlink to a path containing symlinked directories. I'll need to rebase it to master first, though, as the surrounding code has changed a bit in the meantime.

To follow only symlinks that point outside of the specified paths sounds like a sensible mode of operation, but I'm not sure that it's worth a one letter option.

Given your setup you also might want to take a look at submodules and the recent submodule archival support patches by Lars Hjelmi.

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

René
Previous: Pierre HabouzitNext: René Scharfe
Message 2 of 4 in “[wishlist] git-archive -L”
  1. Pierre HabouzitFeb 2, 2009
  2. René ScharfeFeb 3, 2009
  3. René ScharfeFeb 4, 2009
  4. Pierre HabouzitFeb 5, 2009

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.