All of lore.kernel.org
 help / color / mirror / Atom feed
* getting git to ignore modifications to specific files
@ 2010-09-01 18:57 Chris Packham
  2010-09-01 19:06 ` Joshua Jensen
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Chris Packham @ 2010-09-01 18:57 UTC (permalink / raw)
  To: git

Hi,

We have a git repository that as some GNU build system (a.k.a.
autotools) files, my current problem is with the INSTALL file but I
suspect there may be some others. These can get modified if you are
running a different version of autotools from when the files were created.

I've had various arguments about which autotools files should or
shouldn't be included in our repositories. My general rule of thumb is
that if it is automatically generated then it shouldn't go into the
repository.

There are a couple of repositories that are local clones of 3rd party
repositories which have included the pesky auto-generated files so whle
I can remove the offending files from repositories we control I need
another solution for the 3rd part ones.

I did a bit of googling and found
  git update-index --assume-unchanged

Which works locally to stop git status from complaining. Is there anyway
for me to make a change to our clone (a .gitattribues entry?) so that
everyone can get this by default?

Thanks,
Chris

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: getting git to ignore modifications to specific files
  2010-09-01 18:57 getting git to ignore modifications to specific files Chris Packham
@ 2010-09-01 19:06 ` Joshua Jensen
  2010-09-01 19:12 ` Bruce Korb
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Joshua Jensen @ 2010-09-01 19:06 UTC (permalink / raw)
  To: Chris Packham; +Cc: git

  ----- Original Message -----
From: Chris Packham
Date: 9/1/2010 12:57 PM
> I did a bit of googling and found
>    git update-index --assume-unchanged
>
> Which works locally to stop git status from complaining. Is there anyway
> for me to make a change to our clone (a .gitattribues entry?) so that
> everyone can get this by default?
I don't think so (but I hope I'm wrong!).

Good idea, though.  +1 from me for being necessary.

Josh

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: getting git to ignore modifications to specific files
  2010-09-01 18:57 getting git to ignore modifications to specific files Chris Packham
  2010-09-01 19:06 ` Joshua Jensen
@ 2010-09-01 19:12 ` Bruce Korb
  2010-09-01 20:45   ` Chris Packham
  2010-09-01 19:24 ` Joshua Juran
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Bruce Korb @ 2010-09-01 19:12 UTC (permalink / raw)
  To: Chris Packham; +Cc: git

On Wed, Sep 1, 2010 at 11:57 AM, Chris Packham <judge.packham@gmail.com> wrote:
> I did a bit of googling and found
>  git update-index --assume-unchanged
>
> Which works locally to stop git status from complaining. Is there anyway
> for me to make a change to our clone (a .gitattribues entry?) so that
> everyone can get this by default?

Isn't that what .git/info/exclude is about?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: getting git to ignore modifications to specific files
  2010-09-01 18:57 getting git to ignore modifications to specific files Chris Packham
  2010-09-01 19:06 ` Joshua Jensen
  2010-09-01 19:12 ` Bruce Korb
@ 2010-09-01 19:24 ` Joshua Juran
  2010-09-02  4:09 ` Jonathan Nieder
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Joshua Juran @ 2010-09-01 19:24 UTC (permalink / raw)
  To: Chris Packham; +Cc: git

On Sep 1, 2010, at 11:57 AM, Chris Packham wrote:

> We have a git repository that as some GNU build system (a.k.a.
> autotools) files, my current problem is with the INSTALL file but I
> suspect there may be some others. These can get modified if you are
> running a different version of autotools from when the files were  
> created.
>
> I've had various arguments about which autotools files should or
> shouldn't be included in our repositories. My general rule of thumb is
> that if it is automatically generated then it shouldn't go into the
> repository.
>
> There are a couple of repositories that are local clones of 3rd party
> repositories which have included the pesky auto-generated files so  
> whle
> I can remove the offending files from repositories we control I need
> another solution for the 3rd part ones.

I ran into this at a previous job, except using Perforce, so the files  
were readonly and make failed.  My workaround was to comment out the  
Makefile rules for rebuilding the autotools files.

The basic issues here are self-modifying code and mixing code and  
data.  The first is why I don't use autotools; the second is why I  
don't use make.

Josh

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: getting git to ignore modifications to specific files
  2010-09-01 19:12 ` Bruce Korb
