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

Re: [PATCH] Add a basic support of SHA256 repositories into Gitk

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 16, 2021, 14:19 UTC
Message-ID
<87h7hxyjkv.fsf@evledraar.gmail.com>
In-Reply-To
<xmqqwnqutx6o.fsf@gitster.g>
On Wed, Jun 16 2021, Junio C Hamano wrote:
Show 27 quoted lines
> "Rostislav Krasny via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> From: Rostislav Krasny <rosti.bsd@gmail.com>
>>
>> Signed-off-by: Rostislav Krasny <rosti.bsd@gmail.com>
>> ---
>>     gitk: Add a basic support of SHA256 repositories into Gitk
>
> Looping-in the gitk maintainer.
>
>>     This PR makes Gitk working on both SHA256 and SHA1 repositories without
>>     errors/crashes. I made it by changing and testing the gitk script of Git
>>     for Windows [https://gitforwindows.org/] version 2.32.0.windows.1 that
>>     is a little bit different than the mainstream 2.32.0 version.
>>     
>>     Still not fixed functionality: [1] There is the "Auto-select SHA1
>>     (length)" configuration preference that affects "Copy commit reference"
>>     on both SHA1 and SHA256 repositories.
>>     
>>     A new "Auto-select SHA256 (length)" configuration preference should be
>>     added and used on SHA256 repositories instead of the old one. Since I'm
>>     not familiar with Tcl/Tk and this issue isn't critical I didn't
>>     implement it.
>
> Thanks, Rostislav; please follow Documentation/SubmittingPatches
> next time you touch gitk (or git-gui), as they have their own
> repositories and maintainers.

A comment on the patch at large: I realize that the author isn't familiar with Tcl, and this is a minimal & immediate fix, so maybe we should just take it.

But I wonder if this == 40 or == 64 shouldn't just be "accept either" in this case, these all seem like cases where we disambiguate a hash from some other name.

Doing so would be nicely forward-compatible in case gitk and others ever need to deal with viewing a mixed set of hashes, or maybe I'm again misrecalling the transition plan and that'll never happen (they'll always be translated?).

Especially stuff like this (grabbing a bit to quote from the patch):
>> -        if {[regexp {^[0-9a-f]{4,39}$} $id]} {
>> +        if {[regexp [string map "@@ [expr $hashlength - 1]" {^[0-9a-f]{4,@@}$}] $id]} {
Would be simpler as just:
    if {[regexp {^[0-9a-f]{4,63}$} $id]} {
Previous: Junio C HamanoNext: Felipe Contreras
Message 3 of 5 in “Add a basic support of SHA256 repositories into Gitk”
  1. Add a basic support of SHA256 repositories into GitkRostislav Krasny via GitGitGadget, Jun 14, 2021
  2. Junio C HamanoJun 16, 2021
  3. Ævar Arnfjörð BjarmasonJun 16, 2021
  4. Felipe ContrerasJun 19, 2021
  5. Rostislav KrasnyMay 2, 2022

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.