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

Support for using .git/SQUASH_MSG in Git commit message box #101078

Closed
philipstarkey opened this issue Jun 26, 2020 · 10 comments · Fixed by #101114
Closed

Support for using .git/SQUASH_MSG in Git commit message box #101078

philipstarkey opened this issue Jun 26, 2020 · 10 comments · Fixed by #101114
Assignees
Labels
feature-request Request for new features or functionality git GIT issues good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders on-release-notes Issue/pull request mentioned in release notes verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@philipstarkey
Copy link

Currently the VS Code Git commit message box automatically synchronises with the contents of .git/MERGE_MSG (provided you have not entered your own commit message yet into VS Code).

I would like to request support for VS Code to do the same with .git/SQUASH_MSG (produced when running git merge <branch> --squash). This would provide better integration between VS code git related VS Code extensions which often have the ability to perform a squash merge via the extension GUI but do not typically replicate any of the existing VS Code git interface (commit message box and changed file list).

@joaomoreno joaomoreno added feature-request Request for new features or functionality git GIT issues good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities labels Jun 26, 2020
@joaomoreno joaomoreno added this to the Backlog milestone Jun 26, 2020
@daniel-j-davis
Copy link

@joaomoreno I wouldn't mind taking this on, and I've looked through the code so I have a pretty good idea of what's required to implement this. Just one question, though — is there any situation where .git/MERGE_MSG and .git/SQUASH_MSG are both present? If so: which one do we think should take precedence as the 'default' commit message?

@philipstarkey
Copy link
Author

@daniel-j-davis my suggestion would be to follow what git-gui does since it's bundled with git. Looks like it preferences MERGE_MSG over SQUASH_MSG (see here)

@daniel-j-davis
Copy link

That makes sense, and that's what I was thinking too. I'll put a PR in shortly!

@joaomoreno joaomoreno modified the milestones: Backlog, June 2020 Jun 29, 2020
joaomoreno added a commit that referenced this issue Jun 29, 2020
…-message

Adding .git/SQUASH_MSG detection to commit message auto-fill #101078
@joaomoreno joaomoreno added the verification-needed Verification of issue is requested label Jun 29, 2020
@isidorn isidorn added the verified Verification succeeded label Jun 30, 2020
@isidorn
Copy link
Contributor

isidorn commented Jun 30, 2020

I got this to partially work by:

  1. Having a SQUASH_MSG file with some content like "HELLO"
  2. Creaing a local branch git co -b isidorn/deleteme
  3. git merge master --squash
  4. The SQUASH_MSG file sometimes gets filled with content, like the following
  5. SO it seems like the content of the SQUASH_MSG file is not constant for me, and changes once I do a squash

Reopening this for discussion. I also might be doing something wrong.
Bonus bug: when chaning the content of the SQUASH_MSG the scm input does not reg resized and ends up looking broken (picture attached).
So I would recommend that we revert this PR and polish it a bit more.

Squashed commit of the following:

commit 639a21b145ba38007a2b5ee9d4233ac6a6067e89
Author: Daniel Imms <tyriar@tyriar.com>
Date:   Tue Jun 30 06:39:30 2020 -0700

    Add ending period to terminal launch notification messages
    
    Fixes #101344

commit 01d0314308fdf83801c3d7abf43b7a2702ea9263
Author: Daniel Imms <tyriar@tyriar.com>
Date:   Tue Jun 30 05:22:31 2020 -0700

    Change troubleshoot button to 'Open Help'
    
    Fixes #101345

Screenshot 2020-06-30 at 16 02 54

@isidorn isidorn reopened this Jun 30, 2020
@isidorn isidorn added verification-found Issue verification failed and removed verified Verification succeeded labels Jun 30, 2020
@daniel-j-davis
Copy link

daniel-j-davis commented Jun 30, 2020

It worked fine (and always displayed the intended (?) squash msg), but maybe it's because I was only squashing another branch that only had one commit? I concur that it seems like the contents of SQUASH_MSG aren't always consistent though, now that I've tried with a branch with more than one commit.

EDIT: It seems like it displays all of the squashed commits in one message, prefaced by

Squashed commit of the following:
<some commits>

As for the bonus bug, is that issue exclusive to SQUASH_MSG or does it also happen if you change the contents of MERGE_MSG? @isidorn

@joaomoreno
Copy link
Member

joaomoreno commented Jun 30, 2020

@isidorn You're not supposed to manually create or edit the SQUASH_MSG file. This is a file created by git during the git merge <branch> --squash command. When you run this command you will have a commit pending... and the input box should be prepopulated with a template commit message. Can you try this again?

Thanks for the input box issue though, will try to repro.

@philipstarkey
Copy link
Author

EDIT: It seems like it displays all of the squashed commits in one message, prefaced by

Squashed commit of the following:
<some commits>
...

This was the intended behaviour behind this feature request. I'm not expecting VS Code to do anything magical here with SQUASH_MSG. It should just be taking the entire contents of the file as other graphical git tools do (and as a command line call to git commit does if SQUASH_MSG exists).

I do not think the PR needs reverting.

@joaomoreno
Copy link
Member

Added another commit, since the MERGE_MSG can exist but just have no content. In that case we should take SQUASH_MSG.

@isidorn Please verify once again, now the feature is clearer.

@isidorn
Copy link
Contributor

isidorn commented Jul 1, 2020

Sorry for the confusion, just was not very clear to me.
I will verify this later today.

@isidorn
Copy link
Contributor

isidorn commented Jul 1, 2020

Adding verified label since the git commit gets nicely preopulated with the squash message.

@isidorn isidorn added verified Verification succeeded and removed verification-found Issue verification failed labels Jul 1, 2020
@joaomoreno joaomoreno added the on-release-notes Issue/pull request mentioned in release notes label Jul 6, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Aug 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality git GIT issues good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders on-release-notes Issue/pull request mentioned in release notes verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@joaomoreno @isidorn @philipstarkey @daniel-j-davis and others