summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2023-12-23 19:59:25 +0000
committerOri Bernstein <ori@eigenstate.org>2023-12-23 19:59:25 +0000
commitabc6e8ee6b71a79e7bfe5926132cd2302860ffe6 (patch)
treebb4c1b76404a1d8f21feb8b83d9c77d39282501e
parent044d3e74eb7be6c3c9bb9b7a39d04c731467d109 (diff)
git/log: ensure we're starting to log from a commit hash
-rw-r--r--sys/src/cmd/git/log.c3
-rw-r--r--sys/src/cmd/git/util.c1
2 files changed, 4 insertions, 0 deletions
diff --git a/sys/src/cmd/git/log.c b/sys/src/cmd/git/log.c
index 6f2ee0126..97d71a350 100644
--- a/sys/src/cmd/git/log.c
+++ b/sys/src/cmd/git/log.c
@@ -207,6 +207,8 @@ showcommits(char *c)
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 @@ main(int argc, char **argv)
showquery(queryexpr);
else
showcommits(commitid);
+ Bterm(out);
exits(nil);
}
diff --git a/sys/src/cmd/git/util.c b/sys/src/cmd/git/util.c
index a88724f83..d53b0b7de 100644
--- a/sys/src/cmd/git/util.c
+++ b/sys/src/cmd/git/util.c
@@ -351,6 +351,7 @@ qput(Objq *q, Object *o, int color)
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));