bitfab 0.62.6 → 0.62.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b300b5a65bacd9fd60231bcab3ba96751c111ae7e5f12075a6149c163927cf65
4
- data.tar.gz: b3b61e0146d500bebc4719ca485e42e175bd0e8f78053d3fa451bb256d494407
3
+ metadata.gz: 0e4a1e837039a5679b239d2c976e5a0ed657b2270c317a9101ded3416acc48fa
4
+ data.tar.gz: c9168929101f6b1bea5c853a80384a242d64f69dec8c99fb3b4a202ae62bd7b8
5
5
  SHA512:
6
- metadata.gz: f16224c7b475fdfea0e847780b18d7e503b100250ec66523382a3f1bfa45e8b60281d52042de6dd0ac5f5b90bfea4a5585481fdaaa94500d019ce346ec81cb1d
7
- data.tar.gz: 836b9a8bdcfd24612213eefef798713e758b337b283ee1ff89ee62b1d17e60f12e8ba883b3532cd2a47430ee3968637e96375f9912f3c35d7df8290f9a7f460d
6
+ metadata.gz: 3474b103e94a7cce451ab5955652836bf84c0300c3719ece113a14b0114ee41ff322314da45f4d9015b7040672fa84439ba3bc268712c6fab7f58af3f3cda026
7
+ data.tar.gz: 442acb8bb6b2a72154c40ae99ec3d34a55d0d212eaba2e27f60bebd000d8453b7dbc0e683c872d9bbf9689e016866c90f3afb2d312ff846020f1d886b5d85565
data/lib/bitfab/replay.rb CHANGED
@@ -562,7 +562,6 @@ module Bitfab
562
562
  # via BITFAB_CODE_CHANGE_PATH. Returns [description, files] or nil.
563
563
  # Best-effort: any error (no env var, missing file, bad JSON) yields nil so
564
564
  # the replay proceeds with no code change rather than raising.
565
- TRUNK_CANDIDATES = ["origin/HEAD", "origin/main", "origin/master", "main", "master"].freeze
566
565
  CC_MAX_FILES = 60
567
566
  CC_MAX_FILE_BYTES = 500_000
568
567
  CC_MAX_TOTAL_BYTES = 2_000_000
@@ -618,7 +617,8 @@ module Bitfab
618
617
  # Auto-capture the code change to attach when the caller passed none. Lives
619
618
  # in replay() (the one call guaranteed to run on every replay) so it works no
620
619
  # matter how the replay was launched. Precedence: a BITFAB_CODE_CHANGE_PATH
621
- # override, else the git diff vs trunk. Best-effort: any failure yields nil.
620
+ # override, else the git diff of the working tree vs HEAD (or vs the
621
+ # merge-base with BITFAB_CODE_CHANGE_BASE). Best-effort: any failure yields nil.
622
622
  # An explicit code_change_files always wins over this.
623
623
  def resolve_auto_code_change(label = nil)
624
624
  return nil if ENV["BITFAB_DISABLE_CODE_CHANGE_CAPTURE"]
@@ -657,23 +657,18 @@ module Bitfab
657
657
  !git(root, ["rev-parse", "--verify", "#{ref}^{object}"]).nil?
658
658
  end
659
659
 
660
- # Returns [base, from_trunk]; from_trunk is false on the HEAD fallback.
660
+ # Returns [base, against]. HEAD by default, so only uncommitted edits show;
661
+ # BITFAB_CODE_CHANGE_BASE moves the base to the merge-base with that ref.
661
662
  def cc_resolve_base(root)
662
663
  forced = ENV["BITFAB_CODE_CHANGE_BASE"]
663
664
  if forced && cc_ref_exists?(root, forced)
664
665
  mb = git(root, ["merge-base", "HEAD", forced])
665
- return [mb.strip, true] if mb && !mb.strip.empty?
666
+ return [mb.strip, "vs #{forced}"] if mb && !mb.strip.empty?
666
667
 
667
668
  rp = git(root, ["rev-parse", "--verify", forced])
668
- return (rp && !rp.strip.empty?) ? [rp.strip, true] : nil
669
+ return (rp && !rp.strip.empty?) ? [rp.strip, "vs #{forced}"] : nil
669
670
  end
670
- TRUNK_CANDIDATES.each do |candidate|
671
- next unless cc_ref_exists?(root, candidate)
672
-
673
- mb = git(root, ["merge-base", "HEAD", candidate])
674
- return [mb.strip, true] if mb && !mb.strip.empty?
675
- end
676
- cc_ref_exists?(root, "HEAD") ? ["HEAD", false] : nil
671
+ cc_ref_exists?(root, "HEAD") ? ["HEAD", "uncommitted (vs HEAD)"] : nil
677
672
  end
678
673
 
679
674
  def cc_blob_bytes(root, base, path)
@@ -697,7 +692,7 @@ module Bitfab
697
692
  resolved = cc_resolve_base(root)
698
693
  return nil if resolved.nil?
699
694
 
700
- base, from_trunk = resolved
695
+ base, against = resolved
701
696
 
702
697
  tracked = git(root, ["diff", "--name-status", "--find-renames", "-z", base, "--", ":!.bitfab"]) || ""
703
698
  untracked = git(root, ["ls-files", "--others", "--exclude-standard", "-z", "--", ":!.bitfab"]) || ""
@@ -737,7 +732,6 @@ module Bitfab
737
732
  subject = subject ? subject.strip : ""
738
733
  head = ((label && !label.strip.empty?) ? label.strip : nil) || (subject.empty? ? nil : subject) || "Working-tree change"
739
734
  word = (files.length == 1) ? "file" : "files"
740
- against = from_trunk ? "vs trunk" : "uncommitted (vs HEAD)"
741
735
  ["#{head} (#{files.length} #{word} changed #{against})", files]
742
736
  rescue
743
737
  nil
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bitfab
4
- VERSION = "0.62.6"
4
+ VERSION = "0.62.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitfab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.62.6
4
+ version: 0.62.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harvest Team