]>
Commit | Line | Data |
---|---|---|
1 | #include "describe_helpers.h" | |
2 | ||
3 | #include "wildmatch.h" | |
4 | ||
5 | void assert_describe( | |
6 | const char *expected_output, | |
7 | const char *revparse_spec, | |
8 | git_repository *repo, | |
9 | git_describe_options *opts, | |
10 | git_describe_format_options *fmt_opts) | |
11 | { | |
12 | git_object *object; | |
13 | git_buf label = GIT_BUF_INIT; | |
14 | git_describe_result *result; | |
15 | ||
16 | cl_git_pass(git_revparse_single(&object, repo, revparse_spec)); | |
17 | ||
18 | cl_git_pass(git_describe_commit(&result, object, opts)); | |
19 | cl_git_pass(git_describe_format(&label, result, fmt_opts)); | |
20 | ||
21 | cl_must_pass(wildmatch(expected_output, git_buf_cstr(&label), 0)); | |
22 | ||
23 | git_describe_result_free(result); | |
24 | git_object_free(object); | |
25 | git_buf_dispose(&label); | |
26 | } | |
27 | ||
28 | void assert_describe_workdir( | |
29 | const char *expected_output, | |
30 | git_repository *repo, | |
31 | git_describe_options *opts, | |
32 | git_describe_format_options *fmt_opts) | |
33 | { | |
34 | git_buf label = GIT_BUF_INIT; | |
35 | git_describe_result *result; | |
36 | ||
37 | cl_git_pass(git_describe_workdir(&result, repo, opts)); | |
38 | cl_git_pass(git_describe_format(&label, result, fmt_opts)); | |
39 | ||
40 | cl_must_pass(wildmatch(expected_output, git_buf_cstr(&label), 0)); | |
41 | ||
42 | git_describe_result_free(result); | |
43 | git_buf_dispose(&label); | |
44 | } |