summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2024-02-09 01:27:58 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2024-02-09 01:46:02 +0000
commit06c5ba727347fc492530e0dc0606164983d4a316 (patch)
tree05253bead7c5f2262924a02460488e3da038af05
parent2f41198eceecdf4d478701ad5512b2bf9e6efce4 (diff)
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 <ijackson@chiark.greenend.org.uk>
-rwxr-xr-xdgit7
-rw-r--r--dgit.19
2 files changed, 16 insertions, 0 deletions
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.