Skip to content

Commit 4836d5b

Browse files
committed
directory checks have been modified by adding 'nul' at the pathname in order to deal with directories as they would be as files, capture(s) mkdir has been added.
1 parent b71a098 commit 4836d5b

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

git.ado

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@ syntax anything(name=gitArgs id="git command and arguments")
3434
local rmdirCmd = "rmdir /Q /S"
3535
}
3636

37-
/*
38-
Make the git program dir if not there and cd to it
39-
*/
40-
capture confirm file "`gitDir'"
37+
/* Make the git program dir if not there and cd to it */
38+
/* use /nul to deal with the directory as it would be a file (for stata) */
39+
capture confirm file "`gitDir'/nul"
4140
if _rc!=0{
42-
mkdir "`gitDir'"
41+
capture mkdir "`gitDir'"
4342
}
4443
qui cd "`gitDir'"
4544

@@ -81,9 +80,9 @@ syntax anything(name=gitArgs id="git command and arguments")
8180

8281
/* Create the repo */
8382
local repoDir = "`gitDir'`repoName'/"
84-
capture confirm file "`repoDir'"
83+
capture confirm file "`repoDir'/nul"
8584
if _rc!=0{
86-
mkdir "`repoDir'"
85+
capture mkdir "`repoDir'"
8786
}
8887
else{
8988
/* Return to old directory */
@@ -97,9 +96,9 @@ syntax anything(name=gitArgs id="git command and arguments")
9796
/* Copy all .ado and .sthlp files to the right directory */
9897
local programFirstLetter = lower(substr(subinstr("`repoName'","stata-","",.),1,1))
9998
local programDir = "../ado/plus/`programFirstLetter'/"
100-
capture confirm file "`programDir'"
99+
capture confirm file "`programDir'/nul"
101100
if _rc!=0{
102-
mkdir "`programDir'"
101+
capture mkdir "`programDir'"
103102
}
104103
qui cd "`repoName'"
105104
shell `copyCmd' *.ado "`adoPlusDir'`programFirstLetter'"
@@ -144,7 +143,7 @@ syntax anything(name=gitArgs id="git command and arguments")
144143

145144
/* Uninstall nukes all */
146145
if("`gitCommand'" == "uninstall"){
147-
capture confirm file "`repoName'"
146+
capture confirm file "`repoName'/nul"
148147
if _rc!=0{
149148
di as red "-`commandCamelCase'- not installed via -git- command"
150149
}

0 commit comments

Comments
 (0)