55%macro mp_gitlog(gitdir,outds=work.mp_gitlog,mdebug=0,filter=BRANCHONLY,nobs=0);
58%let varlist=author children_ids committer committer_email email
id
59 in_current_branch parent_ids stash time ;
62 LENGTH gitdir branch $ 1024 message $4000 &varlist $128 commit_time_num 8.
64 call missing (of _all_);
65 branch=
"%mf_getgitbranch(&gitdir)";
66 gitdir=symget(
'gitdir');
67 rc=git_status_free(trim(gitdir));
69 put
"The libgit2 library is unavailable and no Git operations can be used.";
70 put
"See: https://stackoverflow.com/questions/74082874";
73 else if rc=-2 then
do;
74 put
"The libgit2 library is available, but the status function failed.";
75 put
"See the log for details.";
78 entries=git_commit_log(trim(gitdir));
81 %
do i=1 %to %sysfunc(countw(&varlist message));
82 %let var=%scan(&varlist message,&i,%str( ));
83 rc=git_commit_get(n,trim(gitdir),
"&var",&var);
87 format commit_time_num datetime19.;
88 commit_time_num=sum(input(cats(time),best.),315619200);
89 commit_time_str=put(commit_time_num,datetime19.);
90 %
if &mdebug=1 %then %
do;
93 if "&filter"=
"BRANCHONLY" then
do;
94 if cats(in_current_branch)=
'TRUE' then output;
97 %
if &nobs>0 %then %
do;
98 if n ge &nobs then stop;
101 rc=git_commit_free(trim(gitdir));
102 keep gitdir branch &varlist message time commit_time_num commit_time_str;