From 1469214dc14caa4875e37d25846b9e00ade416e0 Mon Sep 17 00:00:00 2001 From: Owen Smith Date: Fri, 9 May 2014 12:03:05 +0100 Subject: [PATCH 1/2] When fetching, treat anything that's not a tag as a generic RemoteReference -- don't sniff for branch specifically. Otherwise it's impossible to fetch certain kinds of non-standard remote refs, like github's special pull request refs. --- git/remote.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/git/remote.py b/git/remote.py index f89e9d83c..cc7cb9e92 100644 --- a/git/remote.py +++ b/git/remote.py @@ -271,14 +271,10 @@ def _from_line(cls, repo, line, fetch_line): ref_type = None if remote_local_ref == "FETCH_HEAD": ref_type = SymbolicReference - elif ref_type_name in ("remote-tracking", "branch"): - # note: remote-tracking is just the first part of the 'remote-tracking branch' token. - # We don't parse it correctly, but its enough to know what to do, and its new in git 1.7something - ref_type = RemoteReference elif ref_type_name == "tag": ref_type = TagReference else: - raise TypeError("Cannot handle reference type: %r" % ref_type_name) + ref_type = RemoteReference #END handle ref type # create ref instance From e393f85e2fe6027e4c1192cfdfc928682a0b5d93 Mon Sep 17 00:00:00 2001 From: Owen Smith Date: Fri, 9 May 2014 12:09:15 +0100 Subject: [PATCH 2/2] Give Popen a silly buffer size, or you only get the first 2^16 bytes Without this, some commands with large output fail horrible. For example, fetching remotes that have a large ref list: it fetches fine, but then the parsing for FetchInfo dies because the (trimmed) stderr list isn't as long as the list from FETCH_HEAD. I couldn't find a generic way to make this unbounded (temporary files, for example) without rewriting *everywhere* that stdout/stderr is read. Which is...a lot of places. --- git/cmd.py | 1 + 1 file changed, 1 insertion(+) diff --git a/git/cmd.py b/git/cmd.py index b3274dd8f..3b8508027 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -338,6 +338,7 @@ def execute(self, command, stderr=PIPE, stdout=PIPE, close_fds=(os.name=='posix'),# unsupported on linux + bufsize=(10 *1024 * 1024), **subprocess_kwargs ) if as_process: