Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support for -Xtheirs and other options #114

Closed
janpio opened this issue Apr 29, 2022 · 2 comments · Fixed by #151
Closed

Support for -Xtheirs and other options #114

janpio opened this issue Apr 29, 2022 · 2 comments · Fixed by #151

Comments

@janpio
Copy link

janpio commented Apr 29, 2022

We have a use case where we know exactly that we want to accept "their" code on a conflict during a rebase. It would be great if we could configure the extension in a way that it accepts a string of git rebase options like -Xtheirs.

@janpio
Copy link
Author

janpio commented Apr 29, 2022

From a quick look at the codebase, it seems we would need to add the options to the command here:

const result = await this.git.exec(['rebase', `${remoteName}/${ref}`])
(which means adding a param to the function). That code is called via
async rebase(pull: Pull): Promise<boolean> {
, which would then also need a second argument to be used at
const result = await rebaseHelper.rebase(pull)
. It might make sense to call the additional input gitRebaseOptionsString and add it here then

rebase/src/main.ts

Lines 15 to 23 in 7cd171d

const inputs = {
token: core.getInput('token'),
repository: core.getInput('repository'),
head: core.getInput('head'),
base: core.getInput('base'),
includeLabels: utils.getInputAsArray('include-labels'),
excludeLabels: utils.getInputAsArray('exclude-labels'),
excludeDrafts: core.getInput('exclude-drafts') === 'true'
}
- and then just use that string for the function parameters mentioned before.

Does that sound about right?

@peter-evans
Copy link
Owner

Hi @janpio

Sounds like it could be useful in some specific cases.

Does that sound about right?

Yes, pretty much.

Note that each option must be separate param when passing to git.exec([...]), so you need to split the input by whitespace.

It might make sense to call the additional input gitRebaseOptionsString

I would suggest something a bit simpler like rebase-options for the action's input.

Feel free to have a go at adding this functionality if that's something you are interested in doing.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants