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

Re: [PATCH v2 1/2] convert: fix normalization of foreign idents

From
Marcus Comstedt <marcus@mc.pp.se>
Date
Sep 12, 2010, 21:01 UTC
Message-ID
<yf9hbhuisla.fsf@chiyo.mc.pp.se>
In-Reply-To
<7vmxrqjvf6.fsf@alter.siamese.dyndns.org>
Hi Junio.
Junio C Hamano <gitster@pobox.com> writes:
> Would it be possible that the real culprit is that ident_to_worktree()
> does not always touch $Id$ in the first place?  Why isn't "$Id: garbage$"
> first cleaned and then smudged upon checkout?

Please see commit 07814d90095b65b4594efd47c69f9f171ef162d4, and the discussion preceeding it.

> It also smells wrong that this "sometimes we convert, sometimes we don't"
> is a special case for "$Id$" and for no other conversion.  Why don't
> smudge/clean filter or CRLF conversion have the same issue that can be
> solved with the same approach as this patch takes?

I gather that this is because nobody has come up with a use case for smudge/clean or CRLF where a (pervasive) non-normalized representation in the repository makes sense.

Specifically, a foreign ident in the repo is not "garbage", but something useful when you migrate a repo from a different VCS for (at least) the following reasons:

* It allows you to check out a historical tree from the git repo which
  looks exactly like what it would look like if you checked it out
  from the previous system
* It provides an indication that a version of a file comes directly
  from the previous VCS, without any modification since the migration
  to git, and exactly where in the history of the previous VCS it has
  originated
* Quite frankly, idents generated by other VCSs contain more useful
  information than those generated by git, so it's a waste to discard
  them prematurely

The same effect can be achieved without direct support for foreign idents by instead using fine-grained control in .gitattributes to force -ident on any file which still has foreign idents, but there are two downsides to this approach:

* A commit hook (and probably a pre-receive hook at the "blessed"
  repository) is needed to make sure that no commits are allowed to a
  file with foreign idents without also flipping the attribute from
  -ident to +ident
* Either a full enumeration of all files with foreign idents, or
  of all files with native idents, is needed in .gitattributes, so
  that a file can be either added to or removed from this list when
  making the first "native" commit to it

So it's possible, albeit slightly less practical, to do without this feature. If the decision to include it is reversed, 07814d90095b65 should probably be reverted.

  // Marcus
Previous: Junio C HamanoNext: Junio C Hamano
Message 13 of 19 in “Fix for normalization of foreign idents”
  1. Marcus ComstedtAug 23, 2010
  2. convert: fix normalization of foreign identsMarcus Comstedt, Aug 23, 2010
  3. Jonathan NiederAug 23, 2010
  4. Marcus ComstedtAug 23, 2010
  5. Jonathan NiederAug 23, 2010
  6. Junio C HamanoAug 23, 2010
  7. Marcus ComstedtAug 24, 2010
  8. Marcus ComstedtSep 6, 2010
  9. Jonathan NiederSep 6, 2010
  10. Marcus ComstedtSep 7, 2010
  11. 1/2 convert: fix normalization of foreign identsMarcus Comstedt, Aug 23, 2010
  12. Junio C HamanoSep 10, 2010
  13. Marcus ComstedtSep 12, 2010
  14. Junio C HamanoSep 12, 2010
  15. Marcus ComstedtSep 12, 2010
  16. convert: generalize checksafe parameterMarcus Comstedt, Sep 13, 2010
  17. 2/2 t0021: test checkout and commit of foreign identsMarcus Comstedt, Sep 7, 2010
  18. 0/2 fix normalization of foreign idents (now with test cases)Marcus Comstedt, Sep 7, 2010
  19. Jonathan NiederSep 8, 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.