@@ -7,20 +7,20 @@ export istaggable
7
7
# Obtaining Git information
8
8
# #######################################################################################
9
9
"""
10
- gitdescribe(gitpath = projectdir()) -> gitstr
10
+ gitdescribe(gitpath = projectdir(); dirty_suffix = "-dirty" ) -> gitstr
11
11
12
12
Return a string `gitstr` with the output of `git describe` if an annotated git tag exists,
13
13
otherwise the current active commit id of the Git repository present
14
14
in `gitpath`, which by default is the currently active project. If the repository
15
15
is dirty when this function is called the string will end
16
- with `"_dirty" `.
16
+ with `dirty_suffix `.
17
17
18
18
Return `nothing` if `gitpath` is not a Git repository, i.e. a directory within a git
19
19
repository.
20
20
21
21
The format of the `git describe` output in general is
22
22
23
- `"TAGNAME-[NUMBER_OF_COMMITS_AHEAD-]gLATEST_COMMIT_HASH[_dirty ]"`
23
+ `"TAGNAME-[NUMBER_OF_COMMITS_AHEAD-]gLATEST_COMMIT_HASH[-dirty ]"`
24
24
25
25
If the latest tag is `v1.2.3` and there are 5 additional commits while the
26
26
latest commit hash is 334a0f225d9fba86161ab4c8892d4f023688159c, the output
@@ -41,10 +41,10 @@ julia> gitdescribe() # a tag doesn't exist
41
41
"96df587e45b29e7a46348a3d780db1f85f41de04"
42
42
43
43
julia> gitdescribe(path_to_a_dirty_repo)
44
- "3bf684c6a115e3dce484b7f200b66d3ced8b0832_dirty "
44
+ "3bf684c6a115e3dce484b7f200b66d3ced8b0832-dirty "
45
45
```
46
46
"""
47
- function gitdescribe (gitpath = projectdir ())
47
+ function gitdescribe (gitpath = projectdir (); dirty_suffix :: String = " -dirty " )
48
48
# Here we test if the gitpath is a git repository.
49
49
try
50
50
repo = LibGit2. GitRepoExt (gitpath)
@@ -61,7 +61,7 @@ function gitdescribe(gitpath = projectdir())
61
61
end
62
62
suffix = " "
63
63
if LibGit2. isdirty (repo)
64
- suffix = " _dirty "
64
+ suffix = dirty_suffix
65
65
@warn " The Git repository ('$gitpath ') is dirty! " *
66
66
" Appending $(suffix) to the commit ID."
67
67
end
0 commit comments