Skip to content
  • Philip McGraw's avatar
    git-p4: auto-delete named temporary file · de5abb5f
    Philip McGraw authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Avoid double-open exceptions on Windows platform when
    calculating for lfs compressed size threshold
    (git-p4.largeFileCompressedThreshold) comparisons.
    
    Take new approach using the NamedTemporaryFile()
    file-like object as input to the ZipFile() which
    auto-deletes after implicit close leaving with scope.
    
    Original code had double-open exception on Windows
    platform because file still open from NamedTemporaryFile()
    using generated filename instead of object.
    
    Thanks to Andrey for patiently suggesting several
    iterations on this change for avoiding exceptions!
    
    Also print error details after resulting IOError to make
    debugging cause of exception less mysterious when it has
    nothing to do with "git version recent enough."
    
    Signed-off-by: default avatarPhilip.McGraw <Philip.McGraw@bentley.com>
    Reviewed-by: default avatarAndrey Mazo <ahippo@yandex.com>
    Acked-by: default avatarLuke Diamand <luke@diamand.org>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    de5abb5f