From: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
To: git@vger.kernel.org
Cc: angavrilov@gmail.com, me@yadavpratyush.com,
"Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Subject: [RFC PATCH 3/4] expand regexp matching an oid to be hash agnostic
Date: Mon, 11 Oct 2021 05:17:56 -0700 [thread overview]
Message-ID: <20211011121757.627-4-carenas@gmail.com> (raw)
In-Reply-To: <20211011121757.627-1-carenas@gmail.com>
Before this change, listing or blame will fail as it couldn't find the
OID in an SHA-256 repository.
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
lib/blame.tcl | 8 ++++----
lib/choose_repository.tcl | 2 +-
lib/remote_branch_delete.tcl | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/blame.tcl b/lib/blame.tcl
index e6d4302..ee7db9d 100644
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
@@ -436,7 +436,7 @@ method _load {jump} {
$i conf -state normal
$i delete 0.0 end
foreach g [$i tag names] {
- if {[regexp {^g[0-9a-f]{40}$} $g]} {
+ if {[regexp {^g[0-9a-f]{40}(?:[0-9a-f]{24})?$} $g]} {
$i tag delete $g
}
}
@@ -513,7 +513,7 @@ method _history_menu {} {
set c [lindex $e 0]
set f [lindex $e 1]
- if {[regexp {^[0-9a-f]{40}$} $c]} {
+ if {[regexp {^[0-9a-f]{40}(?:[0-9a-f]{24})?$} $c]} {
set t [string range $c 0 8]...
} elseif {$c eq {}} {
set t {Working Directory}
@@ -635,7 +635,7 @@ method _read_blame {fd cur_w cur_d} {
$cur_w conf -state normal
while {[gets $fd line] >= 0} {
- if {[regexp {^([a-z0-9]{40}) (\d+) (\d+) (\d+)$} $line line \
+ if {[regexp {^([a-z0-9]{40}(?:[0-9a-f]{24})?) (\d+) (\d+) (\d+)$} $line line \
cmit original_line final_line line_count]} {
set r_commit $cmit
set r_orig_line $original_line
@@ -648,7 +648,7 @@ method _read_blame {fd cur_w cur_d} {
set oln $r_orig_line
set cmit $r_commit
- if {[regexp {^0{40}$} $cmit]} {
+ if {[regexp {^0{40}(?:0{24})?$} $cmit]} {
set commit_abbr work
set commit_type curr_commit
} elseif {$cmit eq $commit} {
diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
index af1fee7..e864f38 100644
--- a/lib/choose_repository.tcl
+++ b/lib/choose_repository.tcl
@@ -904,7 +904,7 @@ method _do_clone_full_end {ok} {
if {[file exists [gitdir FETCH_HEAD]]} {
set fd [open [gitdir FETCH_HEAD] r]
while {[gets $fd line] >= 0} {
- if {[regexp "^(.{40})\t\t" $line line HEAD]} {
+ if {[regexp "^([0-9a-fA-F]{40}(?:[0-9a-fA-F]{24})?)\t\t" $line line HEAD]} {
break
}
}
diff --git a/lib/remote_branch_delete.tcl b/lib/remote_branch_delete.tcl
index 5ba9fca..57bae9c 100644
--- a/lib/remote_branch_delete.tcl
+++ b/lib/remote_branch_delete.tcl
@@ -330,7 +330,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 {^([0-9a-fA-F]{40}(?:[0-9a-fA-F]{24})?) (.*)$} $line _junk obj ref]} {
if {[regsub ^refs/heads/ $ref {} abr]} {
lappend head_list $abr
lappend head_cache($cache) $abr
--
2.33.0.1081.g099423f5b7
next prev parent reply other threads:[~2021-10-11 12:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-11 12:17 [RFC PATCH 0/4] git-gui: support SHA-256 repositories Carlo Marcelo Arenas Belón
2021-10-11 12:17 ` [RFC PATCH 1/4] blame: prefer null_sha1 over nullid and retire later Carlo Marcelo Arenas Belón
2021-10-27 19:43 ` Pratyush Yadav
2021-10-11 12:17 ` [RFC PATCH 2/4] rename all *_sha1 variables and make null_oid hash aware Carlo Marcelo Arenas Belón
2021-10-11 20:07 ` Eric Sunshine
2021-11-13 6:54 ` Pratyush Yadav
2021-10-11 12:17 ` Carlo Marcelo Arenas Belón [this message]
2021-11-13 7:55 ` [RFC PATCH 3/4] expand regexp matching an oid to be hash agnostic Pratyush Yadav
2021-10-11 12:17 ` [RFC PATCH 4/4] track oid_size to allow for checks that are " Carlo Marcelo Arenas Belón
2021-11-13 8:04 ` Pratyush Yadav
2021-11-13 8:10 ` Pratyush Yadav
2021-10-11 14:15 ` [RFC PATCH 0/4] git-gui: support SHA-256 repositories Ævar Arnfjörð Bjarmason
2021-10-11 19:47 ` Carlo Arenas
2021-11-13 8:08 ` Pratyush Yadav
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=20211011121757.627-4-carenas@gmail.com \
--to=carenas@gmail.com \
--cc=angavrilov@gmail.com \
--cc=git@vger.kernel.org \
--cc=me@yadavpratyush.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.