Skip to content

Commit 5589090

Browse files
committed
Revert "Stop modifying upstream .gitignore file"
This reverts commit 049cf81. As long as we are not yet changing the default build path, this should be kept.
1 parent 1171dc2 commit 5589090

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

make.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,29 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
521521
return dir, fmt.Errorf("import-orig: %w", err)
522522
}
523523

524+
{
525+
f, err := os.OpenFile(filepath.Join(dir, ".gitignore"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
526+
if err != nil {
527+
return dir, fmt.Errorf("open .gitignore: %w", err)
528+
}
529+
// Beginning newline in case the file already exists and lacks a newline
530+
// (not all editors enforce a newline at the end of the file):
531+
if _, err := f.Write([]byte("\n/.pc/\n/_build/\n")); err != nil {
532+
return dir, fmt.Errorf("write to .gitignore: %w", err)
533+
}
534+
if err := f.Close(); err != nil {
535+
return dir, fmt.Errorf("close .gitignore: %w", err)
536+
}
537+
}
538+
539+
if err := runGitCommandIn(dir, "add", ".gitignore"); err != nil {
540+
return dir, fmt.Errorf("git add .gitignore: %w", err)
541+
}
542+
543+
if err := runGitCommandIn(dir, "commit", "-m", "Ignore _build and quilt .pc dirs via .gitignore"); err != nil {
544+
return dir, fmt.Errorf("git commit (.gitignore): %w", err)
545+
}
546+
524547
return dir, nil
525548
}
526549

0 commit comments

Comments
 (0)