MCPcopy
hub / github.com/go-git/go-git / TestObjectWriterPermissions

Function TestObjectWriterPermissions

storage/filesystem/dotgit/writers_test.go:273–306  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

271}
272
273func TestObjectWriterPermissions(t *testing.T) {
274 t.Parallel()
275
276 for _, tc := range []struct {
277 name string
278 fs billy.Filesystem
279 }{
280 {"BoundOS", osfs.New(t.TempDir(), osfs.WithBoundOS())},
281 {"ChrootOS", osfs.New(t.TempDir(), osfs.WithChrootOS())},
282 } {
283 t.Run(tc.name, func(t *testing.T) {
284 t.Parallel()
285
286 dot := New(tc.fs)
287 require.NoError(t, dot.Initialize())
288
289 w, err := dot.NewObject()
290 require.NoError(t, err)
291
292 err = w.WriteHeader(plumbing.BlobObject, 14)
293 require.NoError(t, err)
294
295 _, err = w.Write([]byte("this is a test"))
296 require.NoError(t, err)
297
298 require.NoError(t, w.Close())
299
300 path := filepath.Join("objects", "a8", "a940627d132695a9769df883f85992f0ff4a43")
301 ro, err := isReadOnly(tc.fs, path)
302 require.NoError(t, err)
303 assert.True(t, ro, "file %q is not read-only", path)
304 })
305 }
306}

Callers

nothing calls this directly

Calls 8

InitializeMethod · 0.80
NewObjectMethod · 0.80
WriteHeaderMethod · 0.80
JoinMethod · 0.80
NewFunction · 0.70
isReadOnlyFunction · 0.70
CloseMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…