git/diff: clean up diffs

We were overzealous about showing the changed
header, as well as setting a junk variable for
files that didn't exist; fix both.
This commit is contained in:
Ori Bernstein 2021-08-23 01:22:04 +00:00
parent 9a69a2bf2a
commit fb2e0a1987

View file

@ -26,16 +26,22 @@ fn lsdirty {
git/query -c $commit HEAD | subst '^..' git/query -c $commit HEAD | subst '^..'
} }
showed=()
mntgen /mnt/scratch mntgen /mnt/scratch
bind $branch/tree/ /mnt/scratch/a bind $branch/tree/ /mnt/scratch/a
bind . /mnt/scratch/b bind . /mnt/scratch/b
echo diff `{git/query $commit} uncommitted
for(f in `$nl{lsdirty | sort | uniq}){ for(f in `$nl{lsdirty | sort | uniq}){
if(~ $#showed 0){
echo diff `{git/query $commit} uncommitted
showed=1
}
cd /mnt/scratch cd /mnt/scratch
a=a/$f
b=b/$f
if(! test -f a/$f) if(! test -f a/$f)
orig=/dev/null a=/dev/null
if(! test -f b/$f) if(! test -f b/$f)
f=/dev/null b=/dev/null
diff -u a/$f b/$f diff -u $a $b
} }
exit '' exit ''