gitingest 0.6.2 → 0.6.3

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: c7a2497f7fc876e9ea8294b4625442c16b1ad0316136a2db7c6a3a8701304eb5
4
- data.tar.gz: b1065ca858fb550c5ea24afdf5c7287f667fae05c41f5de97fceb9409998edd1
3
+ metadata.gz: 7f6ba5c5ad2194b133eba160ccfe3e5a09313174eabe75aa001b8e6504822961
4
+ data.tar.gz: 72e8160b0cfc168e8503578a611c3592b0f8b7cadd25f1c14d86401e41f768aa
5
5
  SHA512:
6
- metadata.gz: cc193ab674be65cb24a35888e0dd95dedec91b27f76c5cde23a57b93d4fde0e7d0eddb31e50eda9603059f7996db72c5f669df04d6551e57569b437a118b74e4
7
- data.tar.gz: 6ca8be13b8b25056185ae66cb4cfcde7d947356531b4905e43e40296a299c62dd26ca3044f8577483f4bb889aaacf9e89996b4b70b55b4d894ff6506fa8df17f
6
+ metadata.gz: c332a1d0c70e8bc5cdf9583830b27568b0bad48bde4579fce40634d139f47d77b1dd68d39313142ecb474d8dcfb36cbb2f1f42d8e51e58a64c7fa994822fe6ea
7
+ data.tar.gz: 89407c94365c307071e39dd7e598d7e1cc2ea1afc6206fea92bacdc66ae1e85ac8feba6e95d89238cd6444eb9b45251d71dcf2e2ef365fa73472489e376aceb9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.3] - 2025-04-14
4
+
5
+ ### Fixed
6
+ - Fixed directory exclusion pattern to properly handle paths ending with slash
7
+
3
8
  ## [0.6.2] - 2025-04-11
4
9
 
5
10
  ### Changed
data/index.html CHANGED
@@ -716,7 +716,7 @@
716
716
  <div class="header-container">
717
717
  <div class="logo">
718
718
  <div class="logo-icon">G</div>
719
- <div class="logo-text">Gitingest <span class="version-tag">v0.6.2</span></div>
719
+ <div class="logo-text">Gitingest <span class="version-tag">v0.6.3</span></div>
720
720
  </div>
721
721
  <nav>
722
722
  <ul>
@@ -765,7 +765,7 @@
765
765
  <span class="terminal-command">gem install gitingest</span>
766
766
  </div>
767
767
  <div class="terminal-output">
768
- Successfully installed gitingest-0.6.2<br />
768
+ Successfully installed gitingest-0.6.3<br />
769
769
  1 gem installed
770
770
  </div>
771
771
  <div class="terminal-line">
@@ -902,6 +902,24 @@ gitingest --repository user/repo --show-structure</code></pre>
902
902
  <div class="container">
903
903
  <h2>Changelog</h2>
904
904
  <div class="timeline">
905
+ <div class="timeline-item">
906
+ <div class="timeline-date">
907
+ <span class="timeline-month">Apr</span>
908
+ <span class="timeline-day">15</span>
909
+ </div>
910
+ <div class="timeline-content">
911
+ <h3 class="timeline-version">v0.6.3</h3>
912
+ <p class="timeline-desc">Fixed directory exclusion pattern to properly handle paths ending with
913
+ slash.</p>
914
+ <div class="timeline-list">
915
+ <ul>
916
+ <li>Enhanced file exclusion logic to correctly filter directories when patterns end with
917
+ '/'</li>
918
+ <li>Improved spec test coverage for directory exclusion patterns</li>
919
+ </ul>
920
+ </div>
921
+ </div>
922
+ </div>
905
923
  <div class="timeline-item">
906
924
  <div class="timeline-date">
907
925
  <span class="timeline-month">Apr</span>
@@ -996,21 +1014,21 @@ gitingest --repository user/repo --show-structure</code></pre>
996
1014
  <span class="timeline-month">Mar</span>
997
1015
  <span class="timeline-day">03</span>
998
1016
  </div>
999
- <div class="timeline-content">
1000
- <h3 class="timeline-version">v0.3.1</h3>
1001
- <p class="timeline-desc">Optimized threading with configurable options and introduced
1002
- exponential backoff for API requests.</p>
1003
- <div class="timeline-list">
1004
- <ul>
1005
- <li>Configurable threading options</li>
1006
- <li>Added thread-local buffers</li>
1007
- <li>Improved file exclusion performance</li>
1008
- </ul>
1009
- </div>
1017
+ <div class="timeline-content"></div>
1018
+ <h3 class="timeline-version">v0.3.1</h3>
1019
+ <p class="timeline-desc">Optimized threading with configurable options and introduced
1020
+ exponential backoff for API requests.</p>
1021
+ <div class="timeline-list">
1022
+ <ul>
1023
+ <li>Configurable threading options</li>
1024
+ <li>Added thread-local buffers</li>
1025
+ <li>Improved file exclusion performance</li>
1026
+ </ul>
1010
1027
  </div>
