swhid 0.4.0 → 0.4.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: ee71514f26b0e91e02344d741fdfb56dc4aa5d9314e30dcc3c5d85caa68f8973
4
- data.tar.gz: 4f087cd83b505e88543e991aa24d8fb88368596e4b108128de52d562e2d81025
3
+ metadata.gz: 55ef264a7547cae4c3e201c8c4b745ea42437173efd681623bf7307c0bf58b0d
4
+ data.tar.gz: d851e19c5511018c5ded8e853306650414b1708a99fd10837f2e6d62a6266f13
5
5
  SHA512:
6
- metadata.gz: a94007e0ee145b967ec7f2ac0007dcf996207990bec1af8ce3a63fc4f0ddd0e4a59afe6bf1385a4e0f9b9b033a3f0301657835751e653b1f1ed5fb457a3a6b90
7
- data.tar.gz: 0f8a27c61f50d91519564fe4f7a6483b23415c600ffc6d49df26141388faf71ab547aa06e56450a6df9d95b91d6560c3c773a65c80682e6d87d5538858fd5e68
6
+ metadata.gz: db250c4038a39aa01d3a73c83a1d11ebf907a7465649b69cbff3ed3c9b44e758519c2573ca949fabc996b43ae737a5259d41c1d143ecb1dc980813dc2d6c54cc
7
+ data.tar.gz: abaa8a4ca6c33cc718c28f573641a207c6458c8dcb4df4440759583cd1dd9394a60c507c0d29795e4149218b1bcba8b212ee83114e1bbf6a6f0ebe99135328ef
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.1] - 2026-01-13
4
+
5
+ ### Fixed
6
+ - Resolve symlinks when matching paths for Git index permission lookups
7
+
3
8
  ## [0.4.0] - 2026-01-12
4
9
 
5
10
  ### Added
@@ -57,7 +57,8 @@ module Swhid
57
57
  def self.file_executable?(full_path, stat, git_repo, permissions = nil)
58
58
  # Check explicit permissions map first (from tar extraction, etc.)
59
59
  if permissions
60
- mode = permissions[full_path] || permissions[File.expand_path(full_path)]
60
+ real_path = File.realpath(full_path) rescue File.expand_path(full_path)
61
+ mode = permissions[full_path] || permissions[real_path]
61
62
  return (mode & 0o111) != 0 if mode
62
63
  end
63
64
 
@@ -81,13 +82,16 @@ module Swhid
81
82
  repo_workdir = git_repo.workdir
82
83
  return nil unless repo_workdir
83
84
 
84
- full_path = File.expand_path(full_path)
85
- repo_workdir = File.expand_path(repo_workdir)
85
+ # Use realpath to resolve symlinks (e.g., /tmp -> /private/tmp on macOS)
86
+ full_path = File.realpath(full_path) rescue File.expand_path(full_path)
87
+ repo_workdir = File.realpath(repo_workdir) rescue File.expand_path(repo_workdir)
88
+
89
+ # Ensure repo_workdir ends with separator for proper prefix matching
90
+ repo_workdir = repo_workdir.chomp("/").chomp("\\") + "/"
86
91
 
87
92
  return nil unless full_path.start_with?(repo_workdir)
88
93
 
89
94
  relative = full_path.sub(repo_workdir, "")
90
- relative = relative[1..] if relative.start_with?("/") || relative.start_with?("\\")
91
95
  relative.tr("\\", "/")
92
96
  end
93
97
  end
data/lib/swhid/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Swhid
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swhid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt