eac_git 0.17.0 → 0.18.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: 2ec8481bbfe574a9c00ed4324f402a56379b37820d4c6bb3f97fe8ffcdc3d6c1
4
- data.tar.gz: 76d42a04d49ab572c5b1ccd370d4b9996d1e67eba2c4f86f36ed603005d27d34
3
+ metadata.gz: ee396b6b06ed9d87b501637c01bf2a61a812c94938c57b1407819a6822d26c0e
4
+ data.tar.gz: 0bb3f62418b2640ab52223ea909afcff060071d4b0b42012a3ef251b41a20943
5
5
  SHA512:
6
- metadata.gz: 06f7fce3e78470c6c8f59ac09563ff0e9ffac80256beb5914b0172901ffedbeacad6af7b51fa6a67cd75550e5e289630985f38daf22733e8fd4a34f797868858
7
- data.tar.gz: c8797bbcd1b8c3e5e1eb72a20b8c16e928f092db763c5369860b78016b9e8d0e82dd89d75b33b1c0a397c321769ec844f1d147720ef4f5f0c3d008101219f387
6
+ metadata.gz: cda81b1f0c0af6002580adc0b9189b93eab526a2ad0bf6b1e71eca8920f4dba0fbc5b0a346dc17c960f35d6856b828a53f740ada0ff09eb3e6cd0885975b92b7
7
+ data.tar.gz: b7ef974068c4e32323e3a18a52d82bcf9d450813df5b6874c90b8d2516b88ec7ac4b581a6f091572bfdee43192bcf8b8749a0b0c2a84b789a676eae730e73fca
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
-
5
3
  module EacGit
6
4
  module Executables
7
5
  class << self
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
-
5
3
  module EacGit
6
4
  class Local
7
5
  class Branch
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacGit
4
+ class Local
5
+ class ChangedFile
6
+ QUOTED_PATH_PATTERN = /\A"(.+)"\z/.freeze
7
+ STATUS_LINE_PATTERN = /\A(.)(.)\s(.+)\z/.freeze
8
+ TO_HASH_ATTRIBUTES = %i[absolute_path index path worktree].freeze
9
+
10
+ class << self
11
+ def by_porcelain_v1_line(local_repo, line)
12
+ STATUS_LINE_PATTERN.match(line.gsub(/\n\z/, '')).then do |m|
13
+ new(local_repo, m[1], m[2], parse_status_line_path(m[3]).to_pathname)
14
+ end
15
+ end
16
+
17
+ # @param path [String]
18
+ # @return [String]
19
+ def parse_status_line_path(path)
20
+ m = QUOTED_PATH_PATTERN.match(path)
21
+ m ? m[1] : path
22
+ end
23
+ end
24
+
25
+ common_constructor :local_repo, :index, :worktree, :path
26
+
27
+ # @return [Pathname]
28
+ def absolute_path
29
+ path.expand_path(local_repo.root_path)
30
+ end
31
+
32
+ # @return [Boolean]
33
+ def add?
34
+ (index == '?' && worktree == '?') || (index == 'A' && worktree == ' ')
35
+ end
36
+
37
+ # @return [Boolean]
38
+ def delete?
39
+ [index, worktree].include?('D')
40
+ end
41
+
42
+ # @return [Boolean]
43
+ def modify?
44
+ [index, worktree].include?('M')
45
+ end
46
+
47
+ # @return [Hash]
48
+ def to_h
49
+ compact_to_h(*TO_HASH_ATTRIBUTES)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
-
5
3
  module EacGit
6
4
  class Local
7
5
  class Commit
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
- require 'eac_git/local/commit/diff_tree_line'
5
-
6
3
  module EacGit
7
4
  class Local
8
5
  class Commit
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
-
5
3
  module EacGit
6
4
  class Local
7
5
  class Commit
@@ -1,14 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
3
  require 'ostruct'
5
4
 
6
5
  module EacGit
7
6
  class Local
8
7
  module DirtyFiles
9
- QUOTED_PATH_PATTERN = /\A"(.+)"\z/.freeze
10
- STATUS_LINE_PATTERN = /\A(.)(.)\s(.+)\z/.freeze
11
-
12
8
  def dirty?
13
9
  dirty_files.any?
14
10
  end
@@ -22,26 +18,8 @@ module EacGit
22
18
 
23
19
  def dirty_files
24
20
  command('status', '--porcelain=v1', '--untracked-files', '--no-renames')
25
- .execute!.each_line.map { |line| parse_status_line(line.gsub(/\n\z/, '')) }
26
- end
27
-
28
- private
29
-
30
- # @param line [String]
31
- # @return [Struct]
32
- def parse_status_line(line)
33
- STATUS_LINE_PATTERN.if_match(line) do |m|
34
- path = parse_status_line_path(m[3]).to_pathname
35
- { index: m[1], worktree: m[2], path: path, absolute_path: path.expand_path(root_path) }
36
- .to_struct
37
- end
38
- end
39
-
40
- # @param path [String]
41
- # @return [String]
42
- def parse_status_line_path(path)
43
- m = QUOTED_PATH_PATTERN.match(path)
44
- m ? m[1] : path
21
+ .execute!.each_line
22
+ .map { |line| ::EacGit::Local::ChangedFile.by_porcelain_v1_line(self, line) }
45
23
  end