1011
1028
  </div>
1012
1029
  </div>
1013
1030
  </div>
1031
+ </div>
1014
1032
  </section>
1015
1033
 
1016
1034
  <footer class="footer">
@@ -181,21 +181,49 @@ module Gitingest
181
181
  end
182
182
  end
183
183
 
184
- def glob_to_regex(pattern)
185
- result = "^"
186
- in_brackets = false
187
- pattern.each_char do |c|
188
- case c
189
- when "[" then in_brackets = true
190
- result += c
191
- when "]" then in_brackets = false
192
- result += c
193
- when "*" then result += in_brackets ? "*" : ".*"
194
- when ".", "\\", "+", "?", "|", "{", "}", "(", ")", "^", "$" then result += in_brackets ? c : "\\#{c}"
195
- else result += c
184
+ # Builds a single regex from the combined default and custom exclusion patterns.
185
+ # Handles glob patterns and directory patterns (ending with /).
186
+ #
187
+ # @return [Regexp] The combined exclusion regex.
188
+ def build_exclusion_regex
189
+ combined_patterns = DEFAULT_EXCLUDES + @options.fetch(:exclude, [])
190
+ regex_parts = combined_patterns.map do |pattern|
191
+ if pattern.end_with?("/")
192
+ # Directory pattern: Match anything starting with this path
193
+ "^#{Regexp.escape(pattern)}"
194
+ else
195
+ # File or glob pattern: Convert glob to regex
196
+ glob_to_regex(pattern)
196
197
  end
197
198
  end
198
- "#{result}$"
199
+ # Combine all parts, ensuring they match the full path or directory prefix
200
+ Regexp.new(regex_parts.join("|"))
201
+ end
202
+
203
+ # Converts a glob pattern to a Regexp string.
204
+ # Handles *, **, ?, and character classes.
205
+ # Ensures the pattern matches the entire string by default.
206
+ #
207
+ # @param glob [String] The glob pattern.
208
+ # @return [String] The regex pattern string.
209
+ def glob_to_regex(glob)
210
+ # More robust glob conversion
211
+ regex = glob.gsub(%r{/\*\*($|/)}, '/.*\\1') # Handle **/ and ** at end
212
+ .gsub("*", "[^/]*") # Match * within path segments
213
+ .gsub("?", "[^/]") # Match ? within path segments
214
+ .gsub(".", '\\.') # Escape dots
215
+ .gsub("{", "(") # Convert { to ( for grouping
216
+ .gsub("}", ")") # Convert } to ) for grouping
217
+ .gsub(",", "|") # Convert , to | for OR within groups
218
+
219
+ # Ensure the pattern matches the full path unless it was originally a directory pattern
220
+ # (which is handled separately now) or contains wildcards suggesting partial match.
221
+ # If it contains no wildcards, anchor it.
222
+ if glob.include?("*") || glob.include?("?") || glob.include?("{")
223
+ regex # Allow partial matching for wildcards
224
+ else
225
+ "^#{regex}$" # Anchor exact matches
226
+ end
199
227
  end
200
228
 
201
229
  def fetch_repository_contents
@@ -239,6 +267,16 @@ module Gitingest
239
267
 
240
268
  def excluded_file?(path)
241
269
  return true if path.match?(DOT_FILE_PATTERN)
270
+
271
+ # Check for directory exclusion patterns (ending with '/')
272
+ @options[:exclude].each do |pattern|
273
+ if pattern.end_with?("/") && path.start_with?(pattern)
274
+ @logger.debug "Excluding #{path} (matched directory pattern #{pattern})" if @logger.debug?
275
+ return true
276
+ end
277
+ end
278
+
279
+ # Continue with regular pattern checks
242
280
  return true if @default_patterns.any? { |pattern| path.match?(pattern) }
243
281
  return true if @custom_patterns.any? { |pattern| path.match?(pattern) }
244
282
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gitingest
4
- VERSION = "0.6.2"
4
+ VERSION = "0.6.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitingest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davide Santangelo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-11 00:00:00.000000000 Z
11
+ date: 2025-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby