shithub: git9

Download patch

ref: 221e7c96b417e63b291f83714d9dbcbb253a2e4b
parent: b4838c1b5b5e07ca01e9644cbd55fc5b40116a6e
author: Ori Bernstein <[email protected]>
date: Sat Dec 5 14:17:30 EST 2020

git/clone: clean up on interrupt

When cancelling cloning a repo, we would
leave some trash kicking around the file
system.

Instead, clean up when exiting due to an
interrupt.

--- a/clone
+++ b/clone
@@ -98,6 +98,12 @@
 	}
 }
 
+fn sigint {
+	echo cancelled clone $remote: cleaning $local >[1=2]
+	rm -rf $local
+	exit interrupted
+}
+
 @{clone}
 st=$status
 if(! ~ $st ''){