git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: martin@catalyst.net.nz
To: git@vger.kernel.org
Cc: Martin Langhoff <martin@catalyst.net.nz>
Subject: [PATCH 5/5] archimport - better handling of temp dirs
Date: Sun, 11 Sep 2005 21:26:05 +1200	[thread overview]
Message-ID: <1126430765146-git-send-email-martin@catalyst.net.nz> (raw)
In-Reply-To: <1126430765745-git-send-email-martin@catalyst.net.nz>

Switched from backwards hard-coded tmp directory creation to using
File::Temp::tempdir() to create the directory inside $TMP_PATH or
what the user has provided via the -t parameter.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>


---

 git-archimport.perl |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

67d3cf04c6a2353835d52a4d1ae85c7fb91bad36
diff --git a/git-archimport.perl b/git-archimport.perl
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -23,7 +23,6 @@ See man (1) git-archimport for more deta
 
  - create tag objects instead of ref tags
  - audit shell-escaping of filenames
- - better handling of temp directories
  - hide our private tags somewhere smarter
  - find a way to make "cat *patches | patch" safe even when patchfiles are missing newlines  
 
@@ -37,7 +36,7 @@ use strict;
 use warnings;
 use Getopt::Std;
 use File::Spec;
-use File::Temp qw(tempfile);
+use File::Temp qw(tempfile tempdir);
 use File::Path qw(mkpath);
 use File::Basename qw(basename dirname);
 use String::ShellQuote;
@@ -72,9 +71,10 @@ usage if $opt_h;
 @ARGV >= 1 or usage();
 my @arch_roots = @ARGV;
 
-my $tmp = $opt_t;
-$tmp ||= '/tmp';
-$tmp .= '/git-archimport/';
+my ($tmpdir, $tmpdirname) = tempdir('git-archimport-XXXXXX', TMPDIR => 1, CLEANUP => 1);
+my $tmp = $opt_t || 1;
+$tmp = tempdir('git-archimport-XXXXXX', TMPDIR => 1, CLEANUP => 1);
+$opt_v && print "+ Using $tmp as temporary directory\n";
 
 my @psets  = ();                # the collection
 my %psets  = ();                # the collection, by name

  reply	other threads:[~2005-09-11  9:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-11  9:26 archimport documentation updates and tidyups martin
2005-09-11  9:26 ` [PATCH 1/5] archimport documentation update martin
2005-09-11  9:26   ` [PATCH 2/5] archimport documentation tidyup martin
2005-09-11  9:26     ` [PATCH 3/5] archimport - update in-script doco, options tidyup martin
2005-09-11  9:26       ` [PATCH 4/5] archimport - use GIT_DIR instead of hardcoded ".git" martin
2005-09-11  9:26         ` martin [this message]
2005-09-11 14:58   ` [PATCH 1/5] archimport documentation update A Large Angry SCM

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

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

  git send-email \
    --in-reply-to=1126430765146-git-send-email-martin@catalyst.net.nz \
    --to=martin@catalyst.net.nz \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).