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

Re: [PATCH v4 0/5] Patches to avoid reporting conversion changes.

From
HGHenrik Grubbström <grubba@roxen.com>
Date
Jun 6, 2010, 10:50 UTC
Message-ID
<Pine.GSO.4.63.1006061143000.27465@shipon.roxen.com>
In-Reply-To
<20100604194201.GB21492@progeny.tock>
On Fri, 4 Jun 2010, Jonathan Nieder wrote:
Show 14 quoted lines
> Henrik Grubbström wrote:
>> On Thu, 3 Jun 2010, Jonathan Nieder wrote:
>
>>> If you wait for some
>>> real change to piggy-back onto, on the other hand, then the per-file
>>> normalization patches will make it hard to find what changed.
>>
>> This seems more like an argument against repositories where
>> renormalizations have occurred, than against the feature as such.
>
> No, it is an argument against making the process of renormalization
> more painful than it has to be (and against piggy-backing in general).
> It is kindest to have a flag day and yank the carriage returns off all
> at once like a bandage.

In the crlf case, yes, probably. In the ident case there might be good reasons to want to have the ident strings stay unmodified as long as possible (since otherwise there'll be two ident strings that identify the same code).

Currently (as I believe you know), git has no detection of when the conversion mode for a file has changed, and it might even take a while before the users notice that the repository is not normalized. eg:

   0) There's a repository with some files containing crlf line endings.
   1) User A notices that git now has native support for crlf
      line endings, and adds the attribute eol=crlf for the
      affected files.
   2) User A does a git status, sees that .gitattributes is
      modified, and commits it.
   3) User A does a new git status, and has a clean index.
   4) User B who has been developing on the project for a while
      does a git pull from user A, and gets the new .gitattributes.
   5) User B does a git status, and has a clean index.
   6) User C is new to the project and does an initial git clone,
      and ends up with a dirty index.

I believe we both agree that the above is undesireable behaviour. The above behaviour also means that it's likely that there are repositorys out there which contain unnormalized files.

What my patch set achieves is that user C above also gets a clean index.

What it seems you want is that user A above should have all files that got denormalized by the attribute change marked dirty at 2 (and 3).

With a minor change of the read-cache.c:ce_compare_data() patch (returning 1 if conv_flags has CONV_NORM_NEEDED), you should get the behaviour you want (all files which are unnormalized in the repository will be dirty).

As I believe both behaviours may be desireable a config option and/or attribute is needed. Any suggestions for a name (and default value)?

>> Well, diff and blame would be confused by a crlf renormalization
>> regardless of whether the renormalization was piggy-backed or not.
>
> Only if they cross the revision where renormalization occurred.
Which is true in both cases.
Show 5 quoted lines
> Wouldn't something like
>
> /foo.c -ident has_foreign_ident
>
> work?

Yes, but it sort of reduces the usefulness of macros if you need to expand them by hand... :-)

Better to fix the bug and wait for the fix to enter a released version.
Show 5 quoted lines
>>   * Hooks are not copied by git clone. Support for copying of hooks
>>     to non-POSIX-like systems is not something I'd like to attempt.
>
> Can't you include a hooks/pre-commit file and a HACKING file: "copy
> this file to .git/hooks if you want your patches to be accepted"?

Yes, but you still have to remember to do it everytime you clone the repository.

Thanks for taking the time to discuss the problem.

-- Henrik Grubbström grubba@grubba.org Roxen Internet Software AB grubba@roxen.com

Previous: Jonathan NiederNext: Finn Arne Gangstad
Message 12 of 19 in “Patches to avoid reporting conversion changes.”
  1. 0/5 Patches to avoid reporting conversion changes.Henrik Grubbström (Grubba), Jun 1, 2010
  2. 1/5 sha1_file: Add index_blob().Henrik Grubbström (Grubba), Jun 1, 2010
  3. 2/5 strbuf: Add strbuf_add_uint32().Henrik Grubbström (Grubba), Jun 1, 2010
  4. 3/5 cache: Keep track of conversion mode changes.Henrik Grubbström (Grubba), Jun 1, 2010
  5. 4/5 cache: Add index extension "CONV".Henrik Grubbström (Grubba), Jun 1, 2010
  6. 5/5 t/t0021: Test that conversion changes are detected.Henrik Grubbström (Grubba), Jun 1, 2010
  7. Junio C HamanoJun 2, 2010
  8. Henrik GrubbströmJun 3, 2010
  9. Jonathan NiederJun 4, 2010
  10. Henrik GrubbströmJun 4, 2010
  11. Jonathan NiederJun 4, 2010
  12. Henrik GrubbströmJun 6, 2010
  13. Finn Arne GangstadJun 7, 2010
  14. Henrik GrubbströmJun 7, 2010
  15. Finn Arne GangstadJun 7, 2010
  16. Henrik GrubbströmJun 8, 2010
  17. Finn Arne GangstadJun 9, 2010
  18. Henrik GrubbströmJun 9, 2010
  19. Finn Arne GangstadJun 10, 2010

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.