aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/notes_test.go
diff options
context:
space:
mode:
authornitul1991 <nitul1991@users.noreply.github.com>2021-08-09 20:54:34 +0530
committerGitHub <noreply@github.com>2021-08-09 16:24:34 +0100
commit23d438f56524a7c3fc185df66d6d95f797a80eee (patch)
treeffe99d656afeb8a5cdffaea206855a102fe77108 /modules/git/notes_test.go
parent1dc41c47b960a4f364228d267ec16e2835b15191 (diff)
downloadgitea-23d438f56524a7c3fc185df66d6d95f797a80eee.tar.gz
gitea-23d438f56524a7c3fc185df66d6d95f797a80eee.zip
Change the implementation of the go-git version of GetNote to mirror the non go-git version when passed a non-existent commit (#16658)
Fixes #16657
Diffstat (limited to 'modules/git/notes_test.go')
-rw-r--r--modules/git/notes_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/git/notes_test.go b/modules/git/notes_test.go
index f66a191e6a..fec46e5960 100644
--- a/modules/git/notes_test.go
+++ b/modules/git/notes_test.go
@@ -39,3 +39,15 @@ func TestGetNestedNotes(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, []byte("Note 1"), note.Message)
}
+
+func TestGetNonExistentNotes(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+ bareRepo1, err := OpenRepository(bareRepo1Path)
+ assert.NoError(t, err)
+ defer bareRepo1.Close()
+
+ note := Note{}
+ err = GetNote(context.Background(), bareRepo1, "non_existent_sha", &note)
+ assert.Error(t, err)
+ assert.IsType(t, ErrNotExist{}, err)
+}