-
Notifications
You must be signed in to change notification settings - Fork 1
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
Adds a setting that allows opp to keep your master branch clean. #146
Conversation
@gabrielreid it was good to meet you in Paris ! It made me think about you and I tried to implement this over the weekend, which is the feature I think you wanted from What's pretty cool (IMO) is that it works even with WDYT ? Can you test it and tell me if it works ? Need to set a hidden config parameter in |
Oh wow, awesome! I'll give it a try and let you know 👍 |
Thanks I'll do the same. I think it's working in many of the usual cases, but seeing how many |
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've mostly just been testing this, and it seems to definitely work for my general flow that I always use, so this definitely seems good to me 👍
This did make me try opp pr -i
, which I otherwise never use, and I discovered that it seems to fail for me (regardless of this PR) with the following
Choose what commits you want to include in this PR
panic: tried to abort the rebase but failed: exit status 128
goroutine 1 [running]:
github.com/cupcicm/opp/core.(*Repo).TryRebaseOntoSilently(0x1?, {0x10108b590, 0x1400018ee10}, {0x64, 0xba, 0xea, 0xf2, 0x64, 0x9c, 0xbb, ...}, ...)
/Users/greid/development/opp/core/repo.go:242 +0x270
github.com/cupcicm/opp/cmd.(*create).RebasePrCommits(0x1400022b8d0, {0x10108b590, 0x1400018ee10}, 0x140003c6060)
/Users/greid/development/opp/cmd/pr.go:216 +0x130
github.com/cupcicm/opp/cmd.PrCommand.func1(0x14000036280)
/Users/greid/development/opp/cmd/pr.go:88 +0xbc
github.com/urfave/cli/v2.(*Command).Run(0x14000294420, 0x14000036280, {0x14000080340, 0x2, 0x2})
/Users/greid/go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/command.go:274 +0x730
github.com/urfave/cli/v2.(*Command).Run(0x14000092160, 0x140000361c0, {0x1400019e120, 0x3, 0x3})
/Users/greid/go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/command.go:267 +0x940
github.com/urfave/cli/v2.(*App).RunContext(0x14000296000, {0x10108b590?, 0x1400018ee10}, {0x1400019e120, 0x3, 0x3})
/Users/greid/go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/app.go:332 +0x518
main.main()
/Users/greid/development/opp/opp.go:54 +0x2f8
Anyhow, that error happens even when running on main though, so no reason to not merge this PR because of it.
cmd/pr.go
Outdated
return err | ||
} | ||
if !repo.TryRebaseCurrentBranchSilently(cCtx.Context, localPr) { | ||
fmt.Printf("problem while rebasing %s on %s\n", args.InitialBranch.LocalName(), localPr.LocalName()) |
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'll admit I don't fully get the logic here, but this looks to me like there should be a return err
or something similar here (or if it's intentional that we keep going on this point, that a comment explaining why would help).
That's mostly my lack of understanding of fancy git rebasing tricks speaking here though 😬
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.
Yeah you're right, when the rebase fail we shouldn't continue as if nothing happened.
|
When opp.keep_master_clean is set, if you create a PR, the commits you have selected in the PR will be removed from the master branch. This keeps the master branch clean.
About my I can reproduce it by checking out a clean version of $ echo something >> test.txt
$ git add test.txt && git commit -m 'test 1'
$ opp pr -i That reliably gives me this output:
I don't know of anything "special" on my machine, and the output of |
OK @gabrielreid Sorry I didn't have time to look into it before today. So this is due to the fact this branch of the code doesn't check that you have a local diff. If you do, when it's trying to do the rebase magic your local diff gets in the way and 💥 . |
When opp.keep_master_clean is set, if you create a PR, the commits
you have selected in the PR will be removed from the master branch.
This keeps the master branch clean.