git 5.0.0.beta.2 → 5.0.0.beta.4
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 +4 -4
- data/.dockerignore +27 -0
- data/.github/copilot-instructions.md +3 -8
- data/.github/hooks/bin-setup-on-worktree.json +11 -0
- data/.github/hooks/run-bin-setup-once.sh +14 -0
- data/.github/skills/breaking-change-analysis/SKILL.md +6 -9
- data/.github/skills/ci-cd-troubleshooting/SKILL.md +2 -2
- data/.github/skills/command-implementation/REFERENCE.md +34 -33
- data/.github/skills/command-implementation/SKILL.md +5 -4
- data/.github/skills/command-test-conventions/SKILL.md +13 -9
- data/.github/skills/command-yard-documentation/SKILL.md +14 -6
- data/.github/skills/development-workflow/SKILL.md +20 -14
- data/.github/skills/facade-implementation/REFERENCE.md +19 -22
- data/.github/skills/facade-implementation/SKILL.md +0 -5
- data/.github/skills/facade-test-conventions/SKILL.md +4 -7
- data/.github/skills/facade-yard-documentation/SKILL.md +8 -2
- data/.github/skills/make-skill-template/SKILL.md +53 -3
- data/.github/skills/pr-readiness-review/SKILL.md +22 -2
- data/.github/skills/project-context/SKILL.md +16 -23
- data/.github/skills/pull-request-review/SKILL.md +2 -2
- data/.github/skills/rebase/SKILL.md +148 -0
- data/.github/skills/refactor-command-to-commandlineresult/SKILL.md +1 -1
- data/.github/skills/resolve-feedback/SKILL.md +288 -0
- data/.github/skills/review-arguments-dsl/CHECKLIST.md +3 -3
- data/.github/skills/reviewing-skills/SKILL.md +28 -3
- data/.github/skills/test-debugging/SKILL.md +20 -19
- data/.github/skills/yard-documentation/SKILL.md +671 -483
- data/.github/skills/yard-documentation/element-rules.md +162 -0
- data/.github/skills-deprecated/README.md +21 -0
- data/.github/{skills → skills-deprecated}/extract-command-from-lib/SKILL.md +9 -9
- data/.github/{skills → skills-deprecated}/extract-facade-from-base-lib/SKILL.md +12 -12
- data/.github/workflows/continuous_integration.yml +3 -2
- data/.rubocop.yml +7 -39
- data/.yard-lint.yml +75 -0
- data/CONTRIBUTING.md +186 -174
- data/Gemfile +17 -0
- data/README.md +86 -23
- data/Rakefile +3 -21
- data/UPGRADING.md +219 -70
- data/docker/test/Dockerfile +32 -0
- data/docker/test/docker-compose.yml +0 -0
- data/git.gemspec +3 -4
- data/lib/git/author.rb +20 -1
- data/lib/git/branch.rb +26 -6
- data/lib/git/branch_delete_failure.rb +3 -0
- data/lib/git/branch_delete_result.rb +6 -3
- data/lib/git/branch_info.rb +6 -6
- data/lib/git/command_line/base.rb +6 -13
- data/lib/git/command_line/capturing.rb +67 -10
- data/lib/git/command_line/result.rb +0 -8
- data/lib/git/command_line/streaming.rb +45 -5
- data/lib/git/command_line.rb +4 -3
- data/lib/git/commands/add.rb +61 -53
- data/lib/git/commands/am/abort.rb +2 -2
- data/lib/git/commands/am/apply.rb +109 -98
- data/lib/git/commands/am/continue.rb +2 -2
- data/lib/git/commands/am/quit.rb +2 -2
- data/lib/git/commands/am/retry.rb +4 -2
- data/lib/git/commands/am/show_current_patch.rb +1 -1
- data/lib/git/commands/am/skip.rb +2 -2
- data/lib/git/commands/am.rb +2 -2
- data/lib/git/commands/apply.rb +7 -2
- data/lib/git/commands/archive/list_formats.rb +3 -3
- data/lib/git/commands/archive.rb +7 -2
- data/lib/git/commands/arguments.rb +1370 -359
- data/lib/git/commands/base.rb +111 -13
- data/lib/git/commands/branch/copy.rb +29 -21
- data/lib/git/commands/branch/create.rb +72 -68
- data/lib/git/commands/branch/delete.rb +25 -17
- data/lib/git/commands/branch/list.rb +76 -60
- data/lib/git/commands/branch/move.rb +29 -21
- data/lib/git/commands/branch/set_upstream.rb +8 -8
- data/lib/git/commands/branch/show_current.rb +3 -3
- data/lib/git/commands/branch/unset_upstream.rb +4 -8
- data/lib/git/commands/branch.rb +2 -2
- data/lib/git/commands/cat_file/batch.rb +36 -20
- data/lib/git/commands/cat_file/filtered.rb +12 -12
- data/lib/git/commands/cat_file/raw.rb +13 -13
- data/lib/git/commands/cat_file.rb +4 -4
- data/lib/git/commands/checkout/branch.rb +7 -5
- data/lib/git/commands/checkout/files.rb +5 -4
- data/lib/git/commands/checkout.rb +4 -4
- data/lib/git/commands/checkout_index.rb +5 -4
- data/lib/git/commands/clean.rb +6 -4
- data/lib/git/commands/clone.rb +5 -4
- data/lib/git/commands/commit.rb +5 -4
- data/lib/git/commands/commit_tree.rb +5 -4
- data/lib/git/commands/config_option_syntax/add.rb +7 -4
- data/lib/git/commands/config_option_syntax/get.rb +9 -5
- data/lib/git/commands/config_option_syntax/get_all.rb +7 -4
- data/lib/git/commands/config_option_syntax/get_color.rb +8 -4
- data/lib/git/commands/config_option_syntax/get_color_bool.rb +7 -4
- data/lib/git/commands/config_option_syntax/get_regexp.rb +8 -4
- data/lib/git/commands/config_option_syntax/get_urlmatch.rb +8 -4
- data/lib/git/commands/config_option_syntax/list.rb +8 -4
- data/lib/git/commands/config_option_syntax/remove_section.rb +7 -2
- data/lib/git/commands/config_option_syntax/rename_section.rb +7 -2
- data/lib/git/commands/config_option_syntax/replace_all.rb +7 -2
- data/lib/git/commands/config_option_syntax/set.rb +7 -2
- data/lib/git/commands/config_option_syntax/unset.rb +7 -4
- data/lib/git/commands/config_option_syntax/unset_all.rb +7 -2
- data/lib/git/commands/describe.rb +5 -4
- data/lib/git/commands/diff.rb +13 -12
- data/lib/git/commands/diff_files.rb +7 -6
- data/lib/git/commands/diff_index.rb +10 -7
- data/lib/git/commands/fetch.rb +6 -4
- data/lib/git/commands/fsck.rb +6 -4
- data/lib/git/commands/gc.rb +6 -4
- data/lib/git/commands/grep.rb +6 -5
- data/lib/git/commands/init.rb +6 -4
- data/lib/git/commands/log.rb +287 -285
- data/lib/git/commands/ls_files.rb +69 -65
- data/lib/git/commands/ls_remote.rb +62 -56
- data/lib/git/commands/ls_tree.rb +50 -46
- data/lib/git/commands/maintenance/register.rb +25 -23
- data/lib/git/commands/maintenance/run.rb +7 -2
- data/lib/git/commands/maintenance/start.rb +7 -2
- data/lib/git/commands/maintenance/stop.rb +7 -2
- data/lib/git/commands/maintenance/unregister.rb +7 -2
- data/lib/git/commands/merge/abort.rb +2 -2
- data/lib/git/commands/merge/continue.rb +2 -2
- data/lib/git/commands/merge/quit.rb +2 -2
- data/lib/git/commands/merge/start.rb +7 -2
- data/lib/git/commands/merge.rb +2 -2
- data/lib/git/commands/merge_base.rb +7 -2
- data/lib/git/commands/mv.rb +7 -2
- data/lib/git/commands/name_rev.rb +7 -2
- data/lib/git/commands/pull.rb +7 -2
- data/lib/git/commands/push.rb +7 -2
- data/lib/git/commands/read_tree.rb +7 -2
- data/lib/git/commands/remote/add.rb +7 -2
- data/lib/git/commands/remote/get_url.rb +4 -2
- data/lib/git/commands/remote/list.rb +4 -2
- data/lib/git/commands/remote/prune.rb +4 -2
- data/lib/git/commands/remote/remove.rb +4 -2
- data/lib/git/commands/remote/rename.rb +4 -2
- data/lib/git/commands/remote/set_branches.rb +9 -2
- data/lib/git/commands/remote/set_head.rb +12 -5
- data/lib/git/commands/remote/set_url.rb +9 -2
- data/lib/git/commands/remote/set_url_add.rb +11 -2
- data/lib/git/commands/remote/set_url_delete.rb +9 -2
- data/lib/git/commands/remote/show.rb +18 -12
- data/lib/git/commands/remote/update.rb +19 -12
- data/lib/git/commands/remote.rb +2 -2
- data/lib/git/commands/repack.rb +67 -63
- data/lib/git/commands/reset.rb +51 -44
- data/lib/git/commands/rev_parse.rb +135 -128
- data/lib/git/commands/revert/abort.rb +2 -2
- data/lib/git/commands/revert/continue.rb +7 -2
- data/lib/git/commands/revert/quit.rb +2 -2
- data/lib/git/commands/revert/skip.rb +2 -2
- data/lib/git/commands/revert/start.rb +7 -2
- data/lib/git/commands/revert.rb +2 -2
- data/lib/git/commands/rm.rb +35 -36
- data/lib/git/commands/show.rb +1 -1
- data/lib/git/commands/show_ref/exclude_existing.rb +3 -4
- data/lib/git/commands/show_ref/exists.rb +15 -13
- data/lib/git/commands/show_ref/list.rb +39 -35
- data/lib/git/commands/show_ref/verify.rb +29 -27
- data/lib/git/commands/show_ref.rb +4 -4
- data/lib/git/commands/stash/apply.rb +31 -25
- data/lib/git/commands/stash/branch.rb +10 -8
- data/lib/git/commands/stash/clear.rb +7 -5
- data/lib/git/commands/stash/create.rb +10 -8
- data/lib/git/commands/stash/drop.rb +15 -9
- data/lib/git/commands/stash/list.rb +9 -5
- data/lib/git/commands/stash/pop.rb +21 -12
- data/lib/git/commands/stash/push.rb +20 -11
- data/lib/git/commands/stash/show.rb +21 -12
- data/lib/git/commands/stash/store.rb +19 -10
- data/lib/git/commands/stash.rb +2 -2
- data/lib/git/commands/status.rb +7 -2
- data/lib/git/commands/symbolic_ref/delete.rb +18 -14
- data/lib/git/commands/symbolic_ref/read.rb +24 -20
- data/lib/git/commands/symbolic_ref/update.rb +20 -17
- data/lib/git/commands/symbolic_ref.rb +4 -4
- data/lib/git/commands/tag/create.rb +45 -42
- data/lib/git/commands/tag/delete.rb +5 -3
- data/lib/git/commands/tag/list.rb +47 -44
- data/lib/git/commands/tag/verify.rb +12 -12
- data/lib/git/commands/tag.rb +2 -2
- data/lib/git/commands/update_ref/batch.rb +6 -1
- data/lib/git/commands/update_ref/delete.rb +19 -21
- data/lib/git/commands/update_ref/update.rb +22 -25
- data/lib/git/commands/update_ref.rb +4 -4
- data/lib/git/commands/version.rb +14 -11
- data/lib/git/commands/worktree/add.rb +50 -51
- data/lib/git/commands/worktree/list.rb +17 -17
- data/lib/git/commands/worktree/lock.rb +12 -12
- data/lib/git/commands/worktree/move.rb +16 -16
- data/lib/git/commands/worktree/prune.rb +2 -2
- data/lib/git/commands/worktree/remove.rb +2 -2
- data/lib/git/commands/worktree/repair.rb +2 -2
- data/lib/git/commands/worktree/unlock.rb +2 -2
- data/lib/git/commands/write_tree.rb +2 -2
- data/lib/git/commands.rb +4 -3
- data/lib/git/config.rb +47 -1
- data/lib/git/configuring.rb +89 -15
- data/lib/git/detached_head_info.rb +4 -1
- data/lib/git/diff.rb +2 -5
- data/lib/git/diff_file_numstat_info.rb +3 -1
- data/lib/git/diff_file_patch_info.rb +3 -1
- data/lib/git/diff_file_raw_info.rb +3 -1
- data/lib/git/diff_info.rb +8 -15
- data/lib/git/diff_path_status.rb +16 -3
- data/lib/git/diff_result.rb +3 -1
- data/lib/git/diff_stats.rb +15 -0
- data/lib/git/dirstat_info.rb +24 -8
- data/lib/git/encoding_utils.rb +32 -1
- data/lib/git/errors.rb +19 -9
- data/lib/git/escaped_path.rb +55 -3
- data/lib/git/execution_context/repository.rb +15 -0
- data/lib/git/execution_context.rb +76 -74
- data/lib/git/file_ref.rb +6 -3
- data/lib/git/fsck_object.rb +8 -0
- data/lib/git/fsck_result.rb +26 -15
- data/lib/git/log.rb +152 -5
- data/lib/git/object.rb +284 -8
- data/lib/git/parsers/branch.rb +18 -0
- data/lib/git/parsers/cat_file.rb +2 -2
- data/lib/git/parsers/diff.rb +213 -5
- data/lib/git/parsers/fsck.rb +11 -0
- data/lib/git/parsers/ls_remote.rb +1 -1
- data/lib/git/parsers/stash.rb +51 -0
- data/lib/git/parsers/tag.rb +38 -0
- data/lib/git/remote.rb +34 -2
- data/lib/git/repository/branching.rb +23 -21
- data/lib/git/repository/committing.rb +46 -6
- data/lib/git/repository/context_helpers.rb +45 -16
- data/lib/git/repository/diffing.rb +32 -23
- data/lib/git/repository/factories.rb +153 -28
- data/lib/git/repository/inspecting.rb +1 -1
- data/lib/git/repository/logging.rb +169 -30
- data/lib/git/repository/maintenance.rb +1 -1
- data/lib/git/repository/merging.rb +3 -3
- data/lib/git/repository/object_operations.rb +108 -14
- data/lib/git/repository/remote_operations.rb +150 -171
- data/lib/git/repository/shared_private.rb +7 -5
- data/lib/git/repository/staging.rb +36 -12
- data/lib/git/repository/stashing.rb +16 -16
- data/lib/git/repository/status_operations.rb +1 -1
- data/lib/git/repository/worktree_operations.rb +1 -1
- data/lib/git/repository.rb +287 -6
- data/lib/git/stash.rb +16 -21
- data/lib/git/stash_info.rb +4 -4
- data/lib/git/stashes.rb +20 -26
- data/lib/git/status.rb +25 -13
- data/lib/git/tag_delete_failure.rb +3 -0
- data/lib/git/tag_delete_result.rb +6 -3
- data/lib/git/tag_info.rb +1 -0
- data/lib/git/url.rb +12 -5
- data/lib/git/version.rb +6 -4
- data/lib/git/version_constraint.rb +4 -0
- data/lib/git.rb +400 -314
- data/redesign/3_architecture_implementation.md +81 -30
- data/redesign/Phase 4 - Step A.md +6 -0
- data/redesign/Phase 4 - Step B.md +921 -0
- data/redesign/Phase 4 - Step C.md +833 -0
- data/redesign/c1a-public-api-scope.tsv +256 -0
- data/redesign/phase-4-step-b-test-audit.tsv +485 -0
- data/tasks/yard.rake +24 -17
- metadata +24 -58
- data/commitlint.test +0 -4
- data/lib/git/args_builder.rb +0 -103
- data/lib/git/command_line_result.rb +0 -8
- data/lib/git/deprecation.rb +0 -9
- data/lib/git/repository/configuring.rb +0 -351
- data/tasks/test.rake +0 -25
- /data/.github/{skills → skills-deprecated}/extract-facade-from-base-lib/KEYWORD_ARG_REMEDIATION.md +0 -0
- /data/.github/{skills → skills-deprecated}/review-backward-compatibility/SKILL.md +0 -0
|
@@ -31,27 +31,27 @@ module Git
|
|
|
31
31
|
operand :worktree, required: true
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
#
|
|
34
|
+
# @overload call(worktree, **options)
|
|
35
35
|
#
|
|
36
|
-
#
|
|
36
|
+
# Lock a worktree to prevent it from being pruned
|
|
37
37
|
#
|
|
38
|
-
#
|
|
38
|
+
# @param worktree [String] path or unique suffix identifying the
|
|
39
|
+
# worktree to lock
|
|
39
40
|
#
|
|
40
|
-
#
|
|
41
|
-
# worktree to lock
|
|
41
|
+
# @param options [Hash] command options
|
|
42
42
|
#
|
|
43
|
-
#
|
|
43
|
+
# @option options [String] :reason (nil) human-readable explanation stored
|
|
44
|
+
# alongside the lock
|
|
44
45
|
#
|
|
45
|
-
#
|
|
46
|
-
# alongside the lock
|
|
46
|
+
# @return [Git::CommandLine::Result] the result of calling `git worktree lock`
|
|
47
47
|
#
|
|
48
|
-
#
|
|
48
|
+
# @raise [ArgumentError] if unsupported options are provided
|
|
49
49
|
#
|
|
50
|
-
#
|
|
50
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
51
51
|
#
|
|
52
|
-
#
|
|
52
|
+
# @api public
|
|
53
53
|
#
|
|
54
|
-
#
|
|
54
|
+
def call(...) = super # rubocop:disable Lint/UselessMethodDefinition
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
end
|
|
@@ -32,34 +32,34 @@ module Git
|
|
|
32
32
|
operand :new_path, required: true
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
#
|
|
35
|
+
# @overload call(worktree, new_path, **options)
|
|
36
36
|
#
|
|
37
|
-
#
|
|
37
|
+
# Move a linked worktree to a new filesystem location
|
|
38
38
|
#
|
|
39
|
-
#
|
|
39
|
+
# @param worktree [String] path or unique suffix identifying the
|
|
40
|
+
# worktree to move
|
|
40
41
|
#
|
|
41
|
-
#
|
|
42
|
-
# worktree to move
|
|
42
|
+
# @param new_path [String] destination path for the worktree
|
|
43
43
|
#
|
|
44
|
-
#
|
|
44
|
+
# @param options [Hash] command options
|
|
45
45
|
#
|
|
46
|
-
#
|
|
46
|
+
# @option options [Boolean, Integer, nil] :force (nil) allow moving a
|
|
47
|
+
# locked worktree
|
|
47
48
|
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
49
|
+
# Pass `true` or `1` to emit `--force` once. Pass `2` to emit
|
|
50
|
+
# `--force --force`, which also handles locked or missing destinations.
|
|
50
51
|
#
|
|
51
|
-
#
|
|
52
|
-
# `--force --force`, which also handles locked or missing destinations.
|
|
52
|
+
# Alias: :f
|
|
53
53
|
#
|
|
54
|
-
#
|
|
54
|
+
# @return [Git::CommandLine::Result] the result of calling `git worktree move`
|
|
55
55
|
#
|
|
56
|
-
#
|
|
56
|
+
# @raise [ArgumentError] if unsupported options are provided
|
|
57
57
|
#
|
|
58
|
-
#
|
|
58
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
59
59
|
#
|
|
60
|
-
#
|
|
60
|
+
# @api public
|
|
61
61
|
#
|
|
62
|
-
#
|
|
62
|
+
def call(...) = super # rubocop:disable Lint/UselessMethodDefinition
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
end
|
|
@@ -34,7 +34,7 @@ module Git
|
|
|
34
34
|
value_option :expire
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
# @!method call(
|
|
37
|
+
# @!method call(*)
|
|
38
38
|
#
|
|
39
39
|
# @overload call(**options)
|
|
40
40
|
#
|
|
@@ -54,7 +54,7 @@ module Git
|
|
|
54
54
|
# @option options [String] :expire (nil) only prune entries older than
|
|
55
55
|
# this time expression
|
|
56
56
|
#
|
|
57
|
-
# @return [Git::
|
|
57
|
+
# @return [Git::CommandLine::Result] the result of calling `git worktree prune`
|
|
58
58
|
#
|
|
59
59
|
# @raise [ArgumentError] if unsupported options are provided
|
|
60
60
|
#
|
|
@@ -31,7 +31,7 @@ module Git
|
|
|
31
31
|
operand :worktree, required: true
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
# @!method call(
|
|
34
|
+
# @!method call(*)
|
|
35
35
|
#
|
|
36
36
|
# @overload call(worktree, **options)
|
|
37
37
|
#
|
|
@@ -50,7 +50,7 @@ module Git
|
|
|
50
50
|
#
|
|
51
51
|
# Alias: :f
|
|
52
52
|
#
|
|
53
|
-
# @return [Git::
|
|
53
|
+
# @return [Git::CommandLine::Result] the result of calling `git worktree remove`
|
|
54
54
|
#
|
|
55
55
|
# @raise [ArgumentError] if unsupported options are provided
|
|
56
56
|
#
|
|
@@ -37,7 +37,7 @@ module Git
|
|
|
37
37
|
# git worktree repair was introduced in git 2.29.0
|
|
38
38
|
requires_git_version '2.29.0'
|
|
39
39
|
|
|
40
|
-
# @!method call(
|
|
40
|
+
# @!method call(*)
|
|
41
41
|
#
|
|
42
42
|
# @overload call(*path, **options)
|
|
43
43
|
#
|
|
@@ -61,7 +61,7 @@ module Git
|
|
|
61
61
|
# repair to update linking files if there is an absolute/relative
|
|
62
62
|
# mismatch, even if the links are already correct.
|
|
63
63
|
#
|
|
64
|
-
# @return [Git::
|
|
64
|
+
# @return [Git::CommandLine::Result] the result of calling `git worktree repair`
|
|
65
65
|
#
|
|
66
66
|
# @raise [ArgumentError] if unsupported options are provided
|
|
67
67
|
#
|
|
@@ -27,7 +27,7 @@ module Git
|
|
|
27
27
|
operand :worktree, required: true
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
# @!method call(
|
|
30
|
+
# @!method call(*)
|
|
31
31
|
#
|
|
32
32
|
# @overload call(worktree)
|
|
33
33
|
#
|
|
@@ -36,7 +36,7 @@ module Git
|
|
|
36
36
|
# @param worktree [String] path or unique suffix identifying the worktree
|
|
37
37
|
# to unlock
|
|
38
38
|
#
|
|
39
|
-
# @return [Git::
|
|
39
|
+
# @return [Git::CommandLine::Result] the result of calling `git worktree unlock`
|
|
40
40
|
#
|
|
41
41
|
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
42
42
|
#
|
|
@@ -38,7 +38,7 @@ module Git
|
|
|
38
38
|
value_option :prefix, inline: true
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
# @!method call(
|
|
41
|
+
# @!method call(*)
|
|
42
42
|
#
|
|
43
43
|
# @overload call(**options)
|
|
44
44
|
#
|
|
@@ -55,7 +55,7 @@ module Git
|
|
|
55
55
|
#
|
|
56
56
|
# The prefix path should end with `/` (e.g., `'lib/'`).
|
|
57
57
|
#
|
|
58
|
-
# @return [Git::
|
|
58
|
+
# @return [Git::CommandLine::Result] the result of calling `git write-tree`
|
|
59
59
|
#
|
|
60
60
|
# @raise [ArgumentError] if unsupported options are provided
|
|
61
61
|
#
|
data/lib/git/commands.rb
CHANGED
|
@@ -58,7 +58,7 @@ module Git
|
|
|
58
58
|
# Each git operation is represented by a class within this namespace. Command
|
|
59
59
|
# classes define the CLI contract via the {Arguments} DSL, bind caller-supplied
|
|
60
60
|
# parameters to command-line flags and operands, execute the subprocess through
|
|
61
|
-
# {Git::CommandLine}, and return a raw {Git::
|
|
61
|
+
# {Git::CommandLine}, and return a raw {Git::CommandLine::Result}.
|
|
62
62
|
#
|
|
63
63
|
# Commands do **not** parse output — that responsibility belongs to the
|
|
64
64
|
# {Git::Parsers} layer, orchestrated by the facade ({Git::Repository}).
|
|
@@ -78,10 +78,11 @@ module Git
|
|
|
78
78
|
# block. Multi-mode git commands (e.g., `git branch`, `git stash`) are split
|
|
79
79
|
# into namespace modules with one class per mode.
|
|
80
80
|
#
|
|
81
|
-
# @api private
|
|
82
|
-
#
|
|
83
81
|
# @see Git::Commands::Base
|
|
82
|
+
#
|
|
84
83
|
# @see Git::Commands::Arguments
|
|
85
84
|
#
|
|
85
|
+
# @api private
|
|
86
|
+
#
|
|
86
87
|
module Commands; end
|
|
87
88
|
end
|
data/lib/git/config.rb
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module Git
|
|
4
4
|
# The global configuration for this gem
|
|
5
|
+
#
|
|
6
|
+
# @api public
|
|
7
|
+
#
|
|
5
8
|
class Config
|
|
6
9
|
# Returns the process-wide singleton {Git::Config} instance
|
|
7
10
|
#
|
|
@@ -20,7 +23,23 @@ module Git
|
|
|
20
23
|
@instance ||= new
|
|
21
24
|
end
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
# Sets the configuration options for the git executable, SSH, and timeout
|
|
27
|
+
#
|
|
28
|
+
# @return [String] the configured value
|
|
29
|
+
#
|
|
30
|
+
attr_writer :binary_path
|
|
31
|
+
|
|
32
|
+
# Sets the SSH command to use for git operations
|
|
33
|
+
#
|
|
34
|
+
# @return [String] the configured SSH command
|
|
35
|
+
#
|
|
36
|
+
attr_writer :git_ssh
|
|
37
|
+
|
|
38
|
+
# Sets the timeout for git operations
|
|
39
|
+
#
|
|
40
|
+
# @return [Integer] the configured timeout in seconds
|
|
41
|
+
#
|
|
42
|
+
attr_writer :timeout
|
|
24
43
|
|
|
25
44
|
def initialize
|
|
26
45
|
@binary_path = nil
|
|
@@ -28,14 +47,41 @@ module Git
|
|
|
28
47
|
@timeout = nil
|
|
29
48
|
end
|
|
30
49
|
|
|
50
|
+
# Returns the git executable path
|
|
51
|
+
#
|
|
52
|
+
# Uses an explicitly configured path first, then `GIT_PATH`, then `git`.
|
|
53
|
+
#
|
|
54
|
+
# @example Read the default executable
|
|
55
|
+
# Git::Config.instance.binary_path #=> "git"
|
|
56
|
+
#
|
|
57
|
+
# @return [String] the git executable path
|
|
58
|
+
#
|
|
31
59
|
def binary_path
|
|
32
60
|
@binary_path || (ENV.fetch('GIT_PATH', nil) && File.join(ENV.fetch('GIT_PATH', nil), 'git')) || 'git'
|
|
33
61
|
end
|
|
34
62
|
|
|
63
|
+
# Returns the SSH wrapper path used by git operations
|
|
64
|
+
#
|
|
65
|
+
# Uses an explicitly configured wrapper path first, then `GIT_SSH`.
|
|
66
|
+
#
|
|
67
|
+
# @example Read the configured SSH wrapper path
|
|
68
|
+
# Git::Config.instance.git_ssh #=> "/usr/bin/ssh-wrapper"
|
|
69
|
+
#
|
|
70
|
+
# @return [String, nil] the configured SSH wrapper path
|
|
71
|
+
#
|
|
35
72
|
def git_ssh
|
|
36
73
|
@git_ssh || ENV.fetch('GIT_SSH', nil)
|
|
37
74
|
end
|
|
38
75
|
|
|
76
|
+
# Returns the timeout for git operations
|
|
77
|
+
#
|
|
78
|
+
# Uses an explicitly configured timeout first, then `GIT_TIMEOUT`.
|
|
79
|
+
#
|
|
80
|
+
# @example Read the configured timeout
|
|
81
|
+
# Git::Config.instance.timeout #=> 30
|
|
82
|
+
#
|
|
83
|
+
# @return [Integer, nil] the timeout in seconds
|
|
84
|
+
#
|
|
39
85
|
def timeout
|
|
40
86
|
@timeout || (ENV.fetch('GIT_TIMEOUT', nil) && ENV['GIT_TIMEOUT'].to_i)
|
|
41
87
|
end
|
data/lib/git/configuring.rb
CHANGED
|
@@ -39,7 +39,7 @@ module Git
|
|
|
39
39
|
# end
|
|
40
40
|
# private_class_method :assert_valid_scope!
|
|
41
41
|
#
|
|
42
|
-
# @api
|
|
42
|
+
# @api private
|
|
43
43
|
#
|
|
44
44
|
module Configuring # rubocop:disable Metrics/ModuleLength
|
|
45
45
|
# @!group Read Operations
|
|
@@ -113,7 +113,25 @@ module Git
|
|
|
113
113
|
#
|
|
114
114
|
# @param value_regex [String, nil] optional regex to filter by value
|
|
115
115
|
#
|
|
116
|
-
# @param options [Hash] scope and filter options
|
|
116
|
+
# @param options [Hash] scope and filter options
|
|
117
|
+
#
|
|
118
|
+
# @option options [Boolean, nil] :global (nil) read from `~/.gitconfig`
|
|
119
|
+
#
|
|
120
|
+
# @option options [Boolean, nil] :system (nil) read from the system config file
|
|
121
|
+
#
|
|
122
|
+
# @option options [Boolean, nil] :local (nil) read from `.git/config`
|
|
123
|
+
#
|
|
124
|
+
# @option options [Boolean, nil] :worktree (nil) read from the worktree config
|
|
125
|
+
#
|
|
126
|
+
# @option options [String, nil] :file (nil) path to a custom config file (alias: `:f`)
|
|
127
|
+
#
|
|
128
|
+
# @option options [String, nil] :blob (nil) read from a git blob object
|
|
129
|
+
#
|
|
130
|
+
# @option options [Boolean, nil] :includes (nil) follow include directives
|
|
131
|
+
#
|
|
132
|
+
# @option options [Boolean, nil] :no_includes (nil) suppress include directives
|
|
133
|
+
#
|
|
134
|
+
# @option options [String, nil] :type (nil) enforce a type constraint on the value
|
|
117
135
|
#
|
|
118
136
|
# @return [Array<Git::ConfigEntryInfo>] all entries matching the key
|
|
119
137
|
#
|
|
@@ -194,7 +212,25 @@ module Git
|
|
|
194
212
|
#
|
|
195
213
|
# @param value_regex [String, nil] optional regex to filter by value
|
|
196
214
|
#
|
|
197
|
-
# @param options [Hash] scope and filter options
|
|
215
|
+
# @param options [Hash] scope and filter options
|
|
216
|
+
#
|
|
217
|
+
# @option options [Boolean, nil] :global (nil) read from `~/.gitconfig`
|
|
218
|
+
#
|
|
219
|
+
# @option options [Boolean, nil] :system (nil) read from the system config file
|
|
220
|
+
#
|
|
221
|
+
# @option options [Boolean, nil] :local (nil) read from `.git/config`
|
|
222
|
+
#
|
|
223
|
+
# @option options [Boolean, nil] :worktree (nil) read from the worktree config
|
|
224
|
+
#
|
|
225
|
+
# @option options [String, nil] :file (nil) path to a custom config file (alias: `:f`)
|
|
226
|
+
#
|
|
227
|
+
# @option options [String, nil] :blob (nil) read from a git blob object
|
|
228
|
+
#
|
|
229
|
+
# @option options [Boolean, nil] :includes (nil) follow include directives
|
|
230
|
+
#
|
|
231
|
+
# @option options [Boolean, nil] :no_includes (nil) suppress include directives
|
|
232
|
+
#
|
|
233
|
+
# @option options [String, nil] :type (nil) enforce a type constraint on the value
|
|
198
234
|
#
|
|
199
235
|
# @return [Array<Git::ConfigEntryInfo>] all entries whose key matches the regex
|
|
200
236
|
#
|
|
@@ -219,10 +255,6 @@ module Git
|
|
|
219
255
|
#
|
|
220
256
|
# Wraps `git config --get-urlmatch --show-scope --null`.
|
|
221
257
|
#
|
|
222
|
-
# Note: `--show-origin` is not supported by git for `--get-urlmatch`, so
|
|
223
|
-
# the {Git::ConfigEntryInfo} entries returned by this method always have
|
|
224
|
-
# `origin: nil`.
|
|
225
|
-
#
|
|
226
258
|
# @example Get config entries for a specific URL
|
|
227
259
|
# entries = repo.config_get_urlmatch('http', 'https://github.com/user/repo')
|
|
228
260
|
# entries.map(&:key)
|
|
@@ -231,7 +263,25 @@ module Git
|
|
|
231
263
|
#
|
|
232
264
|
# @param url [String] the URL to match against
|
|
233
265
|
#
|
|
234
|
-
# @param options [Hash] scope and filter options
|
|
266
|
+
# @param options [Hash] scope and filter options
|
|
267
|
+
#
|
|
268
|
+
# @option options [Boolean, nil] :global (nil) read from `~/.gitconfig`
|
|
269
|
+
#
|
|
270
|
+
# @option options [Boolean, nil] :system (nil) read from the system config file
|
|
271
|
+
#
|
|
272
|
+
# @option options [Boolean, nil] :local (nil) read from `.git/config`
|
|
273
|
+
#
|
|
274
|
+
# @option options [Boolean, nil] :worktree (nil) read from the worktree config
|
|
275
|
+
#
|
|
276
|
+
# @option options [String, nil] :file (nil) path to a custom config file (alias: `:f`)
|
|
277
|
+
#
|
|
278
|
+
# @option options [String, nil] :blob (nil) read from a git blob object
|
|
279
|
+
#
|
|
280
|
+
# @option options [Boolean, nil] :includes (nil) follow include directives
|
|
281
|
+
#
|
|
282
|
+
# @option options [Boolean, nil] :no_includes (nil) suppress include directives
|
|
283
|
+
#
|
|
284
|
+
# @option options [String, nil] :type (nil) enforce a type constraint on the value
|
|
235
285
|
#
|
|
236
286
|
# @return [Array<Git::ConfigEntryInfo>] all entries matching the URL; `origin` is `nil` on each
|
|
237
287
|
#
|
|
@@ -239,6 +289,10 @@ module Git
|
|
|
239
289
|
#
|
|
240
290
|
# @raise [Git::FailedError] if git exits with an unexpected non-zero status
|
|
241
291
|
#
|
|
292
|
+
# @note `--show-origin` is not supported by git for `--get-urlmatch`, so the
|
|
293
|
+
# {Git::ConfigEntryInfo} entries returned by this method always have
|
|
294
|
+
# `origin: nil`.
|
|
295
|
+
#
|
|
242
296
|
def config_get_urlmatch(name, url, **options)
|
|
243
297
|
Private.assert_valid_opts!(CONFIG_GET_URLMATCH_ALLOWED_OPTS, **options)
|
|
244
298
|
assert_valid_scope!(**options)
|
|
@@ -260,7 +314,25 @@ module Git
|
|
|
260
314
|
# entries = repo.config_list
|
|
261
315
|
# entries.first.scope # => "local"
|
|
262
316
|
#
|
|
263
|
-
# @param options [Hash] scope and filter options
|
|
317
|
+
# @param options [Hash] scope and filter options
|
|
318
|
+
#
|
|
319
|
+
# @option options [Boolean, nil] :global (nil) read from `~/.gitconfig`
|
|
320
|
+
#
|
|
321
|
+
# @option options [Boolean, nil] :system (nil) read from the system config file
|
|
322
|
+
#
|
|
323
|
+
# @option options [Boolean, nil] :local (nil) read from `.git/config`
|
|
324
|
+
#
|
|
325
|
+
# @option options [Boolean, nil] :worktree (nil) read from the worktree config
|
|
326
|
+
#
|
|
327
|
+
# @option options [String, nil] :file (nil) path to a custom config file (alias: `:f`)
|
|
328
|
+
#
|
|
329
|
+
# @option options [String, nil] :blob (nil) read from a git blob object
|
|
330
|
+
#
|
|
331
|
+
# @option options [Boolean, nil] :includes (nil) follow include directives
|
|
332
|
+
#
|
|
333
|
+
# @option options [Boolean, nil] :no_includes (nil) suppress include directives
|
|
334
|
+
#
|
|
335
|
+
# @option options [String, nil] :type (nil) enforce a type constraint on the value
|
|
264
336
|
#
|
|
265
337
|
# @return [Array<Git::ConfigEntryInfo>] all visible config entries
|
|
266
338
|
#
|
|
@@ -422,7 +494,7 @@ module Git
|
|
|
422
494
|
|
|
423
495
|
# @overload config_replace_all(name, value, value_regex = nil, **options)
|
|
424
496
|
#
|
|
425
|
-
# Replace all values matching a key
|
|
497
|
+
# Replace all values matching a key and optional value regex
|
|
426
498
|
#
|
|
427
499
|
# Wraps `git config --replace-all`.
|
|
428
500
|
#
|
|
@@ -642,18 +714,20 @@ module Git
|
|
|
642
714
|
module Private
|
|
643
715
|
module_function
|
|
644
716
|
|
|
645
|
-
# Validate that
|
|
717
|
+
# Validate that candidate option keys are listed in `allowed`
|
|
646
718
|
#
|
|
647
719
|
# @param allowed [Array<Symbol>] the permitted option keys
|
|
648
720
|
#
|
|
649
|
-
# @param
|
|
721
|
+
# @param candidate_keywords [Hash<Symbol, Object>] the keywords to validate
|
|
722
|
+
#
|
|
723
|
+
# @option candidate_keywords [Object] key a candidate keyword value
|
|
650
724
|
#
|
|
651
725
|
# @return [void]
|
|
652
726
|
#
|
|
653
|
-
# @raise [ArgumentError] when
|
|
727
|
+
# @raise [ArgumentError] when any candidate key is not in `allowed`
|
|
654
728
|
#
|
|
655
|
-
def assert_valid_opts!(allowed, **
|
|
656
|
-
unknown =
|
|
729
|
+
def assert_valid_opts!(allowed, **candidate_keywords)
|
|
730
|
+
unknown = candidate_keywords.keys - allowed
|
|
657
731
|
return if unknown.empty?
|
|
658
732
|
|
|
659
733
|
raise ArgumentError, "Unknown options: #{unknown.join(', ')}"
|
|
@@ -28,9 +28,12 @@ module Git
|
|
|
28
28
|
# system("git log #{head.short_name}") # Works for both types
|
|
29
29
|
#
|
|
30
30
|
# @see Git::BranchInfo for the branch counterpart
|
|
31
|
+
#
|
|
31
32
|
# @see Git::Commands::Branch::ShowCurrent for the command that produces this
|
|
32
33
|
#
|
|
33
|
-
# @api
|
|
34
|
+
# @api private
|
|
35
|
+
#
|
|
36
|
+
# Work in progress; this class is internal for now and may be made public in a future release.
|
|
34
37
|
#
|
|
35
38
|
# @!attribute [r] target_oid
|
|
36
39
|
#
|
data/lib/git/diff.rb
CHANGED
|
@@ -326,11 +326,8 @@ module Git
|
|
|
326
326
|
# SHA is the null SHA
|
|
327
327
|
#
|
|
328
328
|
def blob(type = :dst)
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
elsif !NIL_BLOB_REGEXP.match(@dst)
|
|
332
|
-
@base.object(@dst)
|
|
333
|
-
end
|
|
329
|
+
sha = type == :src ? @src : @dst
|
|
330
|
+
@base.object(sha) unless NIL_BLOB_REGEXP.match(sha)
|
|
334
331
|
end
|
|
335
332
|
end
|
|
336
333
|
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
module Git
|
|
4
4
|
# Immutable value object representing stats for a single file from git numstat output
|
|
5
5
|
#
|
|
6
|
-
# @api
|
|
6
|
+
# @api private
|
|
7
|
+
#
|
|
8
|
+
# Work in progress; this class is internal for now and may be made public in a future release.
|
|
7
9
|
#
|
|
8
10
|
# @!attribute [r] path
|
|
9
11
|
# @return [String] the file path (destination path for renames)
|
|
@@ -9,7 +9,6 @@ module Git
|
|
|
9
9
|
# including source and destination file references, the patch text, change type,
|
|
10
10
|
# and line statistics.
|
|
11
11
|
#
|
|
12
|
-
# @api public
|
|
13
12
|
#
|
|
14
13
|
# @example A modified file patch
|
|
15
14
|
# patch_info = Git::DiffFilePatchInfo.new(
|
|
@@ -59,6 +58,9 @@ module Git
|
|
|
59
58
|
# @!attribute [r] deletions
|
|
60
59
|
# @return [Integer] number of lines deleted
|
|
61
60
|
#
|
|
61
|
+
# @api private
|
|
62
|
+
#
|
|
63
|
+
# Work in progress; this class is internal for now and may be made public in a future release.
|
|
62
64
|
DiffFilePatchInfo = Data.define(
|
|
63
65
|
:src,
|
|
64
66
|
:dst,
|
|
@@ -8,7 +8,6 @@ module Git
|
|
|
8
8
|
# Contains the source and destination file references, change status,
|
|
9
9
|
# similarity percentage (for renames/copies), and line change statistics.
|
|
10
10
|
#
|
|
11
|
-
# @api public
|
|
12
11
|
#
|
|
13
12
|
# @example A modified file
|
|
14
13
|
# info = Git::DiffFileRawInfo.new(
|
|
@@ -64,6 +63,9 @@ module Git
|
|
|
64
63
|
# @!attribute [r] binary
|
|
65
64
|
# @return [Boolean] whether this is a binary file
|
|
66
65
|
#
|
|
66
|
+
# @api private
|
|
67
|
+
#
|
|
68
|
+
# Work in progress; this class is internal for now and may be made public in a future release.
|
|
67
69
|
DiffFileRawInfo = Data.define(:src, :dst, :status, :similarity, :insertions, :deletions, :binary) do
|
|
68
70
|
# Get the primary file path
|
|
69
71
|
#
|
data/lib/git/diff_info.rb
CHANGED
|
@@ -8,7 +8,6 @@ module Git
|
|
|
8
8
|
#
|
|
9
9
|
# This class is used by DiffInfo for the legacy diff API.
|
|
10
10
|
#
|
|
11
|
-
# @api public
|
|
12
11
|
#
|
|
13
12
|
# @example Create a FileDiffInfo from parsed diff output
|
|
14
13
|
# diff_info = Git::FileDiffInfo.new(
|
|
@@ -42,6 +41,9 @@ module Git
|
|
|
42
41
|
# @!attribute [r] binary
|
|
43
42
|
# @return [Boolean] whether this is a binary file
|
|
44
43
|
#
|
|
44
|
+
# @api private
|
|
45
|
+
#
|
|
46
|
+
# Work in progress; this class is internal for now and may be made public in a future release.
|
|
45
47
|
FileDiffInfo = Data.define(
|
|
46
48
|
:path,
|
|
47
49
|
:patch,
|
|
@@ -70,8 +72,6 @@ module Git
|
|
|
70
72
|
# - `:total` - Hash with `:insertions`, `:deletions`, `:lines`, `:files` keys
|
|
71
73
|
# - `:files` - Hash mapping file paths to `{ insertions:, deletions: }` hashes
|
|
72
74
|
#
|
|
73
|
-
# @api public
|
|
74
|
-
#
|
|
75
75
|
# @example Create a DiffInfo from parsed stats output
|
|
76
76
|
# info = Git::DiffInfo.new(
|
|
77
77
|
# stats: {
|
|
@@ -90,6 +90,10 @@ module Git
|
|
|
90
90
|
# info.lines # => 15
|
|
91
91
|
# info.file_count # => 2
|
|
92
92
|
#
|
|
93
|
+
# @api private
|
|
94
|
+
#
|
|
95
|
+
# Work in progress; this class is internal for now and may be made public in a future release.
|
|
96
|
+
#
|
|
93
97
|
# @!attribute [r] stats
|
|
94
98
|
# @return [Hash] the statistics hash with :total and :files keys
|
|
95
99
|
#
|
|
@@ -97,18 +101,6 @@ module Git
|
|
|
97
101
|
# @return [Array<FileDiffInfo>] array of file diff info objects (empty if patch not requested)
|
|
98
102
|
#
|
|
99
103
|
DiffInfo = Data.define(:stats, :file_patches) do
|
|
100
|
-
# @!method insertions
|
|
101
|
-
# @return [Integer] total number of lines inserted
|
|
102
|
-
|
|
103
|
-
# @!method deletions
|
|
104
|
-
# @return [Integer] total number of lines deleted
|
|
105
|
-
|
|
106
|
-
# @!method lines
|
|
107
|
-
# @return [Integer] total number of lines changed (insertions + deletions)
|
|
108
|
-
|
|
109
|
-
# @!method file_count
|
|
110
|
-
# @return [Integer] number of files changed
|
|
111
|
-
|
|
112
104
|
# Total number of lines inserted
|
|
113
105
|
#
|
|
114
106
|
# @return [Integer]
|
|
@@ -160,6 +152,7 @@ module Git
|
|
|
160
152
|
# Get patch info for a specific file
|
|
161
153
|
#
|
|
162
154
|
# @param path [String] the file path
|
|
155
|
+
#
|
|
163
156
|
# @return [FileDiffInfo, nil] the diff info or nil if not found
|
|
164
157
|
#
|
|
165
158
|
def patch_for(path)
|
data/lib/git/diff_path_status.rb
CHANGED
|
@@ -13,6 +13,19 @@ module Git
|
|
|
13
13
|
include Enumerable
|
|
14
14
|
|
|
15
15
|
# @private
|
|
16
|
+
#
|
|
17
|
+
# @param base_or_hash [Git::Repository, Hash{String => String}] either a
|
|
18
|
+
# repository object for legacy initialization or a pre-fetched name-status hash
|
|
19
|
+
#
|
|
20
|
+
# @param from [String, nil] the first commit/object to compare when using
|
|
21
|
+
# legacy initialization
|
|
22
|
+
#
|
|
23
|
+
# @param to [String, nil] the second commit/object to compare when using
|
|
24
|
+
# legacy initialization
|
|
25
|
+
#
|
|
26
|
+
# @param path_limiter [String, Pathname, Array, nil] path(s) to limit the
|
|
27
|
+
# diff when using legacy initialization
|
|
28
|
+
#
|
|
16
29
|
def initialize(base_or_hash, from = nil, to = nil, path_limiter = nil)
|
|
17
30
|
if base_or_hash.is_a?(Hash)
|
|
18
31
|
# New form: pre-fetched hash passed directly from Git::Repository::Diffing
|
|
@@ -29,6 +42,9 @@ module Git
|
|
|
29
42
|
# @example Print each path and status
|
|
30
43
|
# diff_path_status.each { |path, status| puts "#{path}: #{status}" }
|
|
31
44
|
#
|
|
45
|
+
# @return [Enumerator, Hash{String => String}] an `Enumerator` when no block
|
|
46
|
+
# is given; the name-status hash when a block is given
|
|
47
|
+
#
|
|
32
48
|
# @yield [path, status] each file path with its git status code
|
|
33
49
|
#
|
|
34
50
|
# @yieldparam path [String] the file path relative to the repository root
|
|
@@ -37,9 +53,6 @@ module Git
|
|
|
37
53
|
#
|
|
38
54
|
# @yieldreturn [void]
|
|
39
55
|
#
|
|
40
|
-
# @return [Enumerator, Hash{String => String}] an `Enumerator` when no block
|
|
41
|
-
# is given; the name-status hash when a block is given
|
|
42
|
-
#
|
|
43
56
|
def each(&)
|
|
44
57
|
return to_enum(__method__) unless block_given?
|
|
45
58
|
|
data/lib/git/diff_result.rb
CHANGED
|
@@ -11,7 +11,9 @@ module Git
|
|
|
11
11
|
# - DiffFileRawInfo (from --raw)
|
|
12
12
|
# - DiffFilePatchInfo (from --patch)
|
|
13
13
|
#
|
|
14
|
-
# @api
|
|
14
|
+
# @api private
|
|
15
|
+
#
|
|
16
|
+
# Work in progress; this class is internal for now and may be made public in a future release.
|
|
15
17
|
#
|
|
16
18
|
# @!attribute [r] files_changed
|
|
17
19
|
# @return [Integer] number of files changed (from --shortstat)
|
data/lib/git/diff_stats.rb
CHANGED
|
@@ -13,7 +13,22 @@ module Git
|
|
|
13
13
|
#
|
|
14
14
|
# @api public
|
|
15
15
|
class DiffStats
|
|
16
|
+
# Initializes diff-stats state for a tree comparison.
|
|
17
|
+
#
|
|
16
18
|
# @private
|
|
19
|
+
#
|
|
20
|
+
# @param base [Git::Repository] the git object used to fetch diff stats
|
|
21
|
+
#
|
|
22
|
+
# @param from [String] the first commit or object to compare
|
|
23
|
+
#
|
|
24
|
+
# @param to [String, nil] the second commit or object to compare
|
|
25
|
+
#
|
|
26
|
+
# @param path_limiter [String, Pathname, Array<String, Pathname>, nil]
|
|
27
|
+
# path(s) to limit the diff
|
|
28
|
+
#
|
|
29
|
+
# @return [void]
|
|
30
|
+
#
|
|
31
|
+
# @raise [ArgumentError] when `from` or `to` starts with `"-"`
|
|
17
32
|
def initialize(base, from, to, path_limiter = nil)
|
|
18
33
|
# Eagerly check for invalid arguments
|
|
19
34
|
[from, to].compact.each do |arg|
|