diff --git a/src/new/debian.rs b/src/new/debian.rs index e03c811..df4ff40 100644 --- a/src/new/debian.rs +++ b/src/new/debian.rs @@ -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" ); }