shithub: riscv

Download patch

ref: 4567ed717807262c9c46ba9d0f32fda2597ba812
parent: bf645afaac246967b9590ae7463f243c11d97480
author: ori <ori@bonesaw>
date: Thu Jan 1 02:50:09 EST 2009

git/merge: include files changed in the merged commits

--- a/sys/src/cmd/git/commit
+++ b/sys/src/cmd/git/commit
@@ -120,8 +120,10 @@
 }
 
 files=()
+if(test -f .git/index9/merge-parents)
+	files=`$nl{git/query -c `{cat .git/index9/merge-parents} | sed 's/^..//g'}
 if(! ~ $#* 0)
-	files=`$nl{git/walk -c `$nl{cleanname -d $gitrel $*}}
+	files=($files `$nl{git/walk -c `$nl{cleanname -d $gitrel $*}})
 if(~ $status '' || ~ $#files 0 && ! test -f .git/index9/merge-parents && ~ $#revise 0)
 	die 'nothing to commit' $status
 @{
--- a/sys/src/cmd/git/query.c
+++ b/sys/src/cmd/git/query.c
@@ -186,9 +186,8 @@
 	if((n = resolverefs(&h, query)) == -1)
 		sysfatal("resolve: %r");
 	if(changes){
-		if(n != 2)
-			sysfatal("diff: need 2 commits, got %d", n);
-		diffcommits(h[0], h[1]);
+		for(i = 1; i < n; i++)
+			diffcommits(h[0], h[i]);
 	}else{
 		p = (fullpath ? objpfx : "");
 		for(j = 0; j < n; j++)
--- a/sys/src/cmd/git/test/merge.rc
+++ b/sys/src/cmd/git/test/merge.rc
@@ -45,7 +45,7 @@
 		cd b
 		qq $G/pull
 		$G/merge origin/front || status=''
-		q $G/commit -m merged .
+		q $G/commit -m merged
 	}
 }
 
@@ -56,6 +56,7 @@
 test -x b/a || die merge preserve exec
 ! test -x b/b || die merge preserve nonexec b
 ! test -x b/c || die merge preserve nonexec c
+@{rfork ne ; cd b ; git/fs; git/walk -q} || die merge commit dropped files
 
 echo @@ merge concurent edits @@
 @{