From 06c5ba727347fc492530e0dc0606164983d4a316 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 9 Feb 2024 01:27:58 +0000 Subject: dgit: Delete the playground on success, by default Also add a --keep-playground option to control this. I haven't done this for git-debrebase, since its playgrounds are going to be much smaller. dgit's can contain orig tarballs etc. Closes: #1056103 Signed-off-by: Ian Jackson --- dgit | 7 +++++++ dgit.1 | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/dgit b/dgit index d768827..6a4b984 100755 --- a/dgit +++ b/dgit @@ -83,6 +83,7 @@ our $existing_package = 'dpkg'; our $cleanmode; our $changes_since_version; our $rmchanges; +our $keep_playground; our $overwrite_version; # undef: not specified; '': check changelog our $quilt_mode; our $quilt_upstream_commitish; @@ -8094,6 +8095,9 @@ sub parseopts () { push @ropts, $_; $v =~ s#^(?!refs/)#refs/heads/#; $internal_object_save{$k} = $v; + } elsif (m/^--(no-)?keep-playground$/s) { + push @ropts, $_; + $keep_playground = !$1; } elsif (m/^--(no-)?rm-old-changes$/s) { push @ropts, $_; $rmchanges = !$1; @@ -8318,4 +8322,7 @@ my $fn = ${*::}{"cmd_$cmd"}; $fn or badusage f_ "unknown operation %s", $orig_cmd; $fn->(); +changedir '/'; # rmtree complains if our cwd is inside what we remove +rmtree $playground if defined($playground) && !$keep_playground; + finish 0; diff --git a/dgit.1 b/dgit.1 index aeeaa64..f03f734 100644 --- a/dgit.1 +++ b/dgit.1 @@ -1159,6 +1159,15 @@ Obsolete alias for --dep14tag, retained for compatibility. Prints debugging information to stderr. Repeating the option produces more output (currently, up to -DDDD is meaningfully different). .TP +.BR \-\-keep\-playground | \-\-no\-\-keep\-playground +Controls whether to retain the "playground" working directory +.B .git/dgit/unpack +even on success, +for examination and debugging. +The default is +.B \-\-no\-keep\-playground +which deletes the directory after a successful execution. +.TP .BI -c name = value Specifies a git configuration option, to be used for this run. dgit itself is also controlled by git configuration options. -- cgit v1.2.3