Class: Git::FileDiffInfo
- Inherits:
-
Data
- Object
- Data
- Git::FileDiffInfo
- Defined in:
- lib/git/diff_info.rb
Overview
Immutable value object representing a single file's diff information
FileDiffInfo encapsulates the parsed data from a unified diff for one file, including the file path, patch text, mode changes, object identifiers, and type.
This class is used by DiffInfo for the legacy diff API.
Instance Attribute Summary collapse
-
#binary ⇒ Boolean
readonly
Whether this is a binary file.
-
#dst ⇒ String
readonly
The destination blob object identifier.
-
#mode ⇒ String
readonly
The file mode (e.g., '100644' for regular files).
-
#patch ⇒ String
readonly
The full unified diff patch text for this file.
-
#path ⇒ String
readonly
The file path relative to the repository root.
-
#src ⇒ String
readonly
The source blob object identifier.
-
#type ⇒ String
readonly
The type of change: 'modified', 'new', 'deleted', 'renamed'.
Instance Method Summary collapse
-
#binary? ⇒ Boolean
Check if this is a binary file.
Instance Attribute Details
#binary ⇒ Boolean (readonly)
Returns whether this is a binary file.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/git/diff_info.rb', line 45 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
#dst ⇒ String (readonly)
Returns the destination blob object identifier.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/git/diff_info.rb', line 45 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
#mode ⇒ String (readonly)
Returns the file mode (e.g., '100644' for regular files).
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/git/diff_info.rb', line 45 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
#patch ⇒ String (readonly)
Returns the full unified diff patch text for this file.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/git/diff_info.rb', line 45 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
#path ⇒ String (readonly)
Returns the file path relative to the repository root.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/git/diff_info.rb', line 45 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
#src ⇒ String (readonly)
Returns the source blob object identifier.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/git/diff_info.rb', line 45 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
#type ⇒ String (readonly)
Returns the type of change: 'modified', 'new', 'deleted', 'renamed'.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/git/diff_info.rb', line 45 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
Instance Method Details
#binary? ⇒ Boolean
Check if this is a binary file
58 59 60 |
# File 'lib/git/diff_info.rb', line 58 def binary? binary end |