Skip to content

git-p4: auto-delete named temporary file

Philip McGraw via GitGitGadget git 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest0 of 1 patch 0 repliesNew
  2. v11 patch 5 repliesSuperseded

Patches in v2 No applies recorded yet

The patch the cover letter announces is not in this archive.

Reviews trailers per patch

PatchAndrey Mazo
SeriesR-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/1] git-p4: auto-delete named temporary file

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."

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."

+ Reviewed-by: Andrey Mazo <[email protected]>

diff --git a/git-p4.py b/git-p4.py
--- a/git-p4.py

Signature · 1 line
gitgitgadget