* Generic filters for git archive?
@ 2009-12-08 1:06 Russ Dill
2009-12-09 22:48 ` René Scharfe
0 siblings, 1 reply; 4+ messages in thread
From: Russ Dill @ 2009-12-08 1:06 UTC (permalink / raw)
To: git
I'm trying to add copyright headers to my source files as they are
exported via git archive. eg:
* $Copyright$
to
* Copyright (c) 2003-2009 by Foo Bar
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
And properly handling things like '# $Copyright$', '// $Copyright$',
etc. I have a sed script that does this, but no way to apply it to the
output of git archive. I tried setting up a smudge filter that would
only smudge output on archive exports, but it doesn't appear that the
smudge filters get run on git archive.
I am currently running 1.6.3.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Generic filters for git archive?
2009-12-08 1:06 Generic filters for git archive? Russ Dill
@ 2009-12-09 22:48 ` René Scharfe
2009-12-15 7:08 ` Russ Dill
0 siblings, 1 reply; 4+ messages in thread
From: René Scharfe @ 2009-12-09 22:48 UTC (permalink / raw)
To: Russ Dill; +Cc: git
Am 08.12.2009 02:06, schrieb Russ Dill:
> I'm trying to add copyright headers to my source files as they are
> exported via git archive. eg:
>
> * $Copyright$
>
> to
>
> * Copyright (c) 2003-2009 by Foo Bar
> *
> * This program is free software; you can redistribute it and/or modify it
> * under the terms of the GNU General Public License as published by the
> * Free Software Foundation; either version 2 of the License, or (at your
> * option) any later version.
> *
> * This program is distributed in the hope that it will be useful, but
> * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> * for more details.
> *
> * You should have received a copy of the GNU General Public License
> * along with this program; if not, write to the Free Software Foundation,
> * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>
> And properly handling things like '# $Copyright$', '// $Copyright$',
> etc. I have a sed script that does this, but no way to apply it to the
> output of git archive. I tried setting up a smudge filter that would
> only smudge output on archive exports, but it doesn't appear that the
> smudge filters get run on git archive.
>
> I am currently running 1.6.3.3
Is the filter attribute contained in a .gitattribute file that's part of
the tree you are trying to export? If it's only in the worktree copy,
then you need to use the option --worktree-attributes to make git
archive use it.
René
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Generic filters for git archive?
2009-12-09 22:48 ` René Scharfe
@ 2009-12-15 7:08 ` Russ Dill
2009-12-15 13:06 ` René Scharfe
0 siblings, 1 reply; 4+ messages in thread
From: Russ Dill @ 2009-12-15 7:08 UTC (permalink / raw)
To: René Scharfe; +Cc: git
On Wed, Dec 9, 2009 at 3:48 PM, René Scharfe
<rene.scharfe@lsrfire.ath.cx> wrote:
> Am 08.12.2009 02:06, schrieb Russ Dill:
>> I'm trying to add copyright headers to my source files as they are
>> exported via git archive. eg:
>>
>> * $Copyright$
>>
>> to
>>
>> * Copyright (c) 2003-2009 by Foo Bar
>> *
>> * This program is free software; you can redistribute it and/or modify it
>> * under the terms of the GNU General Public License as published by the
>> * Free Software Foundation; either version 2 of the License, or (at your
>> * option) any later version.
>> *
>> * This program is distributed in the hope that it will be useful, but
>> * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
>> * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
>> * for more details.
>> *
>> * You should have received a copy of the GNU General Public License
>> * along with this program; if not, write to the Free Software Foundation,
>> * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>>
>> And properly handling things like '# $Copyright$', '// $Copyright$',
>> etc. I have a sed script that does this, but no way to apply it to the
>> output of git archive. I tried setting up a smudge filter that would
>> only smudge output on archive exports, but it doesn't appear that the
>> smudge filters get run on git archive.
>>
>> I am currently running 1.6.3.3
>
> Is the filter attribute contained in a .gitattribute file that's part of
> the tree you are trying to export? If it's only in the worktree copy,
> then you need to use the option --worktree-attributes to make git
> archive use it.
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Generic filters for git archive?
2009-12-15 7:08 ` Russ Dill
@ 2009-12-15 13:06 ` René Scharfe
0 siblings, 0 replies; 4+ messages in thread
From: René Scharfe @ 2009-12-15 13:06 UTC (permalink / raw)
To: Russ Dill; +Cc: git
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é
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-12-15 13:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-08 1:06 Generic filters for git archive? Russ Dill
2009-12-09 22:48 ` René Scharfe
2009-12-15 7:08 ` Russ Dill
2009-12-15 13:06 ` René Scharfe
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).