shithub: git9

Download patch

ref: f618f707ba822d0096febc40844810def7ab59cf
parent: 84677cc592bd50031c1af964faad2fb0a40423ee
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Mar 18 21:06:15 EDT 2020

include all changed files when diffing against a commit

--- a/diff
+++ b/diff
@@ -9,11 +9,11 @@
 gitup
 
 files=()
-branch=()
 summarize=()
+commit=HEAD
 while(~ $1 -* && ! ~ $1 --){
 	switch($1){
-	case -c; branch=`{git/query -p $2}; shift
+	case -c; commit=$2; shift
 	case -s; summarize=1
 	case *; usage
 	}
@@ -23,13 +23,15 @@
 	shift
 if(! ~ $#* 0)
 	files=`{cleanname $gitrel/$*}
-if(~ $#branch 0)
-	branch=`{git/query -p HEAD}
+branch=`{git/query -p $commit}
 if(~ $summarize 1){
 	git/walk -fMAR $files
 	exit
 }
-for(f in `{git/walk -c -fRMA $files}){
+dirty=`$nl{git/walk -c -fRMA $files}
+if(! ~ $commit HEAD)
+	dirty=($dirty `$nl{git/query -c $commit HEAD | sed 's/^..//'})
+for(f in $dirty){
 	orig=$branch/tree/$f
 	if(! test -f $orig)
 		orig=/dev/null