Class: Git::Stash Deprecated
- Inherits:
-
Object
- Object
- Git::Stash
- Defined in:
- lib/git/stash.rb
Overview
Use Repository#stash_push and StashInfo instead
Represents a single stash entry in a Git repository
This class is deprecated and will be removed in v6.0.0. Use the
Repository stash methods and StashInfo instead:
Repository#stash_push replaces Git::Stash.new(repo, message) and
returns a StashInfo, or nil when there was nothing to stash.
Instance Attribute Summary collapse
-
#message ⇒ String
readonly
Returns the stash description.
Instance Method Summary collapse
-
#initialize(base, message, existing: false)
constructor
deprecated
Deprecated.
Use Repository#stash_push and StashInfo instead
-
#save ⇒ Boolean
Saves the current working-directory state to the stash stack.
-
#saved? ⇒ Boolean?
Returns whether the stash was saved successfully.
-
#to_s ⇒ String
Returns the stash description as a string.
Constructor Details
#initialize(base, message, existing: false)
Use Repository#stash_push and Git::StashInfo instead
Initialize a Stash object
When existing is false (the default), immediately calls #save to push
the current working-directory state onto the stash stack.
Emits one deprecation warning per object.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/git/stash.rb', line 54 def initialize(base, , existing: false) Git::Deprecation.warn( 'Git::Stash is deprecated and will be removed in v6.0.0. ' \ 'Use the Git::Repository stash methods (stash_push, stash_infos, stash_apply) ' \ 'and Git::StashInfo instead.' ) @base = base @message = save unless existing end |
Instance Attribute Details
#message ⇒ String (readonly)
Returns the stash description
102 103 104 |
# File 'lib/git/stash.rb', line 102 def @message end |
Instance Method Details
#save ⇒ Boolean
Saves the current working-directory state to the stash stack
76 77 78 79 |
# File 'lib/git/stash.rb', line 76 def save # stash_save is deprecated too; silence it so one Git::Stash call emits one warning @saved = Git::Deprecation.silence { stash_repository.stash_save(@message) } end |
#saved? ⇒ Boolean?
Returns whether the stash was saved successfully
90 91 92 |
# File 'lib/git/stash.rb', line 90 def saved? @saved end |
#to_s ⇒ String
Returns the stash description as a string
112 113 114 |
# File 'lib/git/stash.rb', line 112 def to_s end |