shithub: git9

Download patch

ref: 26f165c02bff58b15564e77309a5e147ecda388c
parent: 65b772ed948f2841733f44eefc1f1f7df413c68a
author: Ori Bernstein <[email protected]>
date: Fri Nov 15 17:30:49 EST 2019

Allow configuring the editor in git.

Preference is `{git/conf core.editor}, followed by $editor, followed
by sam.

--- a/commit
+++ b/commit
@@ -45,7 +45,12 @@
 	echo '# Commit message goes here.' >> $msgfile.tmp
 	echo '# Author: '$name' <'$email'>' >> $msgfile.tmp
 	echo '#' $nl'# ' ^ `$nl{git/walk -fAMR} >> $msgfile.tmp
-	sam $msgfile.tmp
+	giteditor=`{git/conf core.editor}
+	if(~ $#editor 0)
+		editor=$giteditor
+	if(~ $#editor 0)
+		editor=sam
+	$editor $msgfile.tmp
 	if(~ `{grep -v '^[ 	]*($|#.*$)' $msgfile.tmp | wc -l} 0)
 		die 'empty commit message'
 	grep -v '^[ 	]*#' < $msgfile.tmp > $msgfile
--- a/common.rc
+++ /dev/null
@@ -1,20 +1,0 @@
-nl='
-'
-
-fn die{
-	>[1=2] echo $0: $*
-	exit $"*
-}
-
-fn usage{
-	>[1=2] echo -n 'usage:' $usage
-	exit 'usage'
-}
-
-fn gitup{
-	gitroot=`{git/conf -r >[2]/dev/null}
-	if(~ $#gitroot 0)
-		die 'not a git repository'
-	cd $gitroot
-	git/fs
-}