git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Matheus Tavares <matheus.bernardino@usp.br>
Cc: gitgitgadget@gmail.com, git@vger.kernel.org,
	philipoakley@iee.email, sobomax@gmail.com, sobomax@sippysoft.com
Subject: Re: [PATCH v2] Make ident dynamic, not just a hardcoded value of "$Id".
Date: Wed, 01 Sep 2021 17:58:06 -0700	[thread overview]
Message-ID: <xmqqr1e77q01.fsf@gitster.g> (raw)
In-Reply-To: <20210826203713.45139-1-matheus.bernardino@usp.br> (Matheus Tavares's message of "Thu, 26 Aug 2021 17:37:13 -0300")

Matheus Tavares <matheus.bernardino@usp.br> writes:

> Hi, Maksym
>
> I haven't read the entire patch (and I don't normally use the ident feature),
> but I left a few comments below: 
>
> On Thu, Aug 26, 2021 at 1:28 AM Maksym Sobolyev via GitGitGadget <gitgitgadget@gmail.com> wrote:
>>
>> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
>> index 83fd4e19a4..9e486f3e8d 100644
>> --- a/Documentation/gitattributes.txt
>> +++ b/Documentation/gitattributes.txt
>> @@ -382,6 +382,14 @@ sign `$` upon checkout.  Any byte sequence that begins with
>>  `$Id:` and ends with `$` in the worktree file is replaced
>>  with `$Id$` upon check-in.
>>
>> +The `ident` attribute can also provide an optional value,
>> +which if supplied is going to be used for expansion instead of
>> +the string `Id`.
>> +
>> +------------------------
>> +*.[ch]         ident=FreeBSD
>> +------------------------
>
> What happens if there is a ':' or '$' in the custom id name?

It is a valid question.  I actually think these two bytes should be
excluded from the custom ID string --- FWIW, I also do not think
there is any practical problem if we limited the set of characters
to [A-Za-z0-9] and nothing else.

> You might want to take a look at the other ident tests in
> t0021-conversion.sh and perhaps addapt/copy some of them to ensure that
> the expected behavior persists when using a custom id name. For example,
> quickly changing the "$Id:" references to "$customId:" and replacing
> "ident" with "ident=customId", I seem to get at least one test failure:
>
> --- expected-output     2021-08-26 19:40:07.181596662 +0000
> +++ expanded-keywords   2021-08-26 19:40:07.188263463 +0000
> @@ -6,5 +6,5 @@
>  $customId: bebd07c752ffffd6779e1056db5de66c3bb733ed $
>  $customId: bebd07c752ffffd6779e1056db5de66c3bb733ed $
>  $customId: NoTerminatingSymbol
> -$customId: Foreign Commit With Spaces $
> +$customId: bebd07c752ffffd6779e1056db5de66c3bb733ed $
>  $customId: NoTerminatingSymbolAtEOF
> \ No newline at end of file
> error: last command exited with $?=1
> not ok 3 - expanded_in_repo
>
> (But I haven't dig further, and this was just a quick test, so it could be my
> fault.)

If we are not restricting the characters that can be used in the
custom ID placeholder, we probably should have tests that use
allowed but unusual characters.

Thanks.

  reply	other threads:[~2021-09-02  0:58 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 [this message]
2021-09-02 19:04       ` Junio C Hamano
2021-08-27  2:59   ` Junio C Hamano
     [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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqr1e77q01.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=matheus.bernardino@usp.br \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).