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