shithub: git9

Download patch

ref: 118584c48da15d064d7df58dc7c4e481a18ebb77
parent: bd922f097ffe0f87aeec9e96054d9ab276a5cc82
author: Michael Forney <mforney@mforney.org>
date: Thu Feb 4 00:34:19 EST 2021

git/query: use chronological order for range operator

Rather than using reverse-chronological order and reversing again with
git/query -r, make the range operator output commits in chronological
order to begin with.

This fixes the patch order from git/export when given particular
commits on the command-line.

--- a/export
+++ b/export
@@ -19,7 +19,7 @@
 q=$*
 if(~ $#q 0)
 	q=HEAD
-commits=`{git/query -r $q || die $status}
+commits=`{git/query $q || die $status}
 n=1
 m=$#commits
 
--- a/rebase
+++ b/rebase
@@ -31,7 +31,7 @@
 		exec aux/usage
 	src=`{git/branch}
 	dst=`{git/query $1}
-	commits=`{git/query -r $dst $src @ .. $src}
+	commits=`{git/query $dst $src @ .. $src}
 	## TODO: edit $commits here for -i
 	git/branch -nb $dst $tmp
 }
--- a/ref.c
+++ b/ref.c
@@ -56,7 +56,7 @@
 	assert(a->type == GCommit && b->type == GCommit);
 	if(a->commit->mtime == b->commit->mtime)
 		return 0;
-	else if(a->commit->mtime > b->commit->mtime)
+	else if(a->commit->mtime < b->commit->mtime)
 		return -1;
 	else
 		return 1;