code: plan9front

Download patch

ref: 7bc6d45519b844f363c6dd40874210f56934a337
parent: 5d68e51152a9a8f23a3aee53fae8ea83fc49929a
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Oct 27 16:38:22 EDT 2023

git/diff: make '-u' flag imply '-s'

Without '-s', '-u' makes no sense: it acts like
a weird version of cat that prepends each line
with '+'.

--- a/sys/src/cmd/git/diff
+++ b/sys/src/cmd/git/diff
@@ -20,7 +20,7 @@
 	files=`{cleanname -d $gitrel $*}
 
 branch=`{git/query -p $commit}
-if(~ $summarize 1){
+if(~ $summarize 1 || ~ $uncommitted 1){
 	git/walk -f$filt $cparam $files
 	exit
 }
--- a/sys/src/cmd/git/walk.c
+++ b/sys/src/cmd/git/walk.c
@@ -299,6 +299,8 @@
 {
 	int i;
 
+	if(p == nil)
+		return 0;
 	if(npfx == 0)
 		return 1;
 	for(i = 0; i < npfx; i++){