-
Notifications
You must be signed in to change notification settings - Fork 286
Fix an issue with stash #623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -423,16 +423,17 @@ def commits? | |||||||||||||||||||||||
| # handle upstream branch changes | ||||||||||||||||||||||||
| # @!visibility private | ||||||||||||||||||||||||
| def checkout(revision = @resource.value(:revision)) | ||||||||||||||||||||||||
| has_changes = uncommitted_changes? | ||||||||||||||||||||||||
| keep_local_changes = @resource.value(:keep_local_changes) | ||||||||||||||||||||||||
| stash if keep_local_changes == :true | ||||||||||||||||||||||||
| stash if has_changes == :true && keep_local_changes == :true | ||||||||||||||||||||||||
| if !local_branch_revision?(revision) && remote_branch_revision?(revision) | ||||||||||||||||||||||||
| # non-locally existant branches (perhaps switching to a branch that has never been checked out) | ||||||||||||||||||||||||
| at_path { git_with_identity('checkout', '--force', '-b', revision, '--track', "#{@resource.value(:remote)}/#{revision}") } | ||||||||||||||||||||||||
| else | ||||||||||||||||||||||||
| # tags, locally existant branches (perhaps outdated), and shas | ||||||||||||||||||||||||
| at_path { git_with_identity('checkout', '--force', revision) } | ||||||||||||||||||||||||
| end | ||||||||||||||||||||||||
| unstash if keep_local_changes == :true | ||||||||||||||||||||||||
| unstash if has_changes == :true && keep_local_changes == :true | ||||||||||||||||||||||||
adamretter marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||
| end | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # @!visibility private | ||||||||||||||||||||||||
|
|
@@ -503,9 +504,16 @@ def set_excludes | |||||||||||||||||||||||
| end | ||||||||||||||||||||||||
| end | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # @!visibility private | ||||||||||||||||||||||||
| def uncommitted_changes? | ||||||||||||||||||||||||
| at_path do | ||||||||||||||||||||||||
| git_with_identity('status', '--porcelain').empty? | ||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change the sequence of commands run, you need to adjust CI to take this into account (see failed CI at the bottom of the "Conversation" tab). Need guidance? Read on 😃 When reading the output from RSpec, you can identify 3 sections:
3 is the most handy to locate the tests you want to adjust (direct view of files and lines), while 1 & 2 tell you what is wrong. If you consider the first failure in the "third section", you see that the error occurred in this test: puppetlabs-vcsrepo/spec/unit/puppet/provider/vcsrepo/git_spec.rb Lines 34 to 44 in 2b05c3a
If you scroll up in the second section, you see the actual error: In this case, adding a line like the following one between lines 40 and 41 should fix the issue: Thanks! |
||||||||||||||||||||||||
| end | ||||||||||||||||||||||||
| end | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # @!visibility private | ||||||||||||||||||||||||
| def stash | ||||||||||||||||||||||||
| at_path { git_with_identity('stash', 'save') } | ||||||||||||||||||||||||
| at_path { git_with_identity('stash', 'push') } | ||||||||||||||||||||||||
| end | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # @!visibility private | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.