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

Re: [PATCH v2] Make ident dynamic, not just a hardcoded value of "$Id".

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 27, 2021, 02:59 UTC
Message-ID
<xmqq1r6fd23h.fsf@gitster.g>
In-Reply-To
<pull.1074.v2.git.git.1629952119446.gitgitgadget@gmail.com>
"Maksym Sobolyev via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 12 quoted lines
> From: Maksym Sobolyev <sobomax@sippysoft.com>
>
> This allows ident to be something like $FreeBSD$ so it provides matching
> functionality for repos migrated from CVS / SVN.
>
> This works by allowing ident to have a parameter, i.e.:
>
> * ident=MyCustomId
>
> In .gitattributes.
>
> Signed-off-by: Maksym Sobolyev <sobomax@sippysoft.com>

Just like cvs uses its configuration mechanism for LocalKeyword, this belongs to the .git/config file.

The attribute mechanism is inherently for stuff that you would want to specify per-path, so the "do we do keyword expansion for this file (yes/no)?" is a good match to be an attribute, and that question is what the original 'ident' attribute asks.

I do not think "what keyword do we want to expand as if it were $Id$?" is a question we want to be giving different answers per path, and it does not smell like a good match to be an attribute.

By allowing a potentially separate values for
    *.txt ident=FreeBSD
    *.cc  ident=OpenBSD

this gives long rope to create a mess to the users. In addition, a project can easily attack and break its users by having .gitattributes with overly long ident defined, as it would cause the attribute code to trigger the die() call added by this patch.

In short, I do not think the approach taken by this patch to use per-path attribute is a good idea at all.

I suspect that this patch mimics crlf_action when naming the new "ident_action" thing, but that is a poor choice. crlf_action does specify what different actions to be taken, but the setting does not change the way 'ident' filter behaves in any fundamental way. It just changes the constant string used to locate and replace from $Id$ to something else. ident_keyword (as this is "keyword expansion" behaviour) may be a better name.

There is no inherent reason why the custom ident string must be shorter than 255, even though it might not be a bad idea to have a reasonable floor for the length.

Previous: Junio C HamanoNext: Maksym Sobolyev via GitGitGadget
Message 8 of 11 in “Make ident dynamic, not just a hardcoded value of "$Id".”
  1. Make ident dynamic, not just a hardcoded value of "$Id".Maksym Sobolyev via GitGitGadget, Aug 23, 2021
  2. Junio C HamanoAug 23, 2021
  3. Philip OakleyAug 23, 2021
  4. Make ident dynamic, not just a hardcoded value of "$Id".Maksym Sobolyev via GitGitGadget, Aug 26, 2021
  5. Matheus TavaresAug 26, 2021
  6. Junio C HamanoSep 2, 2021
  7. Junio C HamanoSep 2, 2021
  8. Junio C HamanoAug 27, 2021
  9. Make ident dynamic, not just a hardcoded value of "$Id".Maksym Sobolyev via GitGitGadget, Sep 1, 2021
  10. Đoàn Trần Công DanhSep 2, 2021
  11. Junio C HamanoSep 1, 2021

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.