new: fix dead patterns in the generated debian/.gitignore
Patterns containing a slash are anchored relative to the directory holding the .gitignore, so 'debian/files' inside debian/.gitignore only ever matched debian/debian/files: every generated pattern was dead and debhelper artifacts showed up as untracked. Write the patterns relative to debian/ instead.
This commit is contained in:
+11
-9
@@ -306,17 +306,19 @@ fn copyright(opts: &NewOptions) -> OutputFile {
|
||||
OutputFile::new("debian/copyright", out)
|
||||
}
|
||||
|
||||
/// `debian/.gitignore`: the debhelper build artifacts.
|
||||
/// `debian/.gitignore`: the debhelper build artifacts. The patterns are
|
||||
/// relative to `debian/` itself (a `debian/`-prefixed pattern would be
|
||||
/// anchored to `debian/debian/` inside this file, per gitignore(5)).
|
||||
fn debian_gitignore(opts: &NewOptions) -> OutputFile {
|
||||
OutputFile::new(
|
||||
"debian/.gitignore",
|
||||
format!(
|
||||
"debian/files\n\
|
||||
debian/.debhelper/\n\
|
||||
debian/*.log\n\
|
||||
debian/{}/\n\
|
||||
debian/debhelper-build-stamp\n\
|
||||
debian/*.substvars\n",
|
||||
"files\n\
|
||||
.debhelper/\n\
|
||||
*.log\n\
|
||||
{}/\n\
|
||||
debhelper-build-stamp\n\
|
||||
*.substvars\n",
|
||||
opts.name
|
||||
),
|
||||
)
|
||||
@@ -766,8 +768,8 @@ mod tests {
|
||||
let g = super::debian_gitignore(&opts());
|
||||
assert_eq!(
|
||||
g.contents,
|
||||
"debian/files\ndebian/.debhelper/\ndebian/*.log\ndebian/mytool/\n\
|
||||
debian/debhelper-build-stamp\ndebian/*.substvars\n"
|
||||
"files\n.debhelper/\n*.log\nmytool/\n\
|
||||
debhelper-build-stamp\n*.substvars\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user