git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Philip McGraw via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v2 0/1] git-p4: auto-delete named temporary file
Date: Fri, 02 Aug 2019 12:43:37 -0700 (PDT)	[thread overview]
Message-ID: <pull.303.v2.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.303.git.gitgitgadget@gmail.com>

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 produced double-open problems on Windows platform from using
already open NamedTemporaryFile() 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: Philip.McGraw Philip.McGraw@bentley.com
[Philip.McGraw@bentley.com]

Philip.McGraw (1):
  git-p4: auto-delete named temporary file

 git-p4.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)


base-commit: 1feeaaf26bff51996f9f96c6dc41ca0f95ab5fc4
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-303%2Fphilip-mcgraw%2Fgit-p4-auto-delete-named-temporary-file-v3-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-303/philip-mcgraw/git-p4-auto-delete-named-temporary-file-v3-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/303

Range-diff vs v1:

 1:  1b270ef9a6 ! 1:  7e59b5cec2 git-p4: auto-delete named temporary file
     @@ -2,13 +2,17 @@
      
          git-p4: auto-delete named temporary file
      
     +    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 produced double-open problems on Windows
     -    platform from using already open NamedTemporaryFile()
     -    generated filename instead of object.
     +    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!
     @@ -18,6 +22,7 @@
          nothing to do with "git version recent enough."
      
          Signed-off-by: Philip.McGraw <Philip.McGraw@bentley.com>
     +    Reviewed-by: Andrey Mazo <ahippo@yandex.com>
      
       diff --git a/git-p4.py b/git-p4.py
       --- a/git-p4.py

-- 
gitgitgadget

  parent reply	other threads:[~2019-08-02 19:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01 21:39 [PATCH 0/1] git-p4: auto-delete named temporary file Philip McGraw via GitGitGadget
2019-08-02  3:48 ` Andrey
2019-08-02 19:43 ` Philip McGraw via GitGitGadget [this message]
2019-08-27  3:43   ` [PATCH v2 1/1] " Andrey Mazo
2019-08-27 22:31     ` Junio C Hamano
2019-08-28  8:34       ` Luke Diamand
     [not found]         ` <10209481570324845@myt6-4218ece6190d.qloud-c.yandex.net>
2019-10-06  2:43           ` Junio C Hamano
2019-08-26 13:51 ` [PATCH " Git Gadget
2019-08-26 16:39   ` Junio C Hamano
2019-08-28 12:25     ` Johannes Schindelin
2019-08-29  3:57       ` Junio C Hamano
2019-08-29 11:45         ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.303.v2.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).