shithub: git9

Download patch

ref: b305bb74762ba253ab2f477c8559605a6525bcc1
parent: 8d83bc1e1b0b2ceb3d366ffb297ae15e7eb8846f
author: Ori Bernstein <[email protected]>
date: Sun Aug 30 22:01:37 EDT 2020

git/push, proto: improve debugging

add -d flag to git/push, make proto text line up better.

--- a/proto.c
+++ b/proto.c
@@ -43,7 +43,7 @@
 		return -1;
 	buf[n] = 0;
 	if(chattygit)
-		fprint(2, "readpkt: %s:\t%.*s\n", len, nbuf, buf);
+		fprint(2, "<= %s:\t%.*s\n", len, nbuf, buf);
 	return n;
 }
 
@@ -59,7 +59,7 @@
 	if(write(c->wfd, buf, nbuf) != nbuf)
 		return -1;
 	if(chattygit){
-		fprint(2, "writepkt: %s:\t", len);
+		fprint(2, "=> %s:\t", len);
 		write(2, buf, nbuf);
 		write(2, "\n", 1);
 	}
--- a/push
+++ b/push
@@ -4,7 +4,7 @@
 
 gitup
 
-flagfmt='a:pushall, b:branch branch, f:force,
+flagfmt='a:pushall, b:branch branch, f:force, d:debug,
          r:remove remove, u:upstream upstream' args=''
 eval `''{aux/getflags $*} || exec aux/usage
 if(! ~ $#* 0)
@@ -18,6 +18,8 @@
 	die 'no branches'
 if(~ $force 1)
 	force=-f
+if(~ $#debug 1)
+	debug='-d'
 
 if(~ $#upstream 0)
 	upstream=origin
@@ -28,7 +30,7 @@
 branch=-b^$branch
 if(! ~ $#remove 0)
 	remove=-r^$remove
-updates=`$nl{git/send $force $branch $remove $remote || die $status}
+updates=`$nl{git/send $debug $force $branch $remove $remote || die $status}
 for(ln in $updates){
 	u=`{echo $ln}
 	refpath=`{echo $u(2) | subst '^refs/heads/' '.git/refs/remotes/'$upstream'/'}