shithub: riscv

Download patch

ref: 21075859e4f3ed93ef2a8ae072cc23d575b4549c
parent: 0339e9ac44b4aed285391727ce3d6e3e1afd173e
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jun 20 22:12:58 EDT 2021

git/revert: handle absolute paths gracefully (thanks deuteron)

when reverting files, absolute paths would get concatenated with
$gitrel; use `cleanname -d` to fix this.

--- a/sys/src/cmd/git/revert
+++ b/sys/src/cmd/git/revert
@@ -11,9 +11,10 @@
 if(~ $#query 1)
 	commit=`{git/query -p $query}
 
-for(f in `$nl{cd $commit/tree/ && walk -f ./$gitrel/$*}){
+files=`$nl{cleanname -d $gitrel $*}
+for(f in `$nl{cd $commit/tree/ && walk -f $files}){
 	mkdir -p `{basename -d $f}
-	cp -- $commit/tree/$f $f
+	cp -x -- $commit/tree/$f $f
 	git/add $f
 }
 exit ''