-
Notifications
You must be signed in to change notification settings - Fork 29
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
fix(release): rebase before pushing local branch and tag #983
Draft
dhayab
wants to merge
4
commits into
main
Choose a base branch
from
fix/rebase-before-release-push
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import runStep from './runStep'; | ||
import { run } from '../util'; | ||
|
||
export default ({ remote, currentBranch, dir, dryRun }) => | ||
runStep({ title: 'Rebasing.' }, () => { | ||
run({ | ||
command: `git fetch && git rebase ${remote}/${currentBranch} ${currentBranch}`, | ||
dir, | ||
dryRun, | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe
git fetch && git rebase
can be replaced withgit pull --rebase
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works indeed, thanks! I removed the
fetchAndRebase
function and replaced it with the existingpull
function with an additional flag for--rebase
.As for the location of git operations, what I'm seeing is that most/all the methods that gather information on git repositories are indeed in
shipjs-lib
, but the methods used to actually perform git operations are in shipjs, for instance:gitPush
in shipjs/src/helperpull
in shipjs/src/stepFor testing, apart from empirical testing which was done with a dummy repository, there is no flow test I could hook into or a way to simulate changes on a remote repository, or an individual test on the
pull
function. I added basic tests that verify the command is well-formed similarly to other steps / helpers.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be done later, but we could add integration tests for the full flow. We create a fake project in which Ship.js is a dependency (like any of our repos) and perform flows with a mocked CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked a bit further and there's a workflow similar to this in packages/shipjs-lib/tests with shell scripts bootstrapping mock repositories. This could be reused for packages/shipjs probably.
I won't be able to put more time on it during this sprint, so we can do it later or keep this PR open and add it here next sprint, both are fine for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Can you just add a ticket in Jira to track it?