Comments (10)
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?
from git-brws.
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. 😄
from git-brws.
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.
git brws --url | pbcopy
from git-brws.
Yes, that's my exact use case. See the issue I accidentally raised #23 before I found the --url
functionality!
For browsing alone, I don't have much use for shortened URLs, this would just be for linking shorter URLs to other people.
from git-brws.
OK, I'm considering interface. Two options:
- Setting
export GIT_BRWS_COMMIT_HAS_ABBREV=true
always makes use of abbreviated hashes (default value isfalse
) - Specifying
--hash-abbrev
option makes use of abbreviated hashes for the command execution
I guess 1. is more useful for you, am I correct?
from git-brws.
Yeah, I think 1. would be my preference, but I think it's both more flexible and consistent with git rev-parse --short=<N>
if its value was a number rather than a boolean?
$ git rev-parse--help
...
--short[=length]
Same as --verify but shortens the object name to a unique prefix
with at least length characters. The minimum length is 4, the
default is the effective value of the core.abbrev configuration
variable (see git-config(1)).
...
See also core.abbrev
:
core.abbrev
set the length object names are abbreviated to. If unspecified or set to
"auto", an appropriate value is computed based on the approximate number of
packed objects in your repository, which hopefully is enough for abbreviated
object names to stay unique for some time. The minimum length is 4.
from git-brws.
I want to start from minimal feature. Specifying length causes several error cases so I prefer fixed 7 length.
- when value other than unsigned integer
- when value is zero
- when value is longer than original hash
- when value is small (e.g. 2), generated URL is useless
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.
from git-brws.
Fair enough, but I think 8 is more suitable as a default because I’ve actually experienced collisions with 7 in very large repositories.
from git-brws.
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.
from git-brws.
Ok, sounds reasonable!
from git-brws.
Related Issues (20)
- Opens non-existing file page when the latest commit is not pushed yet HOT 1
- URL is wrong when opening 'New PullRequest' page with `git brws -p`
- Is build with cargo broken? HOT 3
- Add Diff support for Bitbucket HOT 2
- Consider an alternate http client? HOT 3
- Long delay with brws'ing a file in a large repository HOT 13
- CI on X86_64 Windows fails due to bad --git-dir
- Does not open submodule's URL when running it from outside submodule directory
- Add `--print` option
- Invalid port number when user name starts with numbers HOT 9
- URLs for directory paths should use `/tree/` instead of `/blob/` HOT 1
- Empty branch name navigates to 404 error page
- -c option is not effective when opening filepaths
- Gitlab subgroups doesn't seem to be supported HOT 6
- Upgrade to tokio v1 HOT 2
- Support for self-hosted BitBucket (Stash)
- Default remote name is fixed to "origin"
- Option to open the PRs and Issues pages
- Azure dev ops support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git-brws.