Skip to content

Commit

Permalink
fix: generated gitignore is not working correctly (#6324)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Jun 19, 2024
1 parent e573604 commit 5f05ae7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/ddevapp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,9 @@ func PrepDdevDirectory(app *DdevApp) error {
return err
}

err = CreateGitIgnore(dir, "**/*.example", ".dbimageBuild", ".dbimageExtra", ".ddev-docker-*.yaml", ".*downloads", ".homeadditions", ".importdb*", ".sshimageBuild", ".venv", ".webimageBuild", ".webimageExtra", "apache/apache-site.conf", "commands/.gitattributes", "commands/db/mysql", "commands/host/launch", "commands/web/xdebug", "commands/web/live", "config.local.y*ml", "db_snapshots", "import-db", "import.yaml", "mutagen/mutagen.yml", "mutagen/.start-synced", "nginx_full/nginx-site.conf", "postgres/postgresql.conf", "providers/acquia.yaml", "providers/lagoon.yaml", "providers/platform.yaml", "providers/upsun.yaml", "sequelpro.spf", "settings/settings.ddev.py", fmt.Sprintf("traefik/config/%s.yaml", app.Name), fmt.Sprintf("traefik/certs/%s.crt", app.Name), fmt.Sprintf("traefik/certs/%s.key", app.Name), "xhprof/xhprof_prepend.php", "**/README.*")
// Some of the listed items are wildcards or directories, and if they are, there's an error
// opening them and they innately get added to the .gitignore.
err = CreateGitIgnore(dir, "**/*.example", ".dbimageBuild", ".ddev-docker-*.yaml", ".*downloads", ".homeadditions", ".importdb*", ".sshimageBuild", ".venv", ".webimageBuild", "apache/apache-site.conf", "commands/.gitattributes", "config.local.y*ml", "db_snapshots", "mutagen/mutagen.yml", "mutagen/.start-synced", "nginx_full/nginx-site.conf", "postgres/postgresql.conf", "providers/acquia.yaml", "providers/lagoon.yaml", "providers/pantheon.yaml", "providers/platform.yaml", "providers/upsun.yaml", "sequelpro.spf", "settings/settings.ddev.py", fmt.Sprintf("traefik/config/%s.yaml", app.Name), fmt.Sprintf("traefik/certs/%s.crt", app.Name), fmt.Sprintf("traefik/certs/%s.key", app.Name), "xhprof/xhprof_prepend.php", "**/README.*")
if err != nil {
return fmt.Errorf("failed to create gitignore in %s: %v", dir, err)
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/ddevapp/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,11 @@ func CreateGitIgnore(targetDir string, ignores ...string) error {

generatedIgnores := []string{}
for _, p := range ignores {
sigFound, err := fileutil.FgrepStringInFile(p, nodeps.DdevFileSignature)
pFullPath := filepath.Join(targetDir, p)
sigFound, err := fileutil.FgrepStringInFile(pFullPath, nodeps.DdevFileSignature)
//if err != nil {
// util.Warning("file not found: %s: %v", p, err)
//}
if sigFound || err != nil {
generatedIgnores = append(generatedIgnores, p)
}
Expand Down

0 comments on commit 5f05ae7

Please sign in to comment.