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

Enable copying of abbreviated commit IDs #1062

Closed
br3ndonland opened this issue Jul 3, 2020 · 6 comments
Closed

Enable copying of abbreviated commit IDs #1062

br3ndonland opened this issue Jul 3, 2020 · 6 comments
Assignees
Labels
feature New feature or request verified ✔ Verified
Milestone

Comments

@br3ndonland
Copy link
Contributor

br3ndonland commented Jul 3, 2020

I would like to be able to copy abbreviated commit IDs (SHAs), but I can only copy full-length IDs. I frequently find myself copying a commit ID, pasting it into a commit message (to reference a related commit), and then manually abbreviating it to 7-8 characters.

We now have the ability to change the length of the abbreviated commit ID, after #608 and #611. However, there doesn't seem to be a way to actually copy the abbreviated commit ID. I can't find any option to set the length of the commit ID copied to the clipboard. Am I missing something?

I'm on macOS Catalina 10.15.5, VSCode 1.46.1, and GitLens 10.2.1.

I would like to see something like:

  • Menu option for copying abbreviated commit ID (probably in between the "Copy Commit ID" and "Copy Commit Message" options)
    gitlens-commit-menu
  • Setting to change the default length of copied commit IDs (so that when you click the "Copy Commit ID" button, it copies the abbreviated commit ID)
    {
      "gitlens.defaultCommitIDFormat": "abbreviated"
    }

I'm happy to take on a PR for this, though it will probably be several weeks until I can make time for it.

@br3ndonland br3ndonland added the feature New feature or request label Jul 3, 2020
@eamodio eamodio added this to the Backlog milestone Dec 23, 2020
@eamodio eamodio added good first issue Good for newcomers help wanted Want community input and/or pull request labels Dec 23, 2020
@eamodio
Copy link
Member

eamodio commented Dec 23, 2020

Sounds like a good idea. Would you mind opening a PR to add it or get it started? I'd be happy to help point in the right direction, etc.

I would also suggest a setting more like "gitlens.advanced.useAbbreviatedShaLengthForCopy": true|false

@br3ndonland
Copy link
Contributor Author

Sure thing. I'll get working on a PR.

@eamodio eamodio self-assigned this Jan 14, 2021
@eamodio eamodio modified the milestones: Backlog, Soon™ Jan 14, 2021
@eamodio eamodio added needs-verification Request for verification pending-release Resolved but not yet released to the stable edition and removed good first issue Good for newcomers help wanted Want community input and/or pull request labels Jan 14, 2021
@eamodio
Copy link
Member

eamodio commented Jan 14, 2021

Can you please verify this fix in tomorrow's insiders edition?

You can install the insiders edition from here. Be sure to disable/uninstall the stable version of GitLens first.

@br3ndonland
Copy link
Contributor Author

Can you please verify this fix in tomorrow's insiders edition?

Verified! After disabling eamodio.gitlens and installing eamodio.gitlens-insiders, I can add these settings:

{
  "gitlens.advanced.abbreviatedShaLength": 8,
  "gitlens.advanced.abbreviateShaOnCopy": true
}

GitLens then copies the SHA with the correct abbreviated length of 8 characters.

Thanks for all your work on GitLens! It's a great extension and I really appreciate it. 👏

@eamodio
Copy link
Member

eamodio commented Jan 14, 2021

Awesome! And thanks for your contribution!

@eamodio eamodio added verified ✔ Verified and removed needs-verification Request for verification labels Jan 14, 2021
@eamodio eamodio modified the milestones: Soon™, Shipped Feb 3, 2021
@eamodio eamodio removed the pending-release Resolved but not yet released to the stable edition label Feb 9, 2021
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature or request verified ✔ Verified
Projects
None yet
Development

No branches or pull requests

2 participants