Skip to content
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

Rely on git changes instead of branches in making PRs #134

Closed
jdpribula opened this issue Jun 8, 2021 · 5 comments
Closed

Rely on git changes instead of branches in making PRs #134

jdpribula opened this issue Jun 8, 2021 · 5 comments

Comments

@jdpribula
Copy link

Right now multi-gitter relies on the branch to exist to determine if it should make a PR. I would nice to not have to keep branches around for this.

Instead would be more nice if it used git's built in understanding of modified, added, deleted etc. to create a PR.

@lindell
Copy link
Owner

lindell commented Jun 8, 2021

I would nice to not have to keep branches around for this.

The idea is definitely not that should have to keep any branches around. The default behaviour of multi-gitter close/merge is even to remove the branch.

Instead would be more nice if it used git's built in understanding of modified, added, deleted etc. to create a PR.

I'm not sure what you mean here, could you elaborate of how this would work?

@jdpribula
Copy link
Author

jdpribula commented Jun 8, 2021

I think I know what the issue is now.

On Gitlab the Delete Source Branch checkbox is unchecked when MRs are created by mutli-gitter. To me it looked like when I ran multi-gitter again that it was attempting to make a change again after a merge. If I remove the source branch it shows no data was changed.

INFO[0000] Running on 4 repositories
INFO[0000] Cloning and running script                    repo=repo1
INFO[0001] no data was changed                           repo=repo1 # branch was deleted
INFO[0001] Cloning and running script                    repo=repo2
INFO[0002] no data was changed                           repo=repo2 # branch was deleted
INFO[0002] Cloning and running script                    repo=repo3
INFO[0003] the new branch does already exist             repo=repo3 #  branch was NOT deleted
INFO[0003] Cloning and running script                    repo=repo4
INFO[0004] the new branch does already exist             repo=repo4 #  branch was NOT deleted

For my use case I would want the MR created with the remove_source_branch from the API set to true https://docs.gitlab.com/ee/api/merge_requests.html#create-mr

@lindell
Copy link
Owner

lindell commented Jun 9, 2021

Hi again.

Yes, multi-gitter mostly relies on if changes are made to determine if it should create a PR/MR or not. But some scripts are intended to be run multiple times, and it would be impossible for MG to automatically know which. It could for example be a script that updates a dependency or sync some data from an external source. But that has to be up to the script-maker to accommodate for.

When it comes to remove_source_branch I think that is a reasonable default, since it is already set when merging a MR through MG. I did not know that you could set it when also creating them.
https://github.com/lindell/multi-gitter/blob/master/internal/scm/gitlab/gitlab.go#L371-L373

@lindell
Copy link
Owner

lindell commented Jun 9, 2021

#135 Fixed this.

@lindell lindell closed this as completed Jun 9, 2021
@lindell
Copy link
Owner

lindell commented Jun 9, 2021

Released in v0.26.1.

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

No branches or pull requests

2 participants