Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

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 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
@smashwilson
Copy link
Contributor

Awesome! Thanks ✨

@zetter
Copy link
Contributor Author

zetter commented Sep 16, 2019 via email

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

Successfully merging this pull request may close these issues.

2 participants