// makeGitPath returns an ApplicationGitPath by adding Repository info and GitPath URL to given args.
makeGitPath returns an ApplicationGitPath by adding Repository info and GitPath URL to given args.
// makeGitPath returns an ApplicationGitPath by adding Repository info and GitPath URL to given args .
func makeGitPath(repoID, path, cfgFilename string, piped *model.Piped, logger *zap.Logger) (*model.ApplicationGitPath, error) {
	var repo *model.ApplicationGitRepository
	for _, r := range piped.Repositories {
		if r.Id == repoID {
			repo = r
			break
		}
	}
	if repo == nil {
		return nil, status.Error(codes.NotFound, "The requested repository is not found in the Piped configuration")
	}
	u, err := git.MakeDirURL(repo.Remote, path, repo.Branch)
	if err != nil {
		logger.Error("failed to make GitPath URL", zap.Error(err))
		return nil, status.Error(codes.Internal, "Failed to make GitPath URL")
	}
	return &model.ApplicationGitPath{
		Repo:           repo,
		Path:           path,
		ConfigFilename: cfgFilename,
		Url:            u,
	}, nil
}
func makeGitPath ( repoID , path , cfgFilename string , piped * model . Piped , logger * zap . Logger ) ( * model . ApplicationGitPath , error ) { var repo * model . ApplicationGitRepository for _ , r := range piped . Repositories { if r . Id == repoID { repo = r break } } if repo == nil { return nil , status . Error ( codes . NotFound , " " ) } u , err := git . MakeDirURL ( repo . Remote , path , repo . Branch ) if err != nil { logger . Error ( " " , zap . Error ( err ) ) return nil , status . Error ( codes . Internal , " " ) } return & model . ApplicationGitPath { Repo : repo , Path : path , ConfigFilename : cfgFilename , Url : u , } , nil }
makeGitPath returns an ApplicationGitPath by adding Repository info and GitPath URL to given args.
makeGitPath returns an ApplicationGitPath by adding Repository info and GitPath URL to given args .