From d56bb0b8ef0d9f3289e6e47288d79ed4d84088b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=20Marku=C5=A1i=C4=87?= Date: Wed, 3 Aug 2022 07:51:13 +0200 Subject: [PATCH] Fix the integration test --- pkg/commands/oscommands/os.go | 8 +++++--- .../gitignoreMenu/expected/repo/.git_keep/config | 2 -- .../expected/repo/.git_keep/info/exclude | 1 - .../expected/repo/.git_keep/logs/HEAD | 2 +- .../repo/.git_keep/logs/refs/heads/master | 2 +- .../02/2c2391c4f9e4a963e1c35a087f08772a4ea0f0 | Bin 0 -> 123 bytes .../9d/d04ee245b7d6f1f80aa2b428111cbac4a4e37d | Bin 122 -> 0 bytes .../expected/repo/.git_keep/refs/heads/master | 2 +- .../gitignoreMenu/expected/repo/lg_ignore_file | 2 +- 9 files changed, 9 insertions(+), 10 deletions(-) create mode 100644 test/integration/gitignoreMenu/expected/repo/.git_keep/objects/02/2c2391c4f9e4a963e1c35a087f08772a4ea0f0 delete mode 100644 test/integration/gitignoreMenu/expected/repo/.git_keep/objects/9d/d04ee245b7d6f1f80aa2b428111cbac4a4e37d diff --git a/pkg/commands/oscommands/os.go b/pkg/commands/oscommands/os.go index 3a42d09db..5f89f976f 100644 --- a/pkg/commands/oscommands/os.go +++ b/pkg/commands/oscommands/os.go @@ -120,10 +120,12 @@ func (c *OSCommand) AppendLineToFile(filename, line string) error { return utils.WrapError(err) } - // read last char buf := make([]byte, 1) - if _, err := f.ReadAt(buf, info.Size()-1); err != nil { - return utils.WrapError(err) + if info.Size() > 0 { + // read last char + if _, err := f.ReadAt(buf, info.Size()-1); err != nil { + return utils.WrapError(err) + } } // if the last byte of the file is not a newline, add it diff --git a/test/integration/gitignoreMenu/expected/repo/.git_keep/config b/test/integration/gitignoreMenu/expected/repo/.git_keep/config index 8ae104545..596ebaeb3 100644 --- a/test/integration/gitignoreMenu/expected/repo/.git_keep/config +++ b/test/integration/gitignoreMenu/expected/repo/.git_keep/config @@ -3,8 +3,6 @@ filemode = true bare = false logallrefupdates = true - ignorecase = true - precomposeunicode = true [user] email = CI@example.com name = CI diff --git a/test/integration/gitignoreMenu/expected/repo/.git_keep/info/exclude b/test/integration/gitignoreMenu/expected/repo/.git_keep/info/exclude index 8e9f2071f..a5196d1be 100644 --- a/test/integration/gitignoreMenu/expected/repo/.git_keep/info/exclude +++ b/test/integration/gitignoreMenu/expected/repo/.git_keep/info/exclude @@ -4,4 +4,3 @@ # exclude patterns (uncomment them if you want to use them): # *.[oa] # *~ -.DS_Store diff --git a/test/integration/gitignoreMenu/expected/repo/.git_keep/logs/HEAD b/test/integration/gitignoreMenu/expected/repo/.git_keep/logs/HEAD index bef74759d..698da4260 100644 --- a/test/integration/gitignoreMenu/expected/repo/.git_keep/logs/HEAD +++ b/test/integration/gitignoreMenu/expected/repo/.git_keep/logs/HEAD @@ -1 +1 @@ -0000000000000000000000000000000000000000 9dd04ee245b7d6f1f80aa2b428111cbac4a4e37d CI 1657012500 +1000 commit (initial): Initial commit +0000000000000000000000000000000000000000 022c2391c4f9e4a963e1c35a087f08772a4ea0f0 CI 1659505392 +0200 commit (initial): Initial commit diff --git a/test/integration/gitignoreMenu/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/gitignoreMenu/expected/repo/.git_keep/logs/refs/heads/master index bef74759d..698da4260 100644 --- a/test/integration/gitignoreMenu/expected/repo/.git_keep/logs/refs/heads/master +++ b/test/integration/gitignoreMenu/expected/repo/.git_keep/logs/refs/heads/master @@ -1 +1 @@ -0000000000000000000000000000000000000000 9dd04ee245b7d6f1f80aa2b428111cbac4a4e37d CI 1657012500 +1000 commit (initial): Initial commit +0000000000000000000000000000000000000000 022c2391c4f9e4a963e1c35a087f08772a4ea0f0 CI 1659505392 +0200 commit (initial): Initial commit diff --git a/test/integration/gitignoreMenu/expected/repo/.git_keep/objects/02/2c2391c4f9e4a963e1c35a087f08772a4ea0f0 b/test/integration/gitignoreMenu/expected/repo/.git_keep/objects/02/2c2391c4f9e4a963e1c35a087f08772a4ea0f0 new file mode 100644 index 0000000000000000000000000000000000000000..9655076174cc25095c060cc8a925fedb1d274c7a GIT binary patch literal 123 zcmV->0EGW|0ga783d0}}0DJZodk>V&#ubH93OV@<*KDW|YY7(m{08!YUWXYbw^~bw zk*7=FRl$lUUb3^4#i@jZ4wbE}esO`kUq#ghv?hJ}v+XcPxXtmQ-&Eh5UURE=7##;j do&v#uglGoCLA(R)*{ z{(R6)1c;;aa}DGw2jNsOpm^dX&LO!N7Z#y}WXf9~V}mKfb;@`7l>S=fR7byo4gP}G cc|