aboutsummaryrefslogtreecommitdiffstats
path: root/lib/remote_branch_delete.tcl
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2025-07-16 09:32:25 +0200
committerJohannes Sixt <j6t@kdbg.org>2025-07-16 18:52:38 +0200
commitdab92fe42fad87a2f7067589a32ee08e70d5354b (patch)
tree0bc70a72792cbab31b9e651135ede55d6e0f4b9a /lib/remote_branch_delete.tcl
parentgit-gui: Replace null_sha1 with nullid (diff)
downloadgit-dab92fe42fad87a2f7067589a32ee08e70d5354b.tar.gz
git-dab92fe42fad87a2f7067589a32ee08e70d5354b.zip
git-gui: Add support of SHA256 repo
This patch adds the basic support of SHA256 Git repositories. Most of changes are idiomatic replacement of the hard-coded hash ID length, but there are subtle things: * The hash length is determined on startup, and stored in $hashlength global variable (either 40 or 64). * The hard-coded "40" are replaced with $hashlength; for regexp patterns, the ugly string map is used. * Some code have the fixed numbers like 39 and 45, and those are replaced with the $hashlength and the offset correction. * $nullid and $nullid2 are generated for the hash length. A caveat is that repository picker dialog is performed before evaluating the repo type, hence $hashlength isn't set there yet. So the code dealing with the hard-coded "40" are handled differently; namely, the regexp range is expanded, and the null id is generated from the HEAD id length locally. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Diffstat (limited to '')
-rw-r--r--lib/remote_branch_delete.tcl4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/remote_branch_delete.tcl b/lib/remote_branch_delete.tcl
index c8c99b17a8..781980d66c 100644
--- a/lib/remote_branch_delete.tcl
+++ b/lib/remote_branch_delete.tcl
@@ -323,6 +323,8 @@ method _load {cache uri} {
}
method _read {cache fd} {
+ global hashlength
+
if {$fd ne $active_ls} {
catch {close $fd}
return
@@ -330,7 +332,7 @@ method _read {cache fd} {
while {[gets $fd line] >= 0} {
if {[string match {*^{}} $line]} continue
- if {[regexp {^([0-9a-f]{40}) (.*)$} $line _junk obj ref]} {
+ if {[regexp [string map "@@ $hashlength" {^([0-9a-f]{@@}) (.*)$}] $line _junk obj ref]} {
if {[regsub ^refs/heads/ $ref {} abr]} {
lappend head_list $abr
lappend head_cache($cache) $abr