From: Alex Musolino <alex@musolino.id.au>
To: 9front@9front.org
Subject: [9front] Git/revert abs path handling
Date: Fri, 18 Jun 2021 18:56:23 +0930 [thread overview]
Message-ID: <4FE606B4AC47DBAA8A1D8CCA1A78A79E@musolino.id.au> (raw)
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 ''
next reply other threads:[~2021-06-18 9:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-18 9:26 Alex Musolino [this message]
2021-06-18 10:50 ` kvik
2021-06-20 11:35 ` Alex Musolino
2021-06-20 13:25 ` ori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FE606B4AC47DBAA8A1D8CCA1A78A79E@musolino.id.au \
--to=alex@musolino.id.au \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).