X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=lib%2Fbup%2Fgit.py;h=dbfe78f6e81d48b7e8a21bdad7b682899ea91b01;hb=aa77c6b33c6d565801370aed96ad7d0075a073a3;hp=ec84dd7b0e071aca2af8888f80a08416d3fa9d38;hpb=d600f2a0c4614aa787e5721e03fe32dd91a22455;p=bup.git diff --git a/lib/bup/git.py b/lib/bup/git.py index ec84dd7..dbfe78f 100644 --- a/lib/bup/git.py +++ b/lib/bup/git.py @@ -4,14 +4,13 @@ interact with the Git data structures. """ from __future__ import absolute_import, print_function -import errno, os, sys, zlib, time, subprocess, struct, stat, re, tempfile, glob +import os, sys, zlib, subprocess, struct, stat, re, tempfile, glob from array import array from binascii import hexlify, unhexlify from collections import namedtuple from itertools import islice -from numbers import Integral -from bup import _helpers, compat, hashsplit, path, midx, bloom, xstat +from bup import _helpers, hashsplit, path, midx, bloom, xstat from bup.compat import (buffer, byte_int, bytes_from_byte, bytes_from_uint, environ, @@ -22,15 +21,13 @@ from bup.io import path_msg from bup.helpers import (Sha1, add_error, chunkyreader, debug1, debug2, exo, fdatasync, - hostname, localtime, log, + log, merge_dict, merge_iter, mmap_read, mmap_readwrite, - parse_num, progress, qprogress, stat_if_exists, unlink, utc_offset_str) -from bup.pwdgrp import username, userfullname verbose = 0 @@ -266,8 +263,7 @@ def demangle_name(name, mode): elif name.endswith(b'.bupm'): return (name[:-5], BUP_CHUNKED if stat.S_ISDIR(mode) else BUP_NORMAL) - else: - return (name, BUP_NORMAL) + return (name, BUP_NORMAL) def calc_hash(type, content): @@ -1272,6 +1268,7 @@ class CatPipe: if wait: p.wait() return p.returncode + return None def restart(self): self.close() @@ -1302,6 +1299,9 @@ class CatPipe: self.p.stdin.write(ref + b'\n') self.p.stdin.flush() hdr = self.p.stdout.readline() + if not hdr: + raise GitError('unexpected cat-file EOF (last request: %r, exit: %s)' + % (ref, self.p.poll() or 'none')) if hdr.endswith(b' missing\n'): self.inprogress = None yield None, None, None