Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 192476 - git.eclass doesn't work with GIT_BRANCH and new branch not in tree before fetch.
Summary: git.eclass doesn't work with GIT_BRANCH and new branch not in tree before fetch.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Fernando J. Pereda (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-14 02:51 UTC by Avuton Olrich
Modified: 2007-12-27 01:02 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Reproduces a problem (update-live-ebuilds-live-0.2.ebuild,663 bytes, text/plain)
2007-09-14 12:00 UTC, Avuton Olrich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Avuton Olrich 2007-09-14 02:51:35 UTC
I went to use git.eclass with GIT_BRANCH in my local overlay and noticed the following:

 * git update start -->
 *    repository: git://repo.or.cz/ule.git
fatal: ambiguous argument 'unstable': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
remote: Generating pack...
remote: Done counting 7 objects.
remote: Result has 5 objects.
remote: Deltifying 5 objects...
remote: /5) done/5) done
remote: Total 5 (delta 3), reused 0 (delta 0)
Unpacking 5 objects...
 100% (5/5) done
* refs/heads/unstable: storing branch 'unstable' of git://repo.or.cz/ule
  commit: e8913d1
 *    local clone: /mnt/linear/Paludis/distfiles/git-src/update-live-ebuilds-live
 *    committish: master

'Unstable' wasn't available until after the fetch so maybe this is a good time to change to the branch?

Thanks
Comment 1 Fernando J. Pereda (RETIRED) gentoo-dev 2007-09-14 07:00:38 UTC
Define 'doesn't work'. It looks to me like what doesn't work is showing the diffstat between last state and new state, and since there is no 'previous state' if the branch is not present, I don't see what the problem is.

Also, please paste what EGIT_* variables you had before 'inherit git'.

- ferdy
Comment 2 Avuton Olrich 2007-09-14 12:00:33 UTC
Created attachment 130901 [details]
Reproduces a problem
Comment 3 Avuton Olrich 2007-09-14 12:06:56 UTC
OK, first of all, I was making a false assumption that commitish would show the branch that we were changing to, but now that I'm trying this ebuild it's not even changing to the branch at all afaict.

I have attached my ebuild above, it is supposed to download and install the 'unstable' branch from the update-live-ebuilds repo. 

Here's the gitweb for that repo: http://repo.or.cz/w/ule.git

It's installing commit 9d7b8f7e163ae8f83064a17c07aaa22aa1ba13dc (master) when I would have expected it to install e8913d1f4bdcf6684891de43bf30cdd14d2b842b from the unstable branch. In comment #1 I was trying to show how the fatal warning that said it couldn't switch to unstable, and was suggesting that maybe the eclass switches too early, maybe more prudent to wait until after the fetch occurs. 
Comment 4 Fernando J. Pereda (RETIRED) gentoo-dev 2007-09-14 12:57:20 UTC
You have to declare EGIT_* variables BEFORE doing 'inherit git'. Just for the record, git.eclass does not CHANGE branches it just extracts whatever it needs.

That being said, I reckon that the 'fatal' error should be sent to /dev/null and avoid doing the diffstat if we didn't get a proper committish.

Please try defining those vars before inheriting git.eclass and tell me whether it works (it should).

- ferdy
Comment 5 Avuton Olrich 2007-09-14 13:04:51 UTC
Yes, that works, thanks
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-12-27 01:02:46 UTC
Either set EGIT_BRANCH before the inherit, or set both EGIT_BRANCH and EGIT_TREE after the inherit.

I added a comment to this effect in the eclass.