ref: 37f8f8e3e43a4ac6ae65609b8ae7805a04ffe6e7
parent: 5f1b9c822e13709fd6e73f281f116a8b7c802ab7
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Jun 30 19:33:51 EDT 2025
git/diff: don't use the index for diffing with a commit
--- a/sys/src/cmd/git/diff
+++ b/sys/src/cmd/git/diff
@@ -7,9 +7,11 @@
flagfmt='c:commit branch, s:summarize, u:uncommitted'; args='[file ...]'
eval `''{aux/getflags $*} || exec aux/usage+bparam=(-b $commit)
if(~ $#commit 0){commit=HEAD
cparam=()
+ bparam=()
}
files=()
@@ -21,7 +23,7 @@
branch=`{git/query -p $commit} if(~ $summarize 1 || ~ $uncommitted 1){- git/walk -r$gitrel -f$filt $cparam $files
+ git/walk $bparam -r$gitrel -f$filt $cparam $files
exit
}
@@ -29,9 +31,6 @@
mntgen /mnt/scratch
bind $branch/tree/ /mnt/scratch/a
bind . /mnt/scratch/b
-bparam=()
-if(~ $#commit 1)
- bparam=(-b $commit)
for(f in `$nl{git/walk $bparam -c -f$filt $cparam $files}){ if(~ $#showed 0){ echo diff `{git/query $commit} uncommitted--- a/sys/src/cmd/git/walk.c
+++ b/sys/src/cmd/git/walk.c
@@ -425,6 +425,7 @@
}
break;
case 'b':
+ isindexed = 0;
base = EARGF(usage());
if(resolveref(&h, base) == -1)
sysfatal("no such ref '%s'", base);@@ -613,7 +614,8 @@
nulldir(&rn);
rn.name = "INDEX9";
if(remove(".git/INDEX9") == -1)- goto Nope;
+ if(access(".git/INDEX9", AEXIST) == 0)+ goto Nope;
if(dirwstat(".git/INDEX9.new", &rn) == -1) sysfatal("rename: %r");}
--
⑨