summaryrefslogtreecommitdiff
path: root/src/parse.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2019-10-18 12:14:19 +0200
committerPatrick Steinhardt <ps@pks.im>2019-10-18 12:26:56 +0200
commit8532ed11848092d816aecc2d34d1bb432a525df9 (patch)
tree52f488f1ce7e5113f3ad83b3ee549b3173fac0ba /src/parse.c
parentd8233feb78d10ade39fd64b85044fea84f2fc293 (diff)
downloadlibgit2-8532ed11848092d816aecc2d34d1bb432a525df9.tar.gz
refdb_fs: convert reflog parsing to use parser
The refdb_fs code to parse the reflog currently uses a hand-rolled parser. Convert it to use our `git_parse_ctx` structure instead.
Diffstat (limited to 'src/parse.c')
-rw-r--r--src/parse.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/parse.c b/src/parse.c
index b04fda36b..0a10758bf 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -101,6 +101,16 @@ int git_parse_advance_digit(int64_t *out, git_parse_ctx *ctx, int base)
return 0;
}
+int git_parse_advance_oid(git_oid *out, git_parse_ctx *ctx)
+{
+ if (ctx->line_len < GIT_OID_HEXSZ)
+ return -1;
+ if ((git_oid_fromstrn(out, ctx->line, GIT_OID_HEXSZ)) < 0)
+ return -1;
+ git_parse_advance_chars(ctx, GIT_OID_HEXSZ);
+ return 0;
+}
+
int git_parse_peek(char *out, git_parse_ctx *ctx, int flags)
{
size_t remain = ctx->line_len;