mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 20:54:59 +00:00
fix: make sure the new pattern is appended as a new line (#1264)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
7501588c95
commit
9bde797b24
1 changed files with 7 additions and 0 deletions
|
@ -8,7 +8,14 @@ namespace SourceGit.Commands
|
|||
{
|
||||
var file = Path.Combine(repo, ".gitignore");
|
||||
if (!File.Exists(file))
|
||||
{
|
||||
File.WriteAllLines(file, [pattern]);
|
||||
return;
|
||||
}
|
||||
|
||||
var org = File.ReadAllText(file);
|
||||
if (!org.EndsWith('\n'))
|
||||
File.AppendAllLines(file, ["", pattern]);
|
||||
else
|
||||
File.AppendAllLines(file, [pattern]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue