ref: abcf07e2150712d670628714b607a0edb6bab99d
parent: e3426b3cdc6e883eeea5e5f4448b1ea5b3441050
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");
}
--
⑨