From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 18818 invoked from network); 18 Jun 2021 09:58:11 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 18 Jun 2021 09:58:11 -0000 Received: from vultr.musolino.id.au ([45.76.123.158]) by 1ess; Fri Jun 18 05:43:04 -0400 2021 Received: from 180.150.114.112 ([180.150.114.112]) by vultr; Fri Jun 18 19:26:23 +1000 2021 Message-ID: <4FE606B4AC47DBAA8A1D8CCA1A78A79E@musolino.id.au> To: 9front@9front.org From: Alex Musolino Date: Fri, 18 Jun 2021 18:56:23 +0930 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: lossless optimized core dependency manager Subject: [9front] Git/revert abs path handling Reply-To: 9front@9front.org Precedence: bulk I noticed that git/revert doesn't work if you supply it absolute path names and your cwd is not /. The following patch does the trick for me. --- //.git/fs/object/b3215c807556cdaaa0f949f1fb3f97c484ffd1da/tree/sys/src/cmd/git/revert +++ sys/src/cmd/git/revert @@ -2,6 +2,21 @@ rfork en . /sys/lib/git/common.rc +fn treewalk{@{ + if(cd $1/tree){ + shift + for(p){ + switch($p){ + case /* + wargs=($wargs ./$p) + case * + wargs=($wargs ./$gitrel/$p) + } + } + walk -f $wargs + } +}} + gitup flagfmt='c:query query' args='file ...' @@ -11,9 +26,9 @@ if(~ $#query 1) commit=`{git/query -p $query} -for(f in `$nl{cd $commit/tree/ && walk -f ./$gitrel/$*}){ - mkdir -p `{basename -d $f} - cp -- $commit/tree/$f $f - git/add $f +for(f in `$nl{treewalk $commit $*}){ + mkdir -p `{basename -d /$f} + cp -- $commit/tree/$f /$f + git/add /$f } exit ''