ref: abc6e8ee6b71a79e7bfe5926132cd2302860ffe6
parent: 044d3e74eb7be6c3c9bb9b7a39d04c731467d109
author: Ori Bernstein <[email protected]>
date: Sat Dec 23 14:59:25 EST 2023
git/log: ensure we're starting to log from a commit hash
--- a/sys/src/cmd/git/log.c
+++ b/sys/src/cmd/git/log.c
@@ -207,6 +207,8 @@
sysfatal("resolve %s: %r", c);
if((o = readobject(h)) == nil)
sysfatal("load %H: %r", h);
+ if(o->type != GCommit)
+ sysfatal("%s: not a commit", c);
qinit(&objq);
osinit(&done);
qput(&objq, o, 0);
@@ -291,5 +293,6 @@
showquery(queryexpr);
else
showcommits(commitid);
+ Bterm(out);
exits(nil);
}
--- a/sys/src/cmd/git/util.c
+++ b/sys/src/cmd/git/util.c
@@ -351,6 +351,7 @@
Qelt t;
int i;
+ assert(o->type == GCommit);
if(q->nheap == q->heapsz){
q->heapsz *= 2;
q->heap = earealloc(q->heap, q->heapsz, sizeof(Qelt));