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