@@ -30,9 +30,9 @@ import (
3030	routingutil "github.com/codefresh-io/cli-v2/pkg/util/routing" 
3131	wfutil "github.com/codefresh-io/cli-v2/pkg/util/workflow" 
3232
33- 	"github.com/argoproj-labs/argocd-autopilot/pkg/application" 
34- 	"github.com/argoproj-labs/argocd-autopilot/pkg/fs" 
35- 	"github.com/argoproj-labs/argocd-autopilot/pkg/git" 
33+ 	apapp  "github.com/argoproj-labs/argocd-autopilot/pkg/application" 
34+ 	apfs  "github.com/argoproj-labs/argocd-autopilot/pkg/fs" 
35+ 	apgit  "github.com/argoproj-labs/argocd-autopilot/pkg/git" 
3636	aputil "github.com/argoproj-labs/argocd-autopilot/pkg/util" 
3737	apicommon "github.com/argoproj/argo-events/pkg/apis/common" 
3838	eventsourcereg "github.com/argoproj/argo-events/pkg/apis/eventsource" 
@@ -53,8 +53,8 @@ import (
5353
5454type  (
5555	GitSourceCreateOptions  struct  {
56- 		InsCloneOpts         * git .CloneOptions 
57- 		GsCloneOpts          * git .CloneOptions 
56+ 		InsCloneOpts         * apgit .CloneOptions 
57+ 		GsCloneOpts          * apgit .CloneOptions 
5858		GsName               string 
5959		RuntimeName          string 
6060		RuntimeNamespace     string 
@@ -82,22 +82,22 @@ type (
8282	GitSourceEditOptions  struct  {
8383		RuntimeName  string 
8484		GsName       string 
85- 		GsCloneOpts  * git .CloneOptions 
85+ 		GsCloneOpts  * apgit .CloneOptions 
8686		Include      * string 
8787		Exclude      * string 
8888	}
8989
9090	gitSourceCalendarDemoPipelineOptions  struct  {
9191		runtimeName  string 
92- 		gsCloneOpts  * git .CloneOptions 
93- 		gsFs         fs .FS 
92+ 		gsCloneOpts  * apgit .CloneOptions 
93+ 		gsFs         apfs .FS 
9494	}
9595
9696	gitSourceGitDemoPipelineOptions  struct  {
9797		runtimeName        string 
98- 		gsCloneOpts        * git .CloneOptions 
98+ 		gsCloneOpts        * apgit .CloneOptions 
9999		gitProvider        cfgit.Provider 
100- 		gsFs               fs .FS 
100+ 		gsFs               apfs .FS 
101101		hostName           string 
102102		ingressHost        string 
103103		skipIngress        bool 
@@ -132,7 +132,7 @@ func NewGitSourceCommand() *cobra.Command {
132132
133133func  NewGitSourceCreateCommand () * cobra.Command  {
134134	var  (
135- 		gsCloneOpts  * git .CloneOptions 
135+ 		gsCloneOpts  * apgit .CloneOptions 
136136		gitProvider  cfgit.Provider 
137137		createRepo   bool 
138138		include      string 
@@ -188,17 +188,22 @@ func NewGitSourceCreateCommand() *cobra.Command {
188188		RunE : func (cmd  * cobra.Command , args  []string ) error  {
189189			ctx  :=  cmd .Context ()
190190
191- 			runtimeNamespace  :=  args [0 ]
192- 			namespace  :=  cmd .Flag ("namespace" ).Value .String ()
193- 			if  namespace  !=  ""  {
194- 				runtimeNamespace  =  namespace 
191+ 			runtimeName  :=  args [0 ]
192+ 			runtime , err  :=  getRuntime (ctx , runtimeName )
193+ 			if  err  !=  nil  {
194+ 				return  err 
195+ 			}
196+ 
197+ 			runtimeNamespace  :=  runtimeName 
198+ 			if  runtime .Metadata .Namespace  !=  nil  {
199+ 				runtimeNamespace  =  * runtime .Metadata .Namespace 
195200			}
196201
197202			return  RunGitSourceCreate (ctx , & GitSourceCreateOptions {
198203				GsCloneOpts :         gsCloneOpts ,
199204				GitProvider :         gitProvider ,
200205				GsName :              args [1 ],
201- 				RuntimeName :         args [ 0 ] ,
206+ 				RuntimeName :         runtimeName ,
202207				RuntimeNamespace :    runtimeNamespace ,
203208				CreateDemoResources : false ,
204209				Include :             include ,
@@ -245,7 +250,7 @@ func RunGitSourceCreate(ctx context.Context, opts *GitSourceCreateOptions) error
245250	return  nil 
246251}
247252
248- func  ensureGitSourceDirectory (ctx  context.Context , opts  * GitSourceCreateOptions , gsRepo  git .Repository , gsFs  fs .FS ) error  {
253+ func  ensureGitSourceDirectory (ctx  context.Context , opts  * GitSourceCreateOptions , gsRepo  apgit .Repository , gsFs  apfs .FS ) error  {
249254	fi , err  :=  gsFs .ReadDir ("." )
250255	if  err  !=  nil  {
251256		return  fmt .Errorf ("failed to read files in git-source repo. Err: %w" , err )
@@ -411,7 +416,7 @@ func RunGitSourceDelete(ctx context.Context, opts *GitSourceDeleteOptions) error
411416
412417func  NewGitSourceEditCommand () * cobra.Command  {
413418	var  (
414- 		gsCloneOpts  * git .CloneOptions 
419+ 		gsCloneOpts  * apgit .CloneOptions 
415420		include      string 
416421		exclude      string 
417422	)
@@ -492,7 +497,7 @@ func RunGitSourceEdit(ctx context.Context, opts *GitSourceEditOptions) error {
492497	return  nil 
493498}
494499
495- func  createDemoResources (ctx  context.Context , opts  * GitSourceCreateOptions , gsRepo  git .Repository , gsFs  fs .FS ) error  {
500+ func  createDemoResources (ctx  context.Context , opts  * GitSourceCreateOptions , gsRepo  apgit .Repository , gsFs  apfs .FS ) error  {
496501	fi , err  :=  gsFs .ReadDir ("." )
497502	if  err  !=  nil  {
498503		return  fmt .Errorf ("failed to read files in git-source repo. Err: %w" , err )
@@ -1391,7 +1396,7 @@ func deleteCommonRedundantFields(crd map[string]interface{}) {
13911396}
13921397
13931398func  writeObjectToYaml [Object  any ](
1394- 	gsFs  fs .FS ,
1399+ 	gsFs  apfs .FS ,
13951400	filePath  string ,
13961401	object  Object ,
13971402	cleanUpFunc  func (Object ) (map [string ]interface {}, error ),
@@ -1425,7 +1430,7 @@ func legacyGitSourceCreate(ctx context.Context, opts *GitSourceCreateOptions) er
14251430
14261431	appDef  :=  & runtime.AppDef {
14271432		Name :    opts .GsName ,
1428- 		Type :    application .AppTypeDirectory ,
1433+ 		Type :    apapp .AppTypeDirectory ,
14291434		URL :     opts .GsCloneOpts .Repo ,
14301435		Include : opts .Include ,
14311436		Exclude : opts .Exclude ,
0 commit comments