9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Michael Forney <mforney@mforney.org>
To: 9front@9front.org
Subject: [9front] [PATCH] git/query: leave range commits in topological order
Date: Sun, 23 Jan 2022 00:39:21 +0000	[thread overview]
Message-ID: <81393E6026E97B03CBD1F42837BCCE28@arrow> (raw)


This prevents commits from getting reordered incorrectly during rebase
or export.
---
diff 108d74cb0a8d27e82550d2772ae64fd7748e151d bb59fa1f40b5e5756639480fc08e0f33c7e19019
--- a/sys/src/cmd/git/ref.c	Fri Jan  7 02:37:02 2022
+++ b/sys/src/cmd/git/ref.c	Sat Jan 22 16:39:21 2022
@@ -51,26 +51,6 @@
 		ev->p++;
 }
 
-int
-objdatecmp(void *pa, void *pb)
-{
-	Object *a, *b;
-	int r;
-
-	a = readobject((*(Object**)pa)->hash);
-	b = readobject((*(Object**)pb)->hash);
-	assert(a->type == GCommit && b->type == GCommit);
-	if(a->commit->mtime == b->commit->mtime)
-		r = 0;
-	else if(a->commit->mtime < b->commit->mtime)
-		r = -1;
-	else
-		r = 1;
-	unref(a);
-	unref(b);
-	return r;
-}
-
 void
 push(Eval *ev, Object *o)
 {
@@ -406,7 +386,7 @@
 range(Eval *ev)
 {
 	Object *a, *b, *p, *q, **all;
-	int nall, *idx, mark;
+	int nall, *idx;
 	Objset keep, skip;
 
 	b = pop(ev);
@@ -424,7 +404,6 @@
 	all = nil;
 	idx = nil;
 	nall = 0;
-	mark = ev->nstk;
 	osinit(&keep);
 	osinit(&skip);
 	osadd(&keep, a);
@@ -459,7 +438,6 @@
 		nall++;
 	}
 	free(all);
-	qsort(ev->stk + mark, ev->nstk - mark, sizeof(Object*), objdatecmp);
 	return 0;
 error:
 	free(all);

             reply	other threads:[~2022-01-23  0:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23  0:39 Michael Forney [this message]
2022-01-23 15:17 ` ori
2022-01-23 15:29   ` hiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81393E6026E97B03CBD1F42837BCCE28@arrow \
    --to=mforney@mforney.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).