ref: fd9679d97b0bb7b8849f84f50c708d5f733708e1
parent: 4f3437a3ccde4fadf84f6de254a141cece9ca0af
author: Ori Bernstein <[email protected]>
date: Sat Jun 5 09:40:28 EDT 2021
git: handle absolute paths better we were catting $gitrel onto absolute paths. stop it.
--- a/sys/src/cmd/git/add
+++ b/sys/src/cmd/git/add
@@ -16,17 +16,18 @@
if(~ $#* 0)
exec aux/usage
+paths=`$nl{cleanname -d $gitrel $*}
if(~ $add tracked)
- files=`$nl{walk -f $gitrel/$*}
+ files=`$nl{walk -f $paths}
if not
- files=`$nl{cd .git/index9/tracked/ && walk -f $gitrel/$*}
+ files=`$nl{cd .git/index9/tracked/ && walk -f $paths}
for(f in $files){
- if(! ~ `{cleanname $f} .git/*){
+ if(! ~ `$nl{cleanname $f} .git/*){
addpath=.git/index9/$add/$f
delpath=.git/index9/$del/$f
- mkdir -p `{basename -d $addpath}
- mkdir -p `{basename -d $delpath}
+ mkdir -p `$nl{basename -d $addpath}
+ mkdir -p `$nl{basename -d $delpath}
# We don't want a matching qid, so that
# git/walk doesn't think this came from
# a checkout.
--- a/sys/src/cmd/git/commit
+++ b/sys/src/cmd/git/commit
@@ -135,7 +135,7 @@
files=()
if(! ~ $#* 0)
- files=`$nl{git/walk -c `$nl{cleanname $gitrel/$*}}
+ files=`$nl{git/walk -c `$nl{cleanname -d $gitrel $*}}
if(~ $status '' || ~ $#files 0 && ! test -f .git/index9/merge-parents && ~ $#revise 0)
die 'nothing to commit' $status
@{
--- a/sys/src/cmd/git/diff
+++ b/sys/src/cmd/git/diff
@@ -12,7 +12,7 @@
files=()
if(! ~ $#* 0)
- files=`{cleanname $gitrel/$*}
+ files=`{cleanname -d $gitrel $*}
branch=`{git/query -p $commit}
if(~ $summarize 1){