Closed Bug 718115 Opened 13 years ago Closed 12 years ago

cfx leaks "fatal: Not a git repository " for every command

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: k0scist, Assigned: warner)

Details

Attachments

(1 file)

From a checkout of http://hg.mozilla.org/projects/addon-sdk

I get:

(addon-sdk)│cfx blahblahblah init
fatal: Not a git repository (or any parent up to mount parent )
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
cannot find 'package.json' in the current directory or any parent.

Though whatever cfx command I do does the first thing from the top of the output.  

From IRC, :warner advised me that there's code in cfx that tries to figure out its version number by asking "git --describe".  It is supposed to fall back to version="unknown" when .git doesn't exist, but the error message is still leaked
Oops. So my "what is my version" code survives a "git --describe" failure (leaking the scary-looking "fatal:" error message from git). But I didn't actually include the check for .git being present.

It needs to be updated to:

* if .git doesn't exist, return version=unknown
* if .git does exist, try git --describe
* if that works, use it for the version. Else version=unknown.

I'm ok with the error message being leaked if .git exists, as there are probably other sorts of error message that could be generated in git --describe that would be useful to see. But if .git doesn't exist, the tool should silently use version=unknown.

(I forgot about handling a non-checkout non-generated-tarball tree, which is what comes out of the git-to-hg bridge. Boy am I looking forward to shutting that thing down.)
Assignee: nobody → warner-bugzilla
(In reply to Brian Warner [:warner :bwarner] from comment #1)
> Oops. So my "what is my version" code survives a "git --describe" failure
> (leaking the scary-looking "fatal:" error message from git). But I didn't
> actually include the check for .git being present.
> 
> It needs to be updated to:
> 
> * if .git doesn't exist, return version=unknown
> * if .git does exist, try git --describe
> * if that works, use it for the version. Else version=unknown.
> 
> I'm ok with the error message being leaked if .git exists, as there are
> probably other sorts of error message that could be generated in git
> --describe that would be useful to see. But if .git doesn't exist, the tool
> should silently use version=unknown.

Sounds good to me

> (I forgot about handling a non-checkout non-generated-tarball tree, which is
> what comes out of the git-to-hg bridge. Boy am I looking forward to shutting
> that thing down.)

What is the planned alternative?  AFAIK, the hg mirror exists for Mozilla infrastructure (i.e. buildbot, build-vpn) needs.
This diff ought to fix it for Jetpack. I'll figure out a more general fix for the upstream code that this comes from (https://github.com/warner/python-versioneer)
Attachment #589662 - Flags: review?(mhammond)
Attachment #589662 - Flags: review?(mhammond) → review+
(In reply to Jeff Hammel [:jhammel] from comment #2)

> > (I forgot about handling a non-checkout non-generated-tarball tree, which
> > is what comes out of the git-to-hg bridge. Boy am I looking forward to
> > shutting that thing down.)
> 
> What is the planned alternative? AFAIK, the hg mirror exists for Mozilla
> infrastructure (i.e. buildbot, build-vpn) needs.

Right. The plan is for the releng buildbot to get jetpack code from git, not
hg. Bug 528360 is related.
FWIW, in general i think it would be nice to fix this issue regardless of preferred ways of downloading.  If someone, say someone who didn't have/want hg or git on their machine took the github-generated tarball, this would be just as much of an issue
Commit pushed to https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/d518c9fca43048eb39cd7eb859eb1939201c1884
Bug 718115: don't run 'git describe' unless .git exists. r=mhammond

Otherwise, cfx commands in an hg tree (from the git-to-hg bridge) emit
spurious+frightening "fatal: Not a git repository" messages all the time.
Brian, please reopen if you want to do more in this bug. :)
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Nope, we're good. There's already code in place to handle a github-generated tarball correctly (it uses expanded variables, like the old $Id$ from CVS). That's how release tarballs get their version without a .git directory.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: