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)
|
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 {
|
fn debian_gitignore(opts: &NewOptions) -> OutputFile {
|
||||||
OutputFile::new(
|
OutputFile::new(
|
||||||
"debian/.gitignore",
|
"debian/.gitignore",
|
||||||
format!(
|
format!(
|
||||||
"debian/files\n\
|
"files\n\
|
||||||
debian/.debhelper/\n\
|
.debhelper/\n\
|
||||||
debian/*.log\n\
|
*.log\n\
|
||||||
debian/{}/\n\
|
{}/\n\
|
||||||
debian/debhelper-build-stamp\n\
|
debhelper-build-stamp\n\
|
||||||
debian/*.substvars\n",
|
*.substvars\n",
|
||||||
opts.name
|
opts.name
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -766,8 +768,8 @@ mod tests {
|
|||||||
let g = super::debian_gitignore(&opts());
|
let g = super::debian_gitignore(&opts());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
g.contents,
|
g.contents,
|
||||||
"debian/files\ndebian/.debhelper/\ndebian/*.log\ndebian/mytool/\n\
|
"files\n.debhelper/\n*.log\nmytool/\n\
|
||||||
debian/debhelper-build-stamp\ndebian/*.substvars\n"
|
debhelper-build-stamp\n*.substvars\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user