diff --git a/sys/src/cmd/git/branch b/sys/src/cmd/git/branch index bf2027cc7..6693d7c4f 100755 --- a/sys/src/cmd/git/branch +++ b/sys/src/cmd/git/branch @@ -100,8 +100,10 @@ for(m in $cleanpaths){ rm -rf .git/index9/tracked/$m } if(~ $b file){ - cp -x $basedir/tree/$m $m - walk -eq $m > .git/index9/tracked/$m + if(cp -x -- $basedir/tree/$m $m) + walk -eq $m > .git/index9/tracked/$m + if not + echo -n > .git/index9/tracked/$m } } diff --git a/sys/src/cmd/git/revert b/sys/src/cmd/git/revert index a516e3a9d..0f11d82a9 100644 --- a/sys/src/cmd/git/revert +++ b/sys/src/cmd/git/revert @@ -14,7 +14,9 @@ if(~ $#query 1) files=`$nl{cleanname -d $gitrel $*} for(f in `$nl{cd $commit/tree/ && walk -f $files}){ mkdir -p `{basename -d $f} - cp -x -- $commit/tree/$f $f - git/add $f + if(cp -x -- $commit/tree/$f $f) + walk -eq $m > .git/index9/tracked/$m + if not + echo -n > .git/index9/tracked/$m } exit ''