Skip to content

Commit 8c1348a

Browse files
committed
Add a test for not adding the vim swap file
1 parent 17e0c50 commit 8c1348a

File tree

13 files changed

+25
-0
lines changed

13 files changed

+25
-0
lines changed

common/commit_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@ func Test_OneFileChange(t *testing.T) {
7878
HasHeadCommit(t, repoPath, "28cc969d97ddb7640f5e1428bbc8f2947d1ffd57", " M 1.md\n")
7979
}
8080

81+
func Test_VimSwapFile(t *testing.T) {
82+
repoPath := PrepareFixture(t, "vim_swap_file")
83+
84+
err := commit(repoPath)
85+
assert.NilError(t, err)
86+
87+
r, err := git.PlainOpen(repoPath)
88+
assert.NilError(t, err)
89+
90+
head, err := r.Head()
91+
assert.NilError(t, err)
92+
93+
assert.Equal(t, head.Hash(), plumbing.NewHash("28cc969d97ddb7640f5e1428bbc8f2947d1ffd57"))
94+
}
95+
8196
func Test_MultipleFileChange(t *testing.T) {
8297
repoPath := PrepareFixture(t, "multiple_file_change")
8398

12 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ref: refs/heads/master

common/testdata/vim_swap_file/.gitted/branches/.gitignore

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[core]
2+
repositoryformatversion = 0
3+
filemode = true
4+
bare = false
5+
logallrefupdates = true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Unnamed repository; edit this file 'description' to name the repository.
137 Bytes
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# pack-refs with: peeled fully-peeled sorted
2+
28cc969d97ddb7640f5e1428bbc8f2947d1ffd57 refs/heads/master

0 commit comments

Comments
 (0)