vergen_lib/
config.rs

1// Copyright (c) 2022 vergen developers
2//
3// Licensed under the Apache License, Version 2.0
4// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0> or the MIT
5// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
6// option. All files in the project carrying such notice may not be copied,
7// modified, or distributed except according to those terms.
8
9use bon::Builder;
10use getset::{CopyGetters, Getters};
11
12// Common configuration structs
13
14/// git configuration for the `describe` output
15#[derive(Builder, Clone, Copy, CopyGetters, Debug, Eq, Getters, PartialEq)]
16pub struct Describe {
17    /// Instead of using only the annotated tags, use any tag found in refs/tags namespace.
18    #[builder(default = false)]
19    #[getset(get_copy = "pub")]
20    tags: bool,
21    /// If the working tree has local modification "-dirty" is appended to it.
22    #[builder(default = false)]
23    #[getset(get_copy = "pub")]
24    dirty: bool,
25    /// Only consider tags matching the given glob pattern, excluding the "refs/tags/" prefix.
26    #[getset(get = "pub")]
27    match_pattern: Option<&'static str>,
28}
29
30/// git configuration for the `sha` output
31#[derive(Builder, Clone, Copy, CopyGetters, Debug, Eq, PartialEq)]
32pub struct Sha {
33    /// Shortens the object name to a unique prefix
34    #[builder(default = false)]
35    #[getset(get_copy = "pub")]
36    short: bool,
37}
38
39/// git configuration for the `dirty` output
40#[derive(Builder, Clone, Copy, CopyGetters, Debug, Eq, PartialEq)]
41pub struct Dirty {
42    /// Should we include/ignore untracked files in deciding whether the repository is dirty.
43    #[builder(default = false)]
44    #[getset(get_copy = "pub")]
45    include_untracked: bool,
46}