shithub: git9

Download patch

ref: 3654fb07a6539a64e82f7e00064fad13169bddc8
parent: 9f29420f98b7aea6cfa353c4f8f63e5ed6600c5b
author: Ori Bernstein <[email protected]>
date: Mon Apr 27 00:24:29 EDT 2020

make fast forward merges happen.

We used to error out on them spuriously -- now, we
just do the merge, and omit the commit parents.

--- a/merge
+++ b/merge
@@ -1,4 +1,4 @@
-#!/bin/rc
+#!/bin/rc -e
 rfork ne
 . /sys/lib/git/common.rc
 
@@ -37,11 +37,18 @@
 ours=`{git/query HEAD}
 base=`{git/query $theirs ^ ' ' ^ $ours ^ '@'}
 
-if(~ $base $ours || ~ $base $theirs)
+if(~ $base $theirs)
 	die 'nothing to merge, doofus'
 if(! git/walk -q)
 	die 'dirty work tree, refusing to merge'
+if(~ $base $ours){
+	>[1=2] echo 'fast forwarding...'
+	echo $theirs > .git/refs/`{git/branch}
+	git/revert .
+	exit ''
+}
 echo $ours >> .git/index9/merge-parents
 echo $theirs >> .git/index9/merge-parents
 
 merge /mnt/git/object/$ours /mnt/git/object/$base /mnt/git/object/$theirs
+>[1=2] echo 'merge complete: remember to commit'