Git Product home page Git Product logo

version.sh's People

Contributors

ansemjo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

version.sh's Issues

doesn't work for an empty git repo

it seems the script doesn't work for an empty git repo.
it reports:
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'
fatal: bad revision 'HEAD'
version : commit
commit : unknown

sed errors on OSX / dash 0.5.10.2

When running Travis jobs on OSX and testing with SH=dash it leads to weird sed errors. See the Travis log.

Installing dash via homebrew yields dash 0.5.10.2 and there are loads of errors like sed: 1: "s\/\-\\(\[0\-9\]\*\\)\- ...": substitute pattern can not be delimited by newline or backslash. However, this is not what's in the script? There are no backslashes and the string is enclosed in single-quotes.

Does dash do some transformations to the script upon running? Using dash 0.5.7-4ubuntu1 on Linux is fine ..

Update script with new %(describe) possibility

See 04186f9 for the relevant README update. There's a couple things to decide:

  • Am I still interested in supporting dash and ksh or shall I prefer bash-specific constructs like BASH_REMATCH?
  • How to handle insufficient git versions? This new change will require at least 3.32 .. just error out an require a new version or add fallbacks again and build the describe string manually as before?

Omitting fallbacks and simply requiring modern versions of bash and git might make the script a lot more terse and readable.

Also I might take some "inspiration" from Kubernetes. I especially like the [[ '$Format:%%$' == "%" ]] test to check if we're working from an archive directly.

commit id too long

in most cases a full 40 chars long commit id is not necessary, the leading 7 chars is long enough to distinguish it from others.
also, you limit the length to 7 by 'printf '%s%s%.7s\n' "$(version)" "$COMMIT_SEPERATOR" "$(commit)";' what if working space is dirty? (the "-dirty" will be truncated)

so why not using --abbrev=7 in git describe ?
also, to make it more brief, i think '--dirty=M --broken=W' is better than just '--dirty'.

add the branch name to output

i also suggest to show the branch name somewhere.

Originally posted by @zzuzhp in #4 (comment)


Afaik, the branch name is always present in the subsituted REFS variable and can be trivially found if we're in a git repository.

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.