Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fetching a remote without a configured refspec raises ValueError #296

Closed
@earwig

Description

@earwig

I found this easiest to reproduce by creating a bare clone of another repository.

Set up like this:

ben@earwig:~/test $ git init fooInitialized empty Git repository in /Users/ben/test/foo/.git/ben@earwig:~/test $ cd fooben@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 testben@earwig:~/test/foo [master] $ cd ..ben@earwig:~/test $ git clone --bare foo barCloning into bare repository 'bar'...done.

Note the structure of theconfig file and that an ordinarygit fetch origin works.

ben@earwig:~/test $ cd barben@earwig:~/test/bar [BARE:master] $ cat config[core]    repositoryformatversion = 0    filemode = true    bare = true    ignorecase = true    precomposeunicode = true[remote "origin"]    url = /Users/ben/test/fooben@earwig:~/test/bar [BARE:master] $ git fetch originFrom /Users/ben/test/foo * branch            HEAD       -> FETCH_HEAD

Now, here's the bug:

ben@earwig:~/test/bar [BARE:master] $ pythonPython 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 darwinType "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] $ pythonPython 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 darwinType "help", "copyright", "credits" or "license" for more information.>>> import git>>> git.Repo().remotes.origin.fetch()[<git.remote.FetchInfo object at 0x11094a0a8>]>>>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp