Giter VIP home page Giter VIP logo

Comments (7)

crdelsey avatar crdelsey commented on August 22, 2024 1

Yeah. I can take a stab at it. Probably next week.

I haven't looked at the codebase much yet, so I'm not sure if this makes sense.

But rather than changing all the backends, I could have the command line parser split the --exact-with-tags convenience option into two separate options on the command object: the existing .exact and a .with_tags. All the other backends would ignore the with_tags flag and maintain the same behavior.

from vcstool.

dirk-thomas avatar dirk-thomas commented on August 22, 2024

I think when the --exact parameter is specified, it is preferable to provide the commit hash.

The behavior to return tags when available is intentional (see #98). Since tags are intended to be immutable and significantly more readable they are being used by --exact if the current hash has exactly one tag pointing to it.

from vcstool.

crdelsey avatar crdelsey commented on August 22, 2024

I don't know about all vcs tools, but tags frequently aren't all that immutable. For instance, they are frequently used to mark the latest_stable version or some such thing, with the tag being moved as someone or CI decides that a new version is now passing the tests.

I'm pretty sure they can be moved in Git, so, for right or wrong, if somebody moves the tag, the --exact option is not so exact anymore.

Having the tag is a nice feature most of the time, but, it disagrees with the docs for the --exact parameter.

"export" command parameters:
  --exact            Export exact commit hash instead of branch names

If you want to keep this behavior, maybe another option, something like --hash-only could be used to disable the tag lookup feature?

from vcstool.

dirk-thomas avatar dirk-thomas commented on August 22, 2024

I'm pretty sure they can be moved in Git, so, for right or wrong, if somebody moves the tag, the --exact option is not so exact anymore.

Sure, you can also rewrite history in git - still something to consider not doing ;-)

Having the tag is a nice feature most of the time, but, it disagrees with the docs for the --exact parameter.

Agreed, clarifying the help text would certainly be good 👍

If you want to keep this behavior, maybe another option, something like --hash-only could be used to disable the tag lookup feature?

Adding another option to toggle the behavior to always return hashes vs. potentially tags if they are unique would be good. Since the change has only landed recently I am not too concerned about changing the behavior (if we think that makes more sense). I am just not sure what the right names for the two options would be --exact and ? --hash-only seems very git specific...

from vcstool.

dirk-thomas avatar dirk-thomas commented on August 22, 2024

After thinking about it I think it is more natural if --exact always outputs hashes and a new option --exact-with-tags (naming up for discussion) for the current behavior (unique tags when available, fallback to hashes).

The new option could either be standalone or require also to pass --exact. The former seems more user friendly but will require all existing backends to check for the new option and at least do the same as for the existing option.

@crdelsey Would you be willing to contribute a pull request for this new option?

from vcstool.

dirk-thomas avatar dirk-thomas commented on August 22, 2024

@crdelsey Friendly ping.

from vcstool.

dirk-thomas avatar dirk-thomas commented on August 22, 2024

Resolved by #115.

from vcstool.

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.