From 102b5559c7723d39263e0480bb0518ca3000ed3c Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Wed, 5 Jun 2024 09:33:17 +0900 Subject: [PATCH] Add sort for reproducible builds --- lib/bitclust/database.rb | 1 + lib/bitclust/refsdatabase.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/bitclust/database.rb b/lib/bitclust/database.rb index 0590676b..c3040be1 100644 --- a/lib/bitclust/database.rb +++ b/lib/bitclust/database.rb @@ -126,6 +126,7 @@ def entries(rel) Dir.entries(realpath(rel))\ .reject {|ent| /\A[\.=]/ =~ ent }\ .map {|ent| decodeid(ent) } + .sort rescue Errno::ENOENT return [] end diff --git a/lib/bitclust/refsdatabase.rb b/lib/bitclust/refsdatabase.rb index a0f46cea..f59b5553 100644 --- a/lib/bitclust/refsdatabase.rb +++ b/lib/bitclust/refsdatabase.rb @@ -51,7 +51,7 @@ def save(s) io = s end - @h.each{|k, v| + @h.sort.each{|k, v| io.write( [k, v].flatten.map{|e| e.gsub(/,/, '\\,') }.join(',') + "\n" ) } io.close