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

Make it easier to copy the commit SHA and subject #2270

Merged
merged 1 commit into from Sep 13, 2019

Conversation

@zetter
Copy link
Contributor

zetter commented Sep 7, 2019

Description of the Change

This adds 'Copy Commit SHA' and 'Copy Commit Subject' to the right-click
menu of the recent commits list.

This was suggested in #1453

Screenshot/Gif

Screenshot 2019-09-07 at 5 33 58pm

Alternate Designs

I started solving #1533 instead- I often create 'fixup' and 'squash' commits a lot to be used with auto-squashing. I decided that this could be too niche a use case because auto-squashing is off in git by default and could be confusing to people that haven't used auto-squashing before. I thought that making it easier to copy commit details would go some way to make creating auto-squashing commits from Atom easier and bring other benefits.

Benefits

This is intended to make it easier to:

  • Copy commit SHAs to use with command line tools
  • Reference commit SHAs or subjects when writing other commits
  • Reference the commit SHA or subject when writing a commit to be auto-squashed in a later rebase.

Currently to copy the commit SHA or subject you have to click on the commit to open it, select the text you want to copy, then copy it, then close the commit.

Note that I find it better to use the commit subjects rather than the SHAs for fixup commits since SHAs may change when performing a non-interactive rebase on a branch (and auto-squash commits only apply during interactive rebases).

Possible Drawbacks

None that I can think of - it's an isolated change and the ability is in a context menu so doesn't change the layout of the commit view.

Applicable Issues

Metrics

N/A

Tests

Tested on Atom 1.42.0-nightly6 on OSX

  • Can Copy SHA by right-clicking on commit

    • SHA copied matches what is displayed in git log
    • Can right-click anywhere on highlighted commit to copy (including author image or timestamp)
  • Can Copy Commit Subject by right-clicking on commit

    • Subject copied matches to what is displayed in git log
    • A copied subject pasted after fixup! in a commit message triggers auto-squashing when rebasing
    • Can right-click anywhere on highlighted commit to copy (including author image or timestamp)

I've added unit tests for the two copy actions in the recent commits view test file.

Documentation

Please let me know if this should be documented.

Release Notes

  • You can now copy the SHA or subject of recent commits by right-clicking on them
This adds 'Copy Commit SHA' and 'Copy Commit Subject' to the right-click
menu of the recent commits list.

I've chosen to pass in the global atom clipboard from the
`RecentCommitsController` to make it easier to test `RecentCommitsView`
with a fake clipboard.
@smashwilson smashwilson merged commit 3e6cb75 into atom:master Sep 13, 2019
6 of 16 checks passed
6 of 16 checks passed
Consider pull request for release board Consider pull request for release board
Details
Consider pull request for release board Consider pull request for release board
Details
Consider pull request for release board Consider pull request for release board
Details
Consider pull request for release board Consider pull request for release board
Details
Consider pull request for release board Consider pull request for release board
Details
Consider pull request for release board Consider pull request for release board
Details
Consider pull request for release board Consider pull request for release board
Details
Consider pull request for release board Consider pull request for release board
Details
Consider pull request for release board Consider pull request for release board
Details
Consider pull request for release board Consider pull request for release board
Details
atom.github Build #20190907.1 succeeded
Details
atom.github (Lint) Lint succeeded
Details
atom.github (Linux) Linux succeeded
Details
atom.github (MacOS) MacOS succeeded
Details
atom.github (Snapshot) Snapshot succeeded
Details
atom.github (Windows) Windows succeeded
Details
@smashwilson

This comment has been minimized.

Copy link
Member

smashwilson commented Sep 13, 2019

Awesome! Thanks

@zetter

This comment has been minimized.

Copy link
Contributor Author

zetter commented Sep 16, 2019

@lkashef lkashef mentioned this pull request Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.