You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found this easiest to reproduce by creating a bare clone of another repository.
Set up like this:
ben@earwig:~/test $ git init foo
Initialized empty Git repository in /Users/ben/test/foo/.git/
ben@earwig:~/test $ cd foo
ben@earwig:~/test/foo [master] $ echo "test" > test && git add test && git commit -m "test"
[master (root-commit) 269c498] test
1 file changed, 1 insertion(+)
create mode 100644 test
ben@earwig:~/test/foo [master] $ cd ..
ben@earwig:~/test $ git clone --bare foo bar
Cloning into bare repository 'bar'...
done.
Note the structure of the config file and that an ordinary git fetch origin works.
ben@earwig:~/test $ cd bar
ben@earwig:~/test/bar [BARE:master] $ cat config
[core]
repositoryformatversion = 0
filemode = true
bare = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = /Users/ben/test/foo
ben@earwig:~/test/bar [BARE:master] $ git fetch origin
From /Users/ben/test/foo
* branch HEAD -> FETCH_HEAD
Now, here's the bug:
ben@earwig:~/test/bar [BARE:master] $ python
Python 2.7.10 (default, May 29 2015, 21:05:23)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import git
>>> git.Repo().remotes.origin.fetch()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/git/remote.py", line 651, in fetch
res = self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())
File "/usr/local/lib/python2.7/site-packages/git/remote.py", line 588, in _get_fetch_info_from_stderr
for err_line, fetch_line in zip(fetch_info_lines, fetch_head_info))
File "/usr/local/lib/python2.7/site-packages/git/remote.py", line 588, in <genexpr>
for err_line, fetch_line in zip(fetch_info_lines, fetch_head_info))
File "/usr/local/lib/python2.7/site-packages/git/remote.py", line 249, in _from_line
raise ValueError("Failed to parse FETCH_HEAD line: %r" % fetch_line)
ValueError: Failed to parse FETCH_HEAD line: u'269c498e56feb93e408ed4558c8138d750de8893\t\t/Users/ben/test/foo\n'
>>>
If I add a valid refspec to the config, it works:
ben@earwig:~/test/bar [BARE:master] $ git config --add remote.origin.fetch +refs/heads/*:refs/heads/*
ben@earwig:~/test/bar [BARE:master] $ python
Python 2.7.10 (default, May 29 2015, 21:05:23)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import git
>>> git.Repo().remotes.origin.fetch()
[<git.remote.FetchInfo object at 0x11094a0a8>]
>>>
The text was updated successfully, but these errors were encountered:
For me, a new user of GitPython, it is unclear, why refspec is required in this situation while it is unneeded by vanilla git. Maybe a couple of words in the docs are due, or have I missed them?
My current use case for GitPython is very simple: I need to be able to access specific files from specific revision of some repository.
I found this easiest to reproduce by creating a bare clone of another repository.
Set up like this:
Note the structure of the
config
file and that an ordinarygit fetch origin
works.Now, here's the bug:
If I add a valid refspec to the config, it works:
The text was updated successfully, but these errors were encountered: