]>
Commit | Line | Data |
---|---|---|
3a728fb5 | 1 | #include "describe_helpers.h" |
2 | ||
22a2d3d5 UG |
3 | #include "wildmatch.h" |
4 | ||
3a728fb5 | 5 | void assert_describe( |
6 | const char *expected_output, | |
7 | const char *revparse_spec, | |
8 | git_repository *repo, | |
25345c0c | 9 | git_describe_options *opts, |
5431c46a | 10 | git_describe_format_options *fmt_opts) |
3a728fb5 | 11 | { |
12 | git_object *object; | |
3b6534b8 CMN |
13 | git_buf label = GIT_BUF_INIT; |
14 | git_describe_result *result; | |
3a728fb5 | 15 | |
16 | cl_git_pass(git_revparse_single(&object, repo, revparse_spec)); | |
17 | ||
3b6534b8 CMN |
18 | cl_git_pass(git_describe_commit(&result, object, opts)); |
19 | cl_git_pass(git_describe_format(&label, result, fmt_opts)); | |
3a728fb5 | 20 | |
e579e0f7 | 21 | cl_must_pass(wildmatch(expected_output, label.ptr, 0)); |
3a728fb5 | 22 | |
3b6534b8 | 23 | git_describe_result_free(result); |
3a728fb5 | 24 | git_object_free(object); |
ac3d33df | 25 | git_buf_dispose(&label); |
3a728fb5 | 26 | } |
fd8126e4 CMN |
27 | |
28 | void assert_describe_workdir( | |
29 | const char *expected_output, | |
fd8126e4 | 30 | git_repository *repo, |
25345c0c | 31 | git_describe_options *opts, |
5431c46a | 32 | git_describe_format_options *fmt_opts) |
fd8126e4 CMN |
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 | ||
e579e0f7 | 40 | cl_must_pass(wildmatch(expected_output, label.ptr, 0)); |
fd8126e4 CMN |
41 | |
42 | git_describe_result_free(result); | |
ac3d33df | 43 | git_buf_dispose(&label); |
fd8126e4 | 44 | } |