Closed vbabiy closed 13 years ago
By default it is actually checking out the "master" branch directly from the
remote: git checkout -f origin/master
.
This is done to be absolutely clear about what ref is used, especially since
it can also handle tags, branches and commits with the @ syntax. git branch
won't work since remote branches aren't handled like local branches,
which - IMHO - shouldn't be created or special cased.
Original Comment By: Jannis Leidel
This seems highly confusing to me. If I choose an 'editable' switch at the command line, I expect the end state to be ready for editing. This is further confused by the fact that you can leave off the -e switch completely and it will still install from git (it just won't leave anything in /src).
Additionally, the pip's default checkout prevents 'git pull' from working as well (without doing checkout master first).
I'm trying to use pip to build both development and deployment environments, but it seems to require a lot of manual intervention when building for dev.
Edit:
It would help if there was some clarification as to what exactly I have to do in order to get the local master branch to be checked out automatically.
Original Comment By: andrewingram
I just stumbled across this same problem. One workaround is to do
[1][1]
[2][2]
[3][3]
pip install -e git+gitrepo:foo.git#egg=foo-git
cd src/foo-git
git branch master
Still, it would be nice to get a directly editable clone.
Original Comment By: Cliff Dyer
Bump!
Original Comment By: JK Laiho
Original Comment By: Jannis Leidel
Fixed #32 - Don't force a checkout after cloning a Git repository if the detected "revision" is the default.
→ [Author: jezdez
Age: 12 months ago
Fixed 32 - Don't force a checkout after cloning a Git repository if the detected "revision" is the default.">r462:278f93f89a2f]2
using-e-doesnt
Original Comment By: Jannis Leidel
I'm trying to check out a specific tagged build from github and I'm getting this error:
$ pip install -e git+git@github.com:poswald/django-beta-
tools.git@0.0.3#egg=django-beta-tools
Obtaining django-beta-tools from git+git@github.com:poswald/django-beta-
tools.git@0.0.3#egg=django-beta-tools
Updating /Users/poswald/.virtualenvs/hats/src/django-beta-tools clone
(to 0.0.3)
You are not currently on a branch, so I cannot use any
'branch.<branchname>.merge' in your configuration file.
Please specify which remote branch you want to use on the command
line and try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
Complete output from command /usr/local/bin/git pull -q:
----------------------------------------
Command /usr/local/bin/git pull -q failed with error code 1
Storing complete log in /Users/poswald/.pip/pip.log
$ pip --version
pip 0.8 from /Users/poswald/.virtualenvs/hats/lib/python2.6/site-packages
(python 2.6)
$ git --version
git version 1.7.2.1
$ cd /Users/poswald/.virtualenvs/hats/src/django-beta-tools/
$ git branch -v
* (no branch) f7a8f1c Forgot to remove this import
master 03137c1 [behind 2] Adding a survey test
$
You can see it is not checked out on a branch after running this.
I tag my projects and push them to github using git tag -a 0.0.3 or similar. Unfortunately, that's a private repo right now so you can't test with what I'm testing, but I think it will happen with any project tagged.
This seems related to this changeset, but let me know and I'll open it as a new issue.
Original Comment By: Paul Oswald
I'll also add that this behavior seems to have changed in version 0.8.0... Although the branch isn't set to master (which was the original request I guess), it still works in 0.7.2:
$ pip install -e git+git@github.com:poswald/django-beta-
tools.git@0.0.3#egg=django-beta-tools
Obtaining django-beta-tools from git+git@github.com:poswald/django-beta-
tools.git@0.0.3#egg=django-beta-tools
Updating /Users/poswald/.virtualenvs/hats/src/django-beta-tools clone
(to 0.0.3)
Running setup.py egg_info for package django-beta-tools
Installing collected packages: django-beta-tools
Running setup.py develop for django-beta-tools
install_dir /Users/poswald/.virtualenvs/hats/lib/python2.6/site-
packages/
Creating /Users/poswald/.virtualenvs/hats/lib/python2.6/site-packages
/django-beta-tools.egg-link (link to .)
Adding django-beta-tools 0.0.3 to easy-install.pth file
Installed /Users/poswald/.virtualenvs/hats/src/django-beta-tools
Successfully installed django-beta-tools
Cleaning up...
$ pip --version
pip 0.7.2 from /Users/poswald/.virtualenvs/hats/lib/python2.6/site-
packages (python 2.6)
$ pwd
/Users/poswald/.virtualenvs/hats/src/django-beta-tools
$ git branch -v
* (no branch) e649f96 Adding a changelog
master 03137c1 [behind 2] Adding a survey test
$ pip freeze | grep beta
-e git+git@github.com:poswald/django-beta-tools.git@e649f9656c9255145a6179
a5773670932174a31d#egg=django_beta_tools-0.0.3-py2.6-dev
Actually looking at it again, I don't know what pip 0.8.0 was doing because the change it had listed as (no branch) was the wrong one. The e649f9 change is the one tagged as 0.0.3 in my origin/master and master repos.
Original Comment By: Paul Oswald
Bump!
Original Comment By: Anonymous
like paul, i'm seeing this issue with pip .8 and github checkouts
Original Comment By: tehfink
Bump!
Original Comment By: centralniak
Bump - same problem as described, pip 0.8, patch worked
Original Comment By: unbracketed
Bump - the workaround of git checkout master
works but is really annoying
when you have several editable Git repos in the requirements file and you have
to cd into every one to execute this command (I can't figure out how to run
Git checkout on a repo outside the current working directory) every time you
run pip install -r requirements.txt
.
Original Comment By: Anonymous
IIRC the "patch" I mentioned was the one on this ticket: http://bitbucket.org/ianb/pip/issue/161/cant-git-pull-from-some- repositories
repositories
Original Comment By: http://bitbucket.org/ianb/pip/issue/161/cant-git-pull-from-some-repositories
BTW, [Author: hltbra
Age: 8 months ago
bugfix for 150 - editable git repos aren't updated when re-installed; Alex Robbins (alexrobbins) helped fix that bug">r727:7a9d6751d4aa]1 broke that.
Original Comment By: Jannis Leidel
Please try out [Author: jezdez
Age: 4 months ago
Another try at fixing 32 and 161. Use git fetch instead of git pull (which fetches and merges), before checking out the wanted commmit.">r798:d46cefc7d62a]1
Original Comment By: Jannis Leidel
Hey Jannis, If the tests are not wrong, this changeset breaks #150 - we need another solution...
when-re
Original Comment By: #150
Thanks for the hint, anonymous. For the record, I believe not checking out a branch/tag at all is worse than not updating it.
Original Comment By: Jannis Leidel
Currently we are seeing the same issue when having checked out a specific branch using in the requirements.txt
-e git:github.com/skinkie/SleekXMPP.git@develop#egg=SleekXMPP
Installing to an empty src directory works, using -U to update results in:
Obtaining SleekXMPP from
git+git:_github.com/skinkie/SleekXMPP.git@develop#egg=SleekXMPP (from -r
requirements.txt (line 2)) Updating
/home/virtualenv/brwsinenrichers/src/sleekxmpp clone (to develop) You are not
currently on a branch, so I cannot use any 'branch.
Original Comment By: Anonymous
Not sure why this issue was closed by "Merge pull request #23 from dholth/wheel_build". As near as I can tell, this wheel build has nothing to do with fixing this problem.
I've seen this issue elsewhere, with regards to virtualenv (http://groups.google.com/group/python-virtualenv/browse_thread/thread/afd8d06d69a0f3be), but it's looking like a pip issue to me.
Basically if I install an editable package from git using pip, and then go to environment/src/foo/ and type 'git branch', I get the following output:
using a standard git clone correctly yields the following output (which means the repositories aren't at fault):
This happens when checking out from anywhere (github, local repos, remotes etc). This is particularly troublesome if you don't realise it's happened and then try to make some changes and commit/push since it causes errors.
I'm not sure what's happening since from a quick glance at the code, pip is just running git clone.