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

Handling fixup commits #48

Open
vorner opened this issue Jun 14, 2019 · 1 comment
Open

Handling fixup commits #48

vorner opened this issue Jun 14, 2019 · 1 comment

Comments

@vorner
Copy link

vorner commented Jun 14, 2019

Hello

I find the git fixup commits quite useful.

For those who are not used to them, this is how it works:

  • I create a pull request.
  • There are some nitpicks in the review.
  • The nitpicks don't deserve a full commit to fix. But I also don't want to rebase the branch during the review, as that makes reviewing a bit harder. I want to just push a little commit with the fixes. This can be created by git commit -a --fixup=THE-COMMIT-TO-BE-FIXED.
  • After the whole review is concluded, I do git rebase --interactive --autosquash THE-BRANCH_COMMIT. This'll squash the fixup commits into the commits they fix up. Note that this doesn't necessarily squash the whole branch into one commit.

However, such flow seems to be advanced and @bors/homu doesn't know about it. Which leads to two disadvantages:

I was thinking if there's a way to improve the support for this (and make the flow more known, because I believe it has advantages). I wonder about three different options:

  • The bot could refuse to proceed if a fixup message is present in the branch with an explanation message, handling the second point.
  • The bot could refuse to proceed, but remember the approval. If the rebased branch is pushed and has empty diff against the not squashed, it could remember the approval and proceed then (but I don't know, this may be hard to implement).
  • The bot could actually perform the rebase. But I'm not sure this is desirable (because then it loses eg. gpg signatures on the commit) and there could be conflicts to resolve during the rebase.

What do you think?

@kellda
Copy link
Contributor

kellda commented Nov 27, 2020

It seems that homu supports this, but that it is not enabled in cfg.production.toml.

Relevent code for the implementation is

homu/homu/main.py

Lines 986 to 1006 in 6ff2d7f

if repo_cfg.get('autosquash', False):
try:
merge_base_sha = subprocess.check_output(
git_cmd(
'merge-base',
base_sha,
state.head_sha)).decode('ascii').strip()
utils.logged_call(git_cmd(
'-c',
'user.name=' + git_cfg['name'],
'-c',
'user.email=' + git_cfg['email'],
'rebase',
'-i',
'--autosquash',
'--onto',
merge_base_sha, base_sha))
except subprocess.CalledProcessError:
desc = 'Auto-squashing failed'
comment = ''
ok = False

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