@ 2010-09-01 20:45   ` Chris Packham
  0 siblings, 0 replies; 9+ messages in thread
From: Chris Packham @ 2010-09-01 20:45 UTC (permalink / raw)
  To: Bruce Korb; +Cc: git

On 01/09/10 12:12, Bruce Korb wrote:
> On Wed, Sep 1, 2010 at 11:57 AM, Chris Packham <judge.packham@gmail.com> wrote:
>> I did a bit of googling and found
>>  git update-index --assume-unchanged
>>
>> Which works locally to stop git status from complaining. Is there anyway
>> for me to make a change to our clone (a .gitattribues entry?) so that
>> everyone can get this by default?
> 
> Isn't that what .git/info/exclude is about?

Not as far as I've been able to tell. .gitignore and .git/info/exclude
are ways to tell git to ignore these untracked files so that they don't
show up in the output of git status (and others).

In my case the file is tracked, I just don't care if it changes and I
don't want git rebase/checkout to complain if I have local modifications
to this file. Ideally I'd like git add INSTALL to treat it as if nothing
changed but have git add -f INSTALL stage the changes.

Thinking about what I can do with the existing .gitattributes I could
probably have a custom diff driver that always returns 0 (/bin/true
perhaps) and a custom merge strategy of theirs (or something sensible)
if needed. A clean/smudge filter of git update-index
--assume-(un)changed may also be possible but I haven't tried it yet.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: getting git to ignore modifications to specific files
  2010-09-01 18:57 getting git to ignore modifications to specific files Chris Packham
                   ` (2 preceding siblings ...)
  2010-09-01 19:24 ` Joshua Juran
@ 2010-09-02  4:09 ` Jonathan Nieder
  2010-09-02  9:25 ` Jan Krüger
  2010-09-02 10:20 ` Michael J Gruber
  5 siblings, 0 replies; 9+ messages in thread
From: Jonathan Nieder @ 2010-09-02  4:09 UTC (permalink / raw)
  To: Chris Packham; +Cc: git

Chris Packham wrote:

> There are a couple of repositories that are local clones of 3rd party
> repositories which have included the pesky auto-generated files so whle
> I can remove the offending files from repositories we control I need
> another solution for the 3rd part ones.

FWIW one half-solution that has worked well for me is to make a local
clone without the autogenerated files and complain to upstream so the
local clone becomes superfluous after a while.

Naturally another solutions might work better, though.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: getting git to ignore modifications to specific files
  2010-09-01 18:57 getting git to ignore modifications to specific files Chris Packham
                   ` (3 preceding siblings ...)
  2010-09-02  4:09 ` Jonathan Nieder
@ 2010-09-02  9:25 ` Jan Krüger
  2010-09-02 10:20 ` Michael J Gruber
  5 siblings, 0 replies; 9+ messages in thread
From: Jan Krüger @ 2010-09-02  9:25 UTC (permalink / raw)
  To: Chris Packham; +Cc: git

Chris Packham <judge.packham@gmail.com> wrote:

> I did a bit of googling and found
>   git update-index --assume-unchanged
> 
> Which works locally to stop git status from complaining.

Be careful with that, as it's technically meant to be used for another
purpose (e.g. slow filesystems). Notably, git reset --hard will still
kill your local modifications. In your case it seems to be about
automatically generated files so it's no big problem, but it might
still cause a bit of confusion, so I thought I'd warn you anyway.

-Jan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: getting git to ignore modifications to specific files
  2010-09-01 18:57 getting git to ignore modifications to specific files Chris Packham
                   ` (4 preceding siblings ...)
  2010-09-02  9:25 ` Jan Krüger
@ 2010-09-02 10:20 ` Michael J Gruber
  2010-09-02 19:40   ` Chris Packham
  5 siblings, 1 reply; 9+ messages in thread
