shithub: git9

Download patch

ref: 520c2250d56010bb2f8d36f005a2c0d14eb23cca
parent: befc2738356f9029f6631bef93d68e3f0d65d5ef
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Oct 23 18:52:56 EDT 2019

Fix git/revert to work with deleted files.

--- /dev/null
+++ b/revert
@@ -1,0 +1,28 @@
+#!/bin/rc
+
+commit=/mnt/git/HEAD
+pfx=`{pwd}
+while(~ $1 -* && ! ~ $1 --){
+	switch($1){
+	case -c;
+		commit=`{git/query -p $2};
+		shift
+	case *;
+		echo usage: $0 [-c commit] files...
+		exit usage
+	}
+	shift
+}
+
+if(! cd `{git/conf -r}){
+	echo not a git repository >[1=2]
+	exit notgit
+}
+pfx=`{echo $pfx | sed 's@^'^`{pwd}^'@@g'}
+if(~ $#pfx 0)
+	pfx=''
+git/fs
+
+for(f in `{cd $commit/tree/ && walk -f ./$pfx/$*})
+	cp -- $commit/tree/$pfx/$f ./$pfx/$f
+