Coder Social home page Coder Social logo

Comments (10)

rhysd avatar rhysd commented on May 20, 2024

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.

zx8 avatar zx8 commented on May 20, 2024

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.

rhysd avatar rhysd commented on May 20, 2024

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.

zx8 avatar zx8 commented on May 20, 2024

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.

rhysd avatar rhysd commented on May 20, 2024

OK, I'm considering interface. Two options:

  1. Setting export GIT_BRWS_COMMIT_HAS_ABBREV=true always makes use of abbreviated hashes (default value is false)
  2. 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.

zx8 avatar zx8 commented on May 20, 2024

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.

rhysd avatar rhysd commented on May 20, 2024

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.

zx8 avatar zx8 commented on May 20, 2024

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.

rhysd avatar rhysd commented on May 20, 2024

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.

zx8 avatar zx8 commented on May 20, 2024

Ok, sounds reasonable!

from git-brws.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.