@@ -410,6 +410,49 @@ func TestGitGetter_GetFile(t *testing.T) {
410410 assertContents (t , dst , "hello" )
411411}
412412
413+ func TestGitGetter_githubGetWithFileMode (t * testing.T ) {
414+ if ! testHasGit {
415+ t .Skip ("git not found, skipping" )
416+ }
417+
418+ dst := tempTestFile (t )
419+ defer os .RemoveAll (filepath .Dir (dst ))
420+
421+ c := Client {
422+ Src : "git::https://github.com/arikkfir/go-getter/testdata/basic/foo/main.tf?ref=master" ,
423+ Dst : dst ,
424+ Mode : ClientModeFile ,
425+ }
426+ if err := c .Get (); err != nil {
427+ t .Fatalf ("err: %s" , err )
428+ }
429+
430+ // Verify the main file exists
431+ if _ , err := os .Stat (dst ); err != nil {
432+ t .Fatalf ("err: %s" , err )
433+ }
434+ assertContents (t , dst , "# Hello\n " )
435+ }
436+
437+ func TestGitGetter_githubGetFile (t * testing.T ) {
438+ if ! testHasGit {
439+ t .Skip ("git not found, skipping" )
440+ }
441+
442+ dst := tempTestFile (t )
443+ defer os .RemoveAll (filepath .Dir (dst ))
444+
445+ if err := GetFile (dst , "git::https://github.com/arikkfir/go-getter/testdata/basic/foo/main.tf?ref=master" ); err != nil {
446+ t .Fatalf ("err: %s" , err )
447+ }
448+
449+ // Verify the main file exists
450+ if _ , err := os .Stat (dst ); err != nil {
451+ t .Fatalf ("err: %s" , err )
452+ }
453+ assertContents (t , dst , "# Hello\n " )
454+ }
455+
413456func TestGitGetter_gitVersion (t * testing.T ) {
414457 if ! testHasGit {
415458 t .Skip ("git not found, skipping" )
0 commit comments