Skip to content

Commit e4429ba

Browse files
committed
Close #2
2 parents b71a098 + 0050ffa commit e4429ba

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

git.ado

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*! version 1.0
1+
*! version 1.1
22
version 12.0
33
capture program drop git
44
program define git
@@ -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)