@@ -3,6 +3,7 @@ package cmd
@@ -305,11 +306,20 @@ func createDotCrushDir(dir string) error {
307 gitIgnorePath := filepath.Join(dir, ".gitignore")
308 gitIgnorePath := filepath.Join(dir, ".gitignore")
308− if _, err := os.Stat(gitIgnorePath); os.IsNotExist(err) {
309+ content, err := os.ReadFile(gitIgnorePath)
311+ // create or update if old version
312+ if os.IsNotExist(err) || string(content) == oldGitIgnore {
309− if err := os.WriteFile(gitIgnorePath, []byte("*\n"), 0o644); err != nil {
313+ if err := os.WriteFile(gitIgnorePath, []byte(defaultGitIgnore), 0o644); err != nil {
310 return fmt.Errorf("failed to create .gitignore file: %q %w", gitIgnorePath, err)
314 return fmt.Errorf("failed to create .gitignore file: %q %w", gitIgnorePath, err)
314 return nil
318 return nil
321+//go:embed gitignore/old
322+var oldGitIgnore string
324+//go:embed gitignore/default
325+var defaultGitIgnore string