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

Re: Generic filters for git archive?

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Dec 15, 2009, 13:06 UTC
Message-ID
<4B2789EE.1030104@lsrfire.ath.cx>
In-Reply-To
<f9d2a5e10912142308o50c8b9edy63bb485658c93a03@mail.gmail.com>
Am 15.12.2009 08:08, schrieb Russ Dill:
> hmm..It does seem to be running. But I'd really like to use the
> gitattributes from the tagged version I'm exporting and I don't want
> the smudge filter to run on files I'm working on in my source tree,
> just on the export.
This seems to work here:
   $ git version
   git version 1.6.3.3
   $ mkdir /tmp/x
   $ cd /tmp/x
   $ git init
   Initialized empty Git repository in /tmp/x/.git/
   $ echo sc >a
   $ git add a
   $ echo '#!/bin/sh' >f
   $ echo 'sed "s/sc/Santa Claus/"' >>f
   $ chmod 755 f
   $ git config filter.sc.smudge ./f
   $ echo 'a filter=sc' >.gitattributes
   $ git add .gitattributes
   $ git commit -m.
   [master (root-commit) 57f6bef] .
    2 files changed, 2 insertions(+), 0 deletions(-)
    create mode 100644 .gitattributes
    create mode 100644 a
   $ rm .gitattributes
   $ git archive --prefix=x HEAD | tar xf - xa
   $ cat xa
   Santa Claus
   $ git archive --prefix=y --worktree-attributes HEAD | tar xf - ya
   $ cat ya
   sc

The first archive call uses the committed .gitattributes file and runs the file through the smudge filter. The second one uses the worktree version, which doesn't exist, so no filtering occurs.

What commands do you use?

Thanks, René

Previous: Russ Dill
Message 4 of 4 in “Generic filters for git archive?”
  1. Russ DillDec 8, 2009
  2. René ScharfeDec 9, 2009
  3. Russ DillDec 15, 2009
  4. René ScharfeDec 15, 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.