<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Stage all files at once using GIT_INDEX_ADD? in SAS Viya</title>
    <link>https://communities.sas.com/t5/SAS-Viya/Stage-all-files-at-once-using-GIT-INDEX-ADD/m-p/806281#M1379</link>
    <description>&lt;P&gt;The asterisk is a shell function that expands to all files in a given path. For example if you run "echo *", the shell will return a list of all files. So git add is still being given all the file names, we just need to replicate that * behavior.&lt;BR /&gt;I think what you'd want to do is create a data set of all files in a given path, then use the data step to run git_index_add on each of them. The way I've done this in the past is here (creating a dataset called dirlist from the path defined in the macro variable &amp;amp;path). This does require XCMD so we can run the ls command.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename DIRLIST pipe "ls &amp;amp;path";
data dirlist;
infile dirlist lrecl=200 truncover;
input file_name $100.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;I think you could then add a "set dirlist;" to your data _null_ data step, and instead of "your-file" use file_name.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Apr 2022 13:50:27 GMT</pubDate>
    <dc:creator>gwootton</dc:creator>
    <dc:date>2022-04-06T13:50:27Z</dc:date>
    <item>
      <title>Stage all files at once using GIT_INDEX_ADD?</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Stage-all-files-at-once-using-GIT-INDEX-ADD/m-p/806146#M1378</link>
      <description>&lt;P&gt;Hi there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the function GIT_INDEX_ADD to stage files in a local git repo and it is working fine using the following snippet from &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n0xgvzmg1knw9an11pjcd59ex35i.htm" target="_self"&gt;SAS Viya 3.5 documentation.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data _null_;
   n = git_status("your-repository");                                      /**/
   rc = git_index_add("your-repository", "your-file", "file-attribute");   /**/
   rc = git_status_free("your-repository")
   n = git_status("your-repository");                                      /**/
run;&lt;/PRE&gt;&lt;P&gt;The thing is I want to stage all files in the repo without previous knowledge of the filename like the git CLI command "&amp;nbsp;&lt;FONT face="andale mono,times" color="#000000"&gt;git add *&amp;nbsp;&lt;/FONT&gt;"&amp;nbsp; does.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone knows if this is possible using SAS StudioV for Viya 3.5?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 20:23:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Stage-all-files-at-once-using-GIT-INDEX-ADD/m-p/806146#M1378</guid>
      <dc:creator>alisio_meneses</dc:creator>
      <dc:date>2022-04-05T20:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: Stage all files at once using GIT_INDEX_ADD?</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Stage-all-files-at-once-using-GIT-INDEX-ADD/m-p/806281#M1379</link>
      <description>&lt;P&gt;The asterisk is a shell function that expands to all files in a given path. For example if you run "echo *", the shell will return a list of all files. So git add is still being given all the file names, we just need to replicate that * behavior.&lt;BR /&gt;I think what you'd want to do is create a data set of all files in a given path, then use the data step to run git_index_add on each of them. The way I've done this in the past is here (creating a dataset called dirlist from the path defined in the macro variable &amp;amp;path). This does require XCMD so we can run the ls command.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename DIRLIST pipe "ls &amp;amp;path";
data dirlist;
infile dirlist lrecl=200 truncover;
input file_name $100.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;I think you could then add a "set dirlist;" to your data _null_ data step, and instead of "your-file" use file_name.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 13:50:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Stage-all-files-at-once-using-GIT-INDEX-ADD/m-p/806281#M1379</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2022-04-06T13:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: Stage all files at once using GIT_INDEX_ADD?</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Stage-all-files-at-once-using-GIT-INDEX-ADD/m-p/806399#M1380</link>
      <description>&lt;P&gt;Hi there&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/78975"&gt;@gwootton&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sadly I lack the privilege needed to run XCMD commands so I had to adapt your suggestion a bit and ended up with a script that does the same thing but doesn't use XCMD command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/* Create dataset containing list of files */&lt;BR /&gt;data dirlist;
	length fref $8 fname $200;
	did=filename(fref, "/git_repo_folder");
	did=dopen(fref);

	do i=1 to dnum(did);
		fname=dread(did, i);
		output;
	end;
	did=dclose(did);
	did=filename(fref);
	keep fname;
run;

/* Add list of files to index */
data _null_;
   set dirlist;
   rc = git_index_add("/git_repo_folder", fname, "new");
   n = git_status_free("/git_repo_folder");
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&amp;nbsp;Your tip was very helpful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 21:00:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Stage-all-files-at-once-using-GIT-INDEX-ADD/m-p/806399#M1380</guid>
      <dc:creator>alisio_meneses</dc:creator>
      <dc:date>2022-04-06T21:00:26Z</dc:date>
    </item>
  </channel>
</rss>

