From: Henrik Grubbström Date: Tue, 08 Jun 2010 15:52:37 GMT Subject: Re: [PATCH v4 0/5] Patches to avoid reporting conversion changes. Message-ID: In-Reply-To: <20100607195013.GA27362@pvv.org> On Mon, 7 Jun 2010, Finn Arne Gangstad wrote: > On Mon, Jun 07, 2010 at 06:37:56PM +0200, Henrik Grubbström wrote: >> >> On Mon, 7 Jun 2010, Finn Arne Gangstad wrote: >> >>> I think it would be best if git at this time could decide that the >>> affected files also become dirty. The ideal commit is one that >>> both alters the .gitattributes _and_ the affected files at the same >>> time, and git should make it easy to create that commit. >> >> I agree in the case of newly added attributes. In the case of >> repositories already containing unnormalized files this however leads to >> problems. >> eg >> >> Consider the case above, but a while later when the repository has been >> fixed at HEAD. If an old version from before the normalization is >> checked out, the index will once again become dirty, which means that >> git will refuse the user to check out some other version unless the >> --force flag is given. Excessive use of --force is not a good thing. >> If the user is aware of the problem, and checking out old versions is >> a common operation, toggling the suggested option might be a good >> solution. > > Maybe I misunderstand something, but if you check out an older > version, the .gitattributes file will change to match the old version. > The old version should not have the conversion attributes set, and > should therefore result in a clean checkout? True, there's no problem before the attribute change, but there is for commits between the attribute change and when the repository got normalized (which can be a while with the current git). Re: configuration option naming: I've settled for core.normalizationPolicy, with the values 'strict' (default) for the behaviour requested by you and Jonathan, and 'relaxed' for my initial behaviour. Teaser: $ git init foo warning: templates not found /home/grubba/share/git-core/templates Initialized empty Git repository in /tmp/grubba/foo/.git/ $ cd foo $ cat >expanded-keywords $Id: some id string $ $ git add expanded-keywords $ git commit -m 'Initial commit.' [master (root-commit) 755d1f6] Initial commit. 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 expanded-keywords $ git status # On branch master nothing to commit (working directory clean) $ cat >.gitattributes * ident $ git status # On branch master # Changed but not updated: # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # # modified: expanded-keywords # # Untracked files: # (use "git add ..." to include in what will be committed) # # .gitattributes no changes added to commit (use "git add" and/or "git commit -a") $ git config core.normalizationPolicy relaxed $ git status # On branch master # Untracked files: # (use "git add ..." to include in what will be committed) # # .gitattributes nothing added to commit but untracked files present (use "git add" to track) $ git config core.normalizationPolicy strict $ git status # On branch master # Changed but not updated: # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # # modified: expanded-keywords # # Untracked files: # (use "git add ..." to include in what will be committed) # # .gitattributes no changes added to commit (use "git add" and/or "git commit -a") $ rm .gitattributes $ git status # On branch master nothing to commit (working directory clean) Which I believe matches all the behaviours that have been requested. -- Henrik Grubbström grubba@grubba.org Roxen Internet Software AB grubba@roxen.com