All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Maksym Sobolyev via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Philip Oakley <philipoakley@iee.email>,
	Maksym Sobolyev <sobomax@gmail.com>,
	Maksym Sobolyev <sobomax@sippysoft.com>
Subject: Re: [PATCH v2] Make ident dynamic, not just a hardcoded value of "$Id".
Date: Thu, 26 Aug 2021 19:59:46 -0700	[thread overview]
Message-ID: <xmqq1r6fd23h.fsf@gitster.g> (raw)
In-Reply-To: pull.1074.v2.git.git.1629952119446.gitgitgadget@gmail.com

"Maksym Sobolyev via GitGitGadget" <gitgitgadget@gmail.com> writes:

> 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.


  parent reply	other threads:[~2021-08-27  2:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23 16:41 [PATCH] Make ident dynamic, not just a hardcoded value of "$Id" Maksym Sobolyev via GitGitGadget
2021-08-23 18:10 ` Junio C Hamano
2021-08-23 18:41 ` Philip Oakley
2021-08-26  4:28 ` [PATCH v2] " Maksym Sobolyev via GitGitGadget
2021-08-26 20:37   ` Matheus Tavares
2021-09-02  0:58     ` Junio C Hamano
2021-09-02 19:04       ` Junio C Hamano
2021-08-27  2:59   ` Junio C Hamano [this message]
     [not found]     ` <CABFYoQC_FzbU_E4hU0kCz-WFJNOLspwL2Gjc01sMXDZosxJWjw@mail.gmail.com>
2021-09-01  5:35       ` Junio C Hamano
2021-09-01  2:13   ` [PATCH v3] " Maksym Sobolyev via GitGitGadget
2021-09-02  3:40     ` Đoàn Trần Công Danh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq1r6fd23h.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=philipoakley@iee.email \
    --cc=sobomax@gmail.com \
    --cc=sobomax@sippysoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.