Skip to content

Commit

Permalink
fix: add newline when editing the .gitignore (#3229)
Browse files Browse the repository at this point in the history
without a newline, appending to the `.gitignore` can result in problems

for example:

```
ntl init # => appends .netlify to .gitignore with no newline

echo ".cache" >> .gitignore
```

now the .gitignore looks like this:
```
.netlify.cache
```

adding a newline fixes this problem

Co-authored-by: Erez Rokah <erezrokah@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 13, 2021
1 parent 6797b26 commit 4ad864c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/gitignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const hasGitIgnore = async function (dir) {

const ensureNetlifyIgnore = async function (dir) {
const gitIgnorePath = path.join(dir, '.gitignore')
const ignoreContent = '# Local Netlify folder\n.netlify'
const ignoreContent = '# Local Netlify folder\n.netlify\n'

/* No .gitignore file. Create one and ignore .netlify folder */
if (!(await hasGitIgnore(dir))) {
Expand Down

1 comment on commit 4ad864c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

Package size: 329 MB

Please sign in to comment.