summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2021-08-23 01:22:04 +0000
committerOri Bernstein <ori@eigenstate.org>2021-08-23 01:22:04 +0000
commitfb2e0a1987b33083e3e08fa0659f99534c56d6aa (patch)
treeb3d1e006e74650c64bdb46d95f292357f40954d4
parent9a69a2bf2a13d89a30d863dcb19198eef2f564a3 (diff)
downloadplan9front-fb2e0a1987b33083e3e08fa0659f99534c56d6aa.tar.xz
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.
-rw-r--r--sys/src/cmd/git/diff14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/src/cmd/git/diff b/sys/src/cmd/git/diff
index 64206c4a7..28e69d660 100644
--- a/sys/src/cmd/git/diff
+++ b/sys/src/cmd/git/diff
@@ -26,16 +26,22 @@ fn lsdirty {
git/query -c $commit HEAD | subst '^..'
}
+showed=()
mntgen /mnt/scratch
bind $branch/tree/ /mnt/scratch/a
bind . /mnt/scratch/b
-echo diff `{git/query $commit} uncommitted
for(f in `$nl{lsdirty | sort | uniq}){
+ if(~ $#showed 0){
+ echo diff `{git/query $commit} uncommitted
+ showed=1
+ }
cd /mnt/scratch
+ a=a/$f
+ b=b/$f
if(! test -f a/$f)
- orig=/dev/null
+ a=/dev/null
if(! test -f b/$f)
- f=/dev/null
- diff -u a/$f b/$f
+ b=/dev/null
+ diff -u $a $b
}
exit ''