git-pkgs 0.6.0 → 0.6.1

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: 456f37ab775f4c2262efc63bb71a3d9e9901a69dcd6b78f08a7eacbe1f3991d2
4
- data.tar.gz: a4e20b318a4244ddebbd34710ffb75ba79c8e96d17183c646b10fbc07e57e0cc
3
+ metadata.gz: da979135545dc93ed1b362560e7a5f9659097512603a522e6665bc2268b46466
4
+ data.tar.gz: 7b1a2838c823ec205761288f9126f0015597e890e7ba768c3e071ecdd14efb4b
5
5
  SHA512:
6
- metadata.gz: 6d2e71fa0e93fd21a9364f641bfab05d90c71cf76b5bd19b02cf03064d205070aa49ffe99780cda4d5004a9aabc27ea6c47692e28f2457ed6671af3b94e4661b
7
- data.tar.gz: 8f3ce053d35962a58c66d70c00f3f0ba9510ebd8116ee01e388f6d967ce7f64cc20cf7e6b86aee9d03316a28a80a21836678e4c8e5b71f2b19c2c6a17294939a
6
+ metadata.gz: 801260e17dabe686670fbcc10a5c0e760ef5f39df0273029c1f3ab9ef2502f0f7ea78d6a3cfc633fb547f6df604d2d895411c5921c345365d6ea85dd12578403
7
+ data.tar.gz: 138cdd14d12798c7d1d2ea6c7c7cd920805c008f10ce4057c8f3c9ebf6db7b7191720d88cb228e53786e50b7c077c17c9014c73be037a1582592965ef46889f3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.1] - 2026-01-05
4
+
5
+ - Fix `stats` command crash on most changed dependencies query
6
+ - Fix `search` command SQL alias error when displaying results
7
+ - Fix `blame` and `stale` commands eager loading error
8
+ - Fix `list` command returning empty output when ecosystem filter matches nothing
9
+
3
10
  ## [0.6.0] - 2026-01-05
4
11
 
5
12
  - Replace ActiveRecord with Sequel (~3x faster init, ~2x faster queries)
@@ -24,12 +24,17 @@ module Git
24
24
  error "No analysis found for branch '#{branch_name}'. Run 'git pkgs init' first." unless branch&.last_analyzed_sha
25
25
 
26
26
  current_commit = Models::Commit.first(sha: branch.last_analyzed_sha)
27
- snapshots = current_commit&.dependency_snapshots&.eager(:manifest) || []
27
+
28
+ return empty_result("No dependencies found") unless current_commit
29
+
30
+ snapshots = current_commit.dependency_snapshots_dataset.eager(:manifest)
28
31
 
29
32
  if @options[:ecosystem]
30
33
  snapshots = snapshots.where(ecosystem: @options[:ecosystem])
31
34
  end
32
35
 
36
+ snapshots = snapshots.all
37
+
33
38
  if snapshots.empty?
34
39
  empty_result "No dependencies found"
35
40
  return
@@ -24,11 +24,6 @@ module Git
24
24
 
25
25
  deps = compute_dependencies_at_commit(target_commit, repo)
26
26
 
27
- if deps.empty?
28
- empty_result "No dependencies found"
29
- return
30
- end
31
-
32
27
  # Apply filters
33
28
  if @options[:ecosystem]
34
29
  deps = deps.select { |d| d[:ecosystem] == @options[:ecosystem] }
@@ -38,6 +33,11 @@ module Git
38
33
  deps = deps.select { |d| d[:dependency_type] == @options[:type] }
39
34
  end
40
35
 
36
+ if deps.empty?
37
+ empty_result "No dependencies found"
38
+ return
39
+ end
40
+
41
41
  if @options[:format] == "json"
42
42
  require "json"
43
43
  puts JSON.pretty_generate(deps)
@@ -72,7 +72,7 @@ module Git
72
72
  .where(name: name, ecosystem: platform)
73
73
  .eager(:commit)
74
74
  .association_join(:commit)
75
- .order(Sequel[:commits][:committed_at])
75
+ .order(Sequel[:commit][:committed_at])
76
76
  .all
77
77
 
78
78
  first = changes.first
@@ -98,7 +98,7 @@ module Git
98
98
  .where(name: name, ecosystem: platform)
99
99
  .eager(:commit)
100
100
  .association_join(:commit)
101
- .order(Sequel[:commits][:committed_at])
101
+ .order(Sequel[:commit][:committed_at])
102
102
  .all
103
103
 
104
104
  first = changes.first
@@ -23,12 +23,17 @@ module Git
23
23
  error "No analysis found for branch '#{branch_name}'. Run 'git pkgs init' first." unless branch&.last_analyzed_sha
24
24
 
25
25
  current_commit = Models::Commit.first(sha: branch.last_analyzed_sha)
26
- snapshots = current_commit&.dependency_snapshots&.eager(:manifest) || []
26
+
27
+ return empty_result("No dependencies found") unless current_commit
28
+
29
+ snapshots = current_commit.dependency_snapshots_dataset.eager(:manifest)
27
30
 
28
31
  if @options[:ecosystem]
29
32
  snapshots = snapshots.where(ecosystem: @options[:ecosystem])
30
33
  end
31
34
 
35
+ snapshots = snapshots.all
36
+
32
37
  if snapshots.empty?
33
38
  empty_result "No dependencies found"
34
39
  return
@@ -79,14 +79,15 @@ module Git
79
79
  }
80
80
 
81
81
  most_changed = changes
82
+ .select(Sequel[:dependency_changes][:name], Sequel[:dependency_changes][:ecosystem])
83
+ .select_append { count.function.*.as(:change_count) }
82
84
  .group(Sequel[:dependency_changes][:name], Sequel[:dependency_changes][:ecosystem])
83
- .order(Sequel.desc(:count))
85
+ .order(Sequel.desc(:change_count))
84
86
  .limit(10)
85
- .select_append { count.function.*.as(:count) }
86
- .select_map([:name, :ecosystem, :count])
87
+ .all
87
88
 
88
- data[:most_changed] = most_changed.map do |name, eco, count|
89
- { name: name, ecosystem: eco, changes: count }
89
+ data[:most_changed] = most_changed.map do |row|
90
+ { name: row[:name], ecosystem: row[:ecosystem], changes: row[:change_count] }
90
91
  end
91
92
 
92
93
  manifests = Models::Manifest.dataset
@@ -85,14 +85,18 @@ module Git
85
85
  Git::Pkgs::Models::DependencySnapshot
86
86
  ].each do |model|
87
87
  model.dataset = @db[model.table_name]
88
- # Clear cached association datasets and loaders that may reference old db
88
+ # Clear all cached association data that may reference old db
89
89
  model.association_reflections.each_value do |reflection|
90
+ reflection.delete(:_dataset)
91
+ reflection.delete(:associated_eager_dataset)
92
+ reflection.delete(:placeholder_eager_loader)
93
+ reflection.delete(:placeholder_eager_graph_loader)
90
94
  if reflection[:cache]
91
- reflection[:cache].delete(:_dataset)
92
- reflection[:cache].delete(:associated_eager_dataset)
93
- reflection[:cache].delete(:placeholder_eager_loader)
95
+ reflection[:cache].clear
94
96
  end
95
97
  end
98
+ # Clear model instance caches
99
+ model.instance_variable_set(:@columns, nil) if model.instance_variable_defined?(:@columns)
96
100
  rescue Sequel::Error
97
101
  # Table may not exist yet
98
102
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Git
4
4
  module Pkgs
5
- VERSION = "0.6.0"
5
+ VERSION = "0.6.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-pkgs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt