Class: Mbeditor::GitCombinedDiffService
- Inherits:
-
Object
- Object
- Mbeditor::GitCombinedDiffService
- Includes:
- GitService
- Defined in:
- app/services/mbeditor/git_combined_diff_service.rb
Constant Summary collapse
- MAX_DIFF_BYTES =
Response-size bound for pathological diffs (e.g. a committed lockfile regeneration). Truncated at the last complete per-file diff boundary so the output remains a parseable diff document.
5 * 1024 * 1024
Constants included from GitService
Mbeditor::GitService::SAFE_GIT_REF
Instance Attribute Summary collapse
-
#base_ref ⇒ Object
readonly
What the last #call actually compared against, for the UI to display.
-
#error ⇒ Object
readonly
Set when branch scope could not establish a base branch at all, so the caller can say why instead of rendering an empty diff as "No changes".
-
#repo_path ⇒ Object
readonly
Returns the value of attribute repo_path.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(repo_path:, scope:) ⇒ GitCombinedDiffService
constructor
A new instance of GitCombinedDiffService.
Methods included from GitService
ahead_behind, base_branch?, current_branch, find_branch_base, parse_git_log, parse_git_log_with_parents, parse_name_status, parse_numstat, parse_porcelain_status, resolve_path, run_git, upstream_branch
Constructor Details
#initialize(repo_path:, scope:) ⇒ GitCombinedDiffService
Returns a new instance of GitCombinedDiffService.
14 15 16 17 |
# File 'app/services/mbeditor/git_combined_diff_service.rb', line 14 def initialize(repo_path:, scope:) @repo_path = repo_path.to_s @scope = scope end |
Instance Attribute Details
#base_ref ⇒ Object (readonly)
What the last #call actually compared against, for the UI to display. Set by #branch_diff; nil for :local scope.
27 28 29 |
# File 'app/services/mbeditor/git_combined_diff_service.rb', line 27 def base_ref @base_ref end |
#error ⇒ Object (readonly)
Set when branch scope could not establish a base branch at all, so the caller can say why instead of rendering an empty diff as "No changes".
31 32 33 |
# File 'app/services/mbeditor/git_combined_diff_service.rb', line 31 def error @error end |
#repo_path ⇒ Object (readonly)
Returns the value of attribute repo_path.
12 13 14 |
# File 'app/services/mbeditor/git_combined_diff_service.rb', line 12 def repo_path @repo_path end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
12 13 14 |
# File 'app/services/mbeditor/git_combined_diff_service.rb', line 12 def scope @scope end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 |
# File 'app/services/mbeditor/git_combined_diff_service.rb', line 19 def call return local_diff if scope == :local branch_diff end |