Re: What's cooking in git.git (Jun 2010, #04; Wed, 23)
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Jun 25, 2010, 06:02 UTC
- Message-ID
- <4C244658.9020704@viscovery.net>
- In-Reply-To
- <7veifwchb6.fsf@alter.siamese.dyndns.org>
Am 6/24/2010 22:21, schrieb Junio C Hamano:
Show 11 quoted lines
> Finn Arne Gangstad <finnag@pvv.org> writes: >> If .gitattributes is different on the different sides, or if you >> enable autocrlf, the current repo contents may change after >> git-to-worktree and worktree-to-git again. > > IOW, g2w-then-w2g may not be an identity function. > > If we were to encourage use of this codepath to wider audiences, we may > need to have a document for people who write smudge/clean filters. In > order for the result to be stable, applying g2w-then-w2g once again on top > of the result of running g2w-then-w2g on anything should be no-op, no?
I think this is implicit to some degree in the documentation, gitattributes(5):
The content filtering is done to massage the content into a shape that is more convenient for the platform, filesystem, and the user to use. [...] the intent is that if someone unsets the filter driver definition, or does not have the appropriate filter program, the project should still be usable.
>From this I read that the content of the repository can only be in a
canonical shape; hence, the only thing that a clean filter can do is to generate the canonical shape of the data. This is, by definition, an idempotent operation (i.e., g2w(g2w(x)) == g2w(x)).
(I'm talking only about clean filters because any pair of smudge+clean filters where the clean filter cannot undo the effect of the smudge filter would be noticed immediately and be considered broken without being mentioned explicitly in the documentation.)
-- Hannes