Where does the Git revision number come from?

I’ve installed Appium through npm a few weeks ago. When I ran it, I get this output:

[Appium] Welcome to Appium v1.5.1 (REV da34fba151ee33c1a2e14ab21ee0dc4ea451cc0f)

I’ve done another installation on another machine. And now I see:

[Appium] Welcome to Appium v1.5.2 (REV d887dd39ec60c70e76a696e5fc9309172962d3c8)

Looking at the code, it seems this string is pulled from the result of running git rev-parse HEAD.

And yet, neither of these commit numbers are in the public repository for Appium or the *-driver repos. And definitely don’t match the commit for the v1.5.1 and v1.5.2 tags.

So where are these numbers coming from?

Except that one doesn’t.

Oops!!! I’ll have to look at my machines again!!

But neither commits exist in https://github.com/appium/appium

Any ideas where they came from?

It’s a git thing, which I think you’ve already guessed. Git associates a SHA1 hash with the commit:

I’m aware of that. Where can I find those commits on Github?

Those hashes don’t exist. Not even in their shortened form. I checked the Appium repo and the Appium base/ios/android driver repos.

I checked by using this URL format:
https://github.com/appium/appium/commit/COMMIT_HASH

By the way, these versions of Appium were installed through NPM. It’s possible to have a commit hash that isn’t in the public repos if you’re using a local clone (ie. you’ve committed local to HEAD). But I assume NPM pulls from the public repo.

I’m not sure about this. I would think that NPM pulls from the public repo by tags (to keep the versions straight), but I’m actually not sure about that at all.

So I’m back at work today and can probe around more now.

So it turns out this is coming from Homebrew and how it installed NPM!

> which appium
/usr/local/bin/appium
> cd /usr/local/bin
> ll | grep appium
appium -> ../lib/node_modules/appium/build/lib/main.js
> cd ../lib/node_modules/appium
> git log --oneline
d887dd3 brew install: make -s apply only to given formula, not deps (#205)
> git remote show origin
* remote origin
  Fetch URL: https://github.com/Homebrew/brew
> cd ../../../
> pwd
/usr/local
> git log --oneline
d887dd3 brew install: make -s apply only to given formula, not deps (#205)
> git remote show origin
* remote origin
  Fetch URL: https://github.com/Homebrew/brew

So it seems that the Appium code should either remove the git commit piece in the logs (I’d rather keep it) or ensure that it’s in its own repo before printing it out.