hlfw.ca

task

Download patch

ref: 156d0b3f8f89cb2b8f5ea79304dc63c24b6d1cda
parent: 3aed440807d578c3fab5bc705864ac4c2650800f
author: Michael Misch <michaelmisch1985@gmail.com>
date: Thu Aug 29 22:59:02 PDT 2024

Use hold editor correctly on -c

--- a/task
+++ b/task
@@ -14,9 +14,16 @@
 		}
 		edit=1
 	}
-	if(~ $#editor 0)
-		editor=hold
-	$editor $msgfile.tmp
+	if(! ~ $#edit 0){
+		if(~ $#editor 0)
+			editor=hold
+		$editor $msgfile.tmp
+	}
+	cat $msgfile.tmp >> $msgfile
+	if(! test -s $msgfile){
+		echo 'empty commit message' >[1=2]
+		exit 'message'
+	}
 }
 
 fn gettag{
@@ -28,7 +35,7 @@
 }
 
 fn finish{
-	cp $msgfile.tmp .pro/task/$tag
+	cp $msgfile .pro/task/$tag
 	# TODO: . common.rc to set $project, as it's useful for our outputs
 	#echo '$project:$tag'
 }
@@ -48,7 +55,7 @@
 	data=`{echo $*}
 if(! ~ $#change 0 )
 	if(test -s .pro/task/$change){
-		cat .pro/task/$change > $msgfile.tmp
+		cat .pro/task/$change > $msgfile
 		if(! ~ $#data 0)
 			echo $data >> $msgfile.tmp
 	}