Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mf_getgitbranch.sas
Go to the documentation of this file.
1
/**
2
@file
3
@brief Retrieves the current branch from a local GIT repo
4
@details In a local git repository, the current branch is always available in
5
the `.git/HEAD` file in a format like this: `ref: refs/heads/master`
6
7
This macro simply reads the file and returns the last word (eg `master`).
8
9
Example usage:
10
11
%let gitdir=%sysfunc(pathname(work))/core;
12
%let repo=https://github.com/sasjs/core;
13
%put source clone rc=%sysfunc(GITFN_CLONE(&repo,&gitdir));
14
15
%put The current branch is %mf_getgitbranch(&gitdir);
16
17
@param [in] gitdir The directory containing the GIT repository
18
19
<h4> SAS Macros </h4>
20
@li mf_readfile.sas
21
22
<h4> Related Macros </h4>
23
@li mp_gitadd.sas
24
@li mp_gitlog.sas
25
@li mp_gitreleaseinfo.sas
26
@li mp_gitstatus.sas
27
28
@version 9.2
29
@author Allan Bowe
30
**/
31
32
%macro mf_getgitbranch(gitdir
33
)
/*/STORE SOURCE*/
;
34
35
%scan(%mf_readfile(&gitdir/.git/HEAD),-1)
36
37
%mend mf_getgitbranch;
base
mf_getgitbranch.sas
Generated by
1.9.8
For more information visit the
Macro Core library
.