Skip to content

Commit

Permalink
Stop modifying upstream .gitignore file
Browse files Browse the repository at this point in the history
The fact that Debian builds produce extra files in the build directory
is a separate concern and should not be managed by .gitignores in upstream
directory. Anyways, the list is not going to be complete on most packages,
and instead of extending the list, a better practice is to have proper
`make clean` rules in the `debian/rules`, or to simply run `git clean -fdx`
between builds. Additionally, everyone should be using `gbp pq` to update
patches instead of legacy Quilt, so no more `.pc` directories should be
generated.
  • Loading branch information
ottok committed Nov 24, 2024
1 parent ef5745f commit e2bfbec
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions make.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,29 +520,6 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
return dir, fmt.Errorf("import-orig: %w", err)
}

{
f, err := os.OpenFile(filepath.Join(dir, ".gitignore"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return dir, fmt.Errorf("open .gitignore: %w", err)
}
// Beginning newline in case the file already exists and lacks a newline
// (not all editors enforce a newline at the end of the file):
if _, err := f.Write([]byte("\n/.pc/\n/_build/\n")); err != nil {
return dir, fmt.Errorf("write to .gitignore: %w", err)
}
if err := f.Close(); err != nil {
return dir, fmt.Errorf("close .gitignore: %w", err)
}
}

if err := runGitCommandIn(dir, "add", ".gitignore"); err != nil {
return dir, fmt.Errorf("git add .gitignore: %w", err)
}

if err := runGitCommandIn(dir, "commit", "-m", "Ignore _build and quilt .pc dirs via .gitignore"); err != nil {
return dir, fmt.Errorf("git commit (.gitignore): %w", err)
}

return dir, nil
}

Expand Down

0 comments on commit e2bfbec

Please sign in to comment.