46
24
  end
47
25
  end
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/remote'
4
- require 'eac_ruby_utils'
5
-
6
3
  module EacGit
7
4
  class Local
8
5
  module Log
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
-
5
3
  module EacGit
6
4
  class Local
7
5
  class Remote
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/remote_like'
4
- require 'eac_ruby_utils'
5
-
6
3
  module EacGit
7
4
  class Local
8
5
  class Remote
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
- require 'eac_git/local/remote'
5
-
6
3
  module EacGit
7
4
  class Local
8
5
  module Remotes
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
- require 'parseconfig'
5
-
6
3
  module EacGit
7
4
  class Local
8
5
  class Subrepo
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/remote'
4
- require 'eac_ruby_utils'
5
-
6
3
  module EacGit
7
4
  class Local
8
5
  # A git-subrepo (https://github.com/ingydotnet/git-subrepo) in a [EacGit::Local].
data/lib/eac_git/local.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/executables'
4
- require 'eac_ruby_utils'
5
-
6
3
  module EacGit
7
4
  # A Git repository in local filesystem.
8
5
  class Local
@@ -77,7 +74,7 @@ module EacGit
77
74
 
78
75
  def merge_base(*commits)
79
76
  refs = commits.dup
80
- while refs.count > 1
77
+ while refs.count > 1 # rubocop:disable Style/CollectionQuerying
81
78
  refs[1] = merge_base_pair(refs[0], refs[1])
82
79
  return nil if refs[1].blank?
83
80
 
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/executables'
4
- require 'eac_git/remote_like'
5
- require 'eac_ruby_utils'
6
-
7
3
  module EacGit
8
4
  # A Git remote repository referenced by URI.
9
5
  class Remote
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
-
5
3
  module EacGit
6
4
  module RemoteLike
7
5
  class LsResult
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
-
5
3
  module EacGit
6
4
  module RemoteLike
7
5
  require_sub __FILE__
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/executables'
4
- require 'eac_git/rspec/stubbed_git_local_repo'
5
-
6
3
  module EacGit
7
4
  module Rspec
8
5
  module Setup
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/rspec/stubbed_git_local_repo/fs_object'
4
3
  require 'fileutils'
5
4
 
6
5
  module EacGit
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/rspec/stubbed_git_local_repo/fs_object'
4
3
  require 'fileutils'
5
4
 
6
5
  module EacGit
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
-
5
3
  module EacGit
6
4
  module Rspec
7
5
  module StubbedGitLocalRepo
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/local'
4
- require 'eac_git/rspec/stubbed_git_local_repo/directory'
5
- require 'eac_git/rspec/stubbed_git_local_repo/file'
6
- require 'eac_ruby_utils'
7
3
  require 'securerandom'
8
4
 
9
5
  module EacGit
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
3
  require 'tmpdir'
5
4
 
6
5
  module EacGit
data/lib/eac_git/rspec.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils'
4
-
5
3
  module EacGit
6
4
  module Rspec
7
5
  require_sub __FILE__
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacGit
4
- VERSION = '0.17.0'
4
+ VERSION = '0.18.1'
5
5
  end
data/lib/eac_git.rb CHANGED
@@ -3,5 +3,7 @@
3
3
  require 'eac_ruby_utils'
4
4
  EacRubyUtils::RootModuleSetup.perform __FILE__
5
5
 
6
+ require 'parseconfig'
7
+
6
8
  module EacGit
7
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-02 00:00:00.000000000 Z
11
+ date: 2025-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_ruby_utils
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.127'
19
+ version: '0.128'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.128.3
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: '0.127'
29
+ version: '0.128'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.128.3
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: parseconfig
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -50,20 +56,14 @@ dependencies:
50
56
  requirements:
51
57
  - - "~>"
52
58
  - !ruby/object:Gem::Version
53
- version: '0.11'
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: 0.11.1
59
+ version: '0.12'
57
60
  type: :development
58
61
  prerelease: false
59
62
  version_requirements: !ruby/object:Gem::Requirement
60
63
  requirements:
61
64
  - - "~>"
62
65
  - !ruby/object:Gem::Version
63
- version: '0.11'
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: 0.11.1
66
+ version: '0.12'
67
67
  description:
68
68
  email:
69
69
  executables: []
@@ -74,6 +74,7 @@ files:
74
74
  - lib/eac_git/executables.rb
75
75
  - lib/eac_git/local.rb
76
76
  - lib/eac_git/local/branch.rb
77
+ - lib/eac_git/local/changed_file.rb
77
78
  - lib/eac_git/local/commit.rb
78
79
  - lib/eac_git/local/commit/archive.rb
79
80
  - lib/eac_git/local/commit/changed_file.rb