From: Michael J Gruber @ 2010-09-02 10:20 UTC (permalink / raw)
  To: Chris Packham; +Cc: git

Chris Packham venit, vidit, dixit 01.09.2010 20:57:
> Hi,
> 
> We have a git repository that as some GNU build system (a.k.a.
> autotools) files, my current problem is with the INSTALL file but I
> suspect there may be some others. These can get modified if you are
> running a different version of autotools from when the files were created.
> 
> I've had various arguments about which autotools files should or
> shouldn't be included in our repositories. My general rule of thumb is
> that if it is automatically generated then it shouldn't go into the
> repository.
> 
> There are a couple of repositories that are local clones of 3rd party
> repositories which have included the pesky auto-generated files so whle
> I can remove the offending files from repositories we control I need
> another solution for the 3rd part ones.
> 
> I did a bit of googling and found
>   git update-index --assume-unchanged
> 
> Which works locally to stop git status from complaining. Is there anyway
> for me to make a change to our clone (a .gitattribues entry?) so that
> everyone can get this by default?

For tracking my git configuration including .gitk, I used

[filter "dotgitk"]
        clean = fgrep -v geometry

together with an appropriate attribute for gitk.

I don't know how your autogenerated files differ, but maybe you can set
up a filter (or custom diff driver) which makes git think the files are
equal though they are not, just like in my case (ignoring window
geometry changes for gitk).

Michael

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: getting git to ignore modifications to specific files
  2010-09-02 10:20 ` Michael J Gruber
@ 2010-09-02 19:40   ` Chris Packham
  0 siblings, 0 replies; 9+ messages in thread
From: Chris Packham @ 2010-09-02 19:40 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: git

On 02/09/10 03:20, Michael J Gruber wrote:
> Chris Packham venit, vidit, dixit 01.09.2010 20:57:
>> Hi,
>>
>> We have a git repository that as some GNU build system (a.k.a.
>> autotools) files, my current problem is with the INSTALL file but I
>> suspect there may be some others. These can get modified if you are
>> running a different version of autotools from when the files were created.
>>
>> I've had various arguments about which autotools files should or
>> shouldn't be included in our repositories. My general rule of thumb is
>> that if it is automatically generated then it shouldn't go into the
>> repository.
>>
>> There are a couple of repositories that are local clones of 3rd party
>> repositories which have included the pesky auto-generated files so whle
>> I can remove the offending files from repositories we control I need
>> another solution for the 3rd part ones.
>>
>> I did a bit of googling and found
>>   git update-index --assume-unchanged
>>
>> Which works locally to stop git status from complaining. Is there anyway
>> for me to make a change to our clone (a .gitattribues entry?) so that
>> everyone can get this by default?
> 
> For tracking my git configuration including .gitk, I used
> 
> [filter "dotgitk"]
>         clean = fgrep -v geometry
> 
> together with an appropriate attribute for gitk.
> 
> I don't know how your autogenerated files differ, but maybe you can set
> up a filter (or custom diff driver) which makes git think the files are
> equal though they are not, just like in my case (ignoring window
> geometry changes for gitk).
> 
> Michael

In my case the file differs quite a lot (GNU copyright statement has
been updated) so a simple clean filter like that won't work.

One question is if I could come up with a filter, would it even work to
stop git status from saying its modified?

I tried the custom diff

  [diff "ignoretracked"]
          command = true

but that didn't stop git status from saying it was modified. It did
however make "git diff" show no differences as expected.

The best advice seems to be get the file removed. I've sent a patch
upstream so hopefully that will fix the problem going forward.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-09-02 19:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-01 18:57 getting git to ignore modifications to specific files Chris Packham
2010-09-01 19:06 ` Joshua Jensen
2010-09-01 19:12 ` Bruce Korb
2010-09-01 20:45   ` Chris Packham
2010-09-01 19:24 ` Joshua Juran
2010-09-02  4:09 ` Jonathan Nieder
2010-09-02  9:25 ` Jan Krüger
2010-09-02 10:20 ` Michael J Gruber
2010-09-02 19:40   ` Chris Packham

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.