ref: b37238edb8f86809cdb395c235f9f2cc3f24d388
parent: 96c4dbca89cd709d076767e0629f2061d980b671
author: Jacob Moody <moody@posixcafe.org>
date: Sat May 18 14:07:46 EDT 2024
vdiff: show filename instead of "/dev/null" when removing entire file
--- a/sys/src/cmd/vdiff.c
+++ b/sys/src/cmd/vdiff.c
@@ -546,8 +546,11 @@
case Lfile:
if(s[0] == '-'){
b = addblock();
- if(strncmp(s+4, "a/", 2) == 0)
+ b->f = s+4;
+ if(strncmp(b->f, "a/", 2) == 0){
ab = 1;
+ b->f++;
+ }
}else if(s[0] == '+'){
f = s+4;
if(ab && strncmp(f, "b/", 2) == 0){
@@ -558,7 +561,8 @@
tab = strchr(f, '\t');
if(tab != nil)
*tab = 0;
- b->f = f;
+ if(strcmp(f, "/dev/null") != 0)
+ b->f = f;
}
break;
case Lsep: