@@ -142,6 +142,41 @@ func TestDotfiles(t *testing.T) {
142
142
require .NoError (t , err )
143
143
require .Equal (t , string (b ), "wow\n " )
144
144
})
145
+
146
+ t .Run ("NestedInstallScript" , func (t * testing.T ) {
147
+ t .Parallel ()
148
+ if runtime .GOOS == "windows" {
149
+ t .Skip ("install scripts on windows require sh and aren't very practical" )
150
+ }
151
+ _ , root := clitest .New (t )
152
+ testRepo := testGitRepo (t , root )
153
+
154
+ scriptPath := filepath .Join ("script" , "setup" )
155
+ err := os .MkdirAll (filepath .Join (testRepo , "script" ), 0o750 )
156
+ require .NoError (t , err )
157
+ // nolint:gosec
158
+ err = os .WriteFile (filepath .Join (testRepo , scriptPath ), []byte ("#!/bin/bash\n echo wow > " + filepath .Join (string (root ), ".bashrc" )), 0o750 )
159
+ require .NoError (t , err )
160
+
161
+ c := exec .Command ("git" , "add" , scriptPath )
162
+ c .Dir = testRepo
163
+ err = c .Run ()
164
+ require .NoError (t , err )
165
+
166
+ c = exec .Command ("git" , "commit" , "-m" , `"add script"` )
167
+ c .Dir = testRepo
168
+ err = c .Run ()
169
+ require .NoError (t , err )
170
+
171
+ inv , _ := clitest .New (t , "dotfiles" , "--global-config" , string (root ), "--symlink-dir" , string (root ), "-y" , testRepo )
172
+ err = inv .Run ()
173
+ require .NoError (t , err )
174
+
175
+ b , err := os .ReadFile (filepath .Join (string (root ), ".bashrc" ))
176
+ require .NoError (t , err )
177
+ require .Equal (t , string (b ), "wow\n " )
178
+ })
179
+
145
180
t .Run ("InstallScriptChangeBranch" , func (t * testing.T ) {
146
181
t .Parallel ()
147
182
if runtime .GOOS == "windows" {
0 commit comments