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

Re: [RFC PATCH 4/4] track oid_size to allow for checks that are hash agnostic

From
Pratyush Yadav <me@yadavpratyush.com>
Date
Nov 13, 2021, 08:10 UTC
Message-ID
<20211113081032.rz6ibhf5qfv27ca3@yadavpratyush.com>
In-Reply-To
<20211113080435.54vs6ihljtkwcpe4@yadavpratyush.com>
On 13/11/21 01:34PM, Pratyush Yadav wrote:
Show 49 quoted lines
> On 11/10/21 05:17AM, Carlo Marcelo Arenas Belón wrote:
> > This allows commit to work.
> 
> Please explain _why_ it allows commit to work.
> 
> > 
> > Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> > ---
> >  git-gui.sh     | 5 +++--
> >  lib/commit.tcl | 3 ++-
> >  2 files changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/git-gui.sh b/git-gui.sh
> > index c0dc8ce..1646124 100755
> > --- a/git-gui.sh
> > +++ b/git-gui.sh
> > @@ -1821,10 +1821,11 @@ proc short_path {path} {
> >  
> >  set next_icon_id 0
> >  if { [get_config extensions.objectformat] eq "sha256" } {
> > -	set null_oid [string repeat 0 64]
> > +	set oid_size 64
> >  } else {
> > -	set null_oid [string repeat 0 40]
> > +	set oid_size 40
> >  }
> > +set null_oid [string repeat 0 $oid_size]
> >  
> >  proc merge_state {path new_state {head_info {}} {index_info {}}} {
> >  	global file_states next_icon_id null_oid
> > diff --git a/lib/commit.tcl b/lib/commit.tcl
> > index 11379f8..1306e8d 100644
> > --- a/lib/commit.tcl
> > +++ b/lib/commit.tcl
> > @@ -337,6 +337,7 @@ proc commit_committree {fd_wt curHEAD msg_p} {
> >  	global file_states selected_paths rescan_active
> >  	global repo_config
> >  	global env
> > +	global oid_size
> >  
> >  	gets $fd_wt tree_id
> >  	if {[catch {close $fd_wt} err]} {
> > @@ -356,7 +357,7 @@ proc commit_committree {fd_wt curHEAD msg_p} {
> >  		close $fd_ot
> >  
> >  		if {[string equal -length 5 {tree } $old_tree]
> > -			&& [string length $old_tree] == 45} {
> > +			&& [string length $old_tree] == 5 + oid_size} {
>                                            ^ missing '$'

I think different tab sizes might end up rendering the ^ in a differnt place. So to clarify: Missing '$' before oid_size.

Show 13 quoted lines
> 
> I think you forgot to test this one ;-)
> 
> >  			set old_tree [string range $old_tree 5 end]
> >  		} else {
> >  			error [mc "Commit %s appears to be corrupt" $PARENT]
> > -- 
> > 2.33.0.1081.g099423f5b7
> > 
> 
> -- 
> Regards,
> Pratyush Yadav
-- 
Regards,
Pratyush Yadav
Previous: Pratyush YadavNext: Ævar Arnfjörð Bjarmason
Message 11 of 14 in “git-gui: support SHA-256 repositories”
  1. 0/4 git-gui: support SHA-256 repositoriesCarlo Marcelo Arenas Belón, Oct 11, 2021
  2. 1/4 blame: prefer null_sha1 over nullid and retire laterCarlo Marcelo Arenas Belón, Oct 11, 2021
  3. Pratyush YadavOct 27, 2021
  4. 2/4 rename all *_sha1 variables and make null_oid hash awareCarlo Marcelo Arenas Belón, Oct 11, 2021
  5. Eric SunshineOct 11, 2021
  6. Pratyush YadavNov 13, 2021
  7. 3/4 expand regexp matching an oid to be hash agnosticCarlo Marcelo Arenas Belón, Oct 11, 2021
  8. Pratyush YadavNov 13, 2021
  9. 4/4 track oid_size to allow for checks that are hash agnosticCarlo Marcelo Arenas Belón, Oct 11, 2021
  10. Pratyush YadavNov 13, 2021
  11. Pratyush YadavNov 13, 2021
  12. Ævar Arnfjörð BjarmasonOct 11, 2021
  13. Carlo ArenasOct 11, 2021
  14. Pratyush YadavNov 13, 2021

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.