-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add support for abbreviating hashes in URLs #22
Comments
Including entire hash is more accurate. And browser will redirect to the expanded hash URL automatically when accessing abbreviated hash URL. So I'm not seeing advantage to open a page with abbreviated hash URL. What is your use case? |
I agree, it's most accurate, but for me 8 characters is always enough to reach the desired commit, and is very handy when linking commits in windows which are very narrow (e.g. Slack threads). I'm not suggesting changing the default of 40 characters, just making it configurable for people like me where horizontal real estate is limited in some cases. 😄 |
Do you mean you're not using git-brws for opening browser directly, but for making a string to share it on some other service like Slack? e.g.
|
Yes, that's my exact use case. See the issue I accidentally raised #23 before I found the For browsing alone, I don't have much use for shortened URLs, this would just be for linking shorter URLs to other people. |
OK, I'm considering interface. Two options:
I guess 1. is more useful for you, am I correct? |
Yeah, I think 1. would be my preference, but I think it's both more flexible and consistent with
See also
|
I want to start from minimal feature. Specifying length causes several error cases so I prefer fixed 7 length.
7 length is used by Git and GitHub for human-friendly hash abbreviation. I could not come up with a use case where they want to specify a value other than 7 for the hash length. So I feel boolean value to switch full length or abbreviated short length is sufficient. If someone raises a feature request to specify the hash length with practical use case, I would add a new option to specify hash length in the future. |
Fair enough, but I think 8 is more suitable as a default because I’ve actually experienced collisions with 7 in very large repositories. |
But experiencing conflict with 7 length does not mean that 8 length is enough.. I want to use the same value as Git and GitHub because there would be some discussions to determine the size. I know that the length used by Git had been 6 previously and was increased to 7 after. When Git increases the length to 8 in the future, git-brws also will follow it. |
Ok, sounds reasonable! |
Would be neat if there was an option or environment variable that we could use to configure the length of commits in URLs, i.e. when linking things to other people it's neater to link short links rather than long links.
Example
export GIT_BRWS_GIT_COMMIT_LENGTH=8
Would result in:
https://github.com/rhysd/git-brws/blob/6c250cc5/Cargo.toml
Rather than:
https://github.com/rhysd/git-brws/blob/6c250cc53e39666f415f28fd49d3b224e47a2309/Cargo.toml
The text was updated successfully, but these errors were encountered: