Fast implementation of Git in pure Go codeberg.org/lindenii/furgit
git go
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

ref/store/files: Update docs

Runxi Yu 78461860 b95d27a5

+25 -7
+1
ref/store/files/batch.go
··· 2 2 3 3 import refstore "codeberg.org/lindenii/furgit/ref/store" 4 4 5 + // Batch stages files-store updates for one non-atomic apply. 5 6 type Batch struct { 6 7 store *Store 7 8 ops []queuedUpdate
+1
ref/store/files/batch_abort.go
··· 1 1 package files 2 2 3 + // Abort abandons the queued updates. 3 4 func (batch *Batch) Abort() error { 4 5 return nil 5 6 }
+1
ref/store/files/batch_apply.go
··· 2 2 3 3 import refstore "codeberg.org/lindenii/furgit/ref/store" 4 4 5 + // Apply validates and applies the queued updates. 5 6 func (batch *Batch) Apply() ([]refstore.BatchResult, error) { 6 7 results := make([]refstore.BatchResult, len(batch.ops)) 7 8 remainingIdx := make([]int, 0, len(batch.ops))
+8
ref/store/files/batch_queue_ops.go
··· 2 2 3 3 import objectid "codeberg.org/lindenii/furgit/object/id" 4 4 5 + // Create queues a detached reference creation. 5 6 func (batch *Batch) Create(name string, newID objectid.ObjectID) { 6 7 batch.queue(queuedUpdate{name: name, kind: updateCreate, newID: newID}) 7 8 } 8 9 10 + // Update queues a detached reference update. 9 11 func (batch *Batch) Update(name string, newID, oldID objectid.ObjectID) { 10 12 batch.queue(queuedUpdate{name: name, kind: updateReplace, newID: newID, oldID: oldID}) 11 13 } 12 14 15 + // Delete queues a detached reference deletion. 13 16 func (batch *Batch) Delete(name string, oldID objectid.ObjectID) { 14 17 batch.queue(queuedUpdate{name: name, kind: updateDelete, oldID: oldID}) 15 18 } 16 19 20 + // Verify queues a detached reference verification. 17 21 func (batch *Batch) Verify(name string, oldID objectid.ObjectID) { 18 22 batch.queue(queuedUpdate{name: name, kind: updateVerify, oldID: oldID}) 19 23 } 20 24 25 + // CreateSymbolic queues a symbolic reference creation. 21 26 func (batch *Batch) CreateSymbolic(name, newTarget string) { 22 27 batch.queue(queuedUpdate{name: name, kind: updateCreateSymbolic, newTarget: newTarget}) 23 28 } 24 29 30 + // UpdateSymbolic queues a symbolic reference update. 25 31 func (batch *Batch) UpdateSymbolic(name, newTarget, oldTarget string) { 26 32 batch.queue(queuedUpdate{name: name, kind: updateReplaceSymbolic, newTarget: newTarget, oldTarget: oldTarget}) 27 33 } 28 34 35 + // DeleteSymbolic queues a symbolic reference deletion. 29 36 func (batch *Batch) DeleteSymbolic(name, oldTarget string) { 30 37 batch.queue(queuedUpdate{name: name, kind: updateDeleteSymbolic, oldTarget: oldTarget}) 31 38 } 32 39 40 + // VerifySymbolic queues a symbolic reference verification. 33 41 func (batch *Batch) VerifySymbolic(name, oldTarget string) { 34 42 batch.queue(queuedUpdate{name: name, kind: updateVerifySymbolic, oldTarget: oldTarget}) 35 43 }
-5
ref/store/files/close.go
··· 1 1 package files 2 2 3 3 // Close releases resources associated with the store. 4 - // 5 - // Store borrows gitRoot, so Close does not close it. 6 - // Transactions and batches borrowing the store are invalid after Close. 7 - // 8 - // Repeated calls to Close are undefined behavior. 9 4 func (store *Store) Close() error { 10 5 return store.commonRoot.Close() 11 6 }
+2
ref/store/files/new.go
··· 9 9 ) 10 10 11 11 // New creates one files ref store rooted at one repository gitdir. 12 + // 13 + // Labels: Deps-Borrowed. 12 14 func New(root *os.Root, algo objectid.Algorithm, packedRefsTimeout time.Duration) (*Store, error) { 13 15 if algo.Size() == 0 { 14 16 return nil, objectid.ErrInvalidAlgorithm
+1 -2
ref/store/files/store.go
··· 14 14 // Store reads and writes one Git files ref namespace rooted at one repository 15 15 // gitdir plus its commondir. 16 16 // 17 - // Store borrows gitRoot and owns commonRoot. Close releases only resources 18 - // opened by the store itself. 17 + // Labels: Close-Caller. 19 18 type Store struct { 20 19 gitRoot *os.Root 21 20 commonRoot *os.Root
+1
ref/store/files/transaction.go
··· 4 4 refstore "codeberg.org/lindenii/furgit/ref/store" 5 5 ) 6 6 7 + // Transaction stages files-store updates for one atomic commit. 7 8 type Transaction struct { 8 9 store *Store 9 10 ops []queuedUpdate
+1
ref/store/files/transaction_abort.go
··· 1 1 package files 2 2 3 + // Abort abandons the queued updates. 3 4 func (tx *Transaction) Abort() error { return nil }
+1
ref/store/files/transaction_commit.go
··· 1 1 package files 2 2 3 + // Commit validates and applies the queued updates atomically. 3 4 func (tx *Transaction) Commit() error { 4 5 executor := &refUpdateExecutor{store: tx.store} 5 6
+8
ref/store/files/transaction_queue_ops.go
··· 2 2 3 3 import objectid "codeberg.org/lindenii/furgit/object/id" 4 4 5 + // Create queues a detached reference creation. 5 6 func (tx *Transaction) Create(name string, newID objectid.ObjectID) error { 6 7 return tx.queue(queuedUpdate{name: name, kind: updateCreate, newID: newID}) 7 8 } 8 9 10 + // Update queues a detached reference update. 9 11 func (tx *Transaction) Update(name string, newID, oldID objectid.ObjectID) error { 10 12 return tx.queue(queuedUpdate{name: name, kind: updateReplace, newID: newID, oldID: oldID}) 11 13 } 12 14 15 + // Delete queues a detached reference deletion. 13 16 func (tx *Transaction) Delete(name string, oldID objectid.ObjectID) error { 14 17 return tx.queue(queuedUpdate{name: name, kind: updateDelete, oldID: oldID}) 15 18 } 16 19 20 + // Verify queues a detached reference verification. 17 21 func (tx *Transaction) Verify(name string, oldID objectid.ObjectID) error { 18 22 return tx.queue(queuedUpdate{name: name, kind: updateVerify, oldID: oldID}) 19 23 } 20 24 25 + // CreateSymbolic queues a symbolic reference creation. 21 26 func (tx *Transaction) CreateSymbolic(name, newTarget string) error { 22 27 return tx.queue(queuedUpdate{name: name, kind: updateCreateSymbolic, newTarget: newTarget}) 23 28 } 24 29 30 + // UpdateSymbolic queues a symbolic reference update. 25 31 func (tx *Transaction) UpdateSymbolic(name, newTarget, oldTarget string) error { 26 32 return tx.queue(queuedUpdate{name: name, kind: updateReplaceSymbolic, newTarget: newTarget, oldTarget: oldTarget}) 27 33 } 28 34 35 + // DeleteSymbolic queues a symbolic reference deletion. 29 36 func (tx *Transaction) DeleteSymbolic(name, oldTarget string) error { 30 37 return tx.queue(queuedUpdate{name: name, kind: updateDeleteSymbolic, oldTarget: oldTarget}) 31 38 } 32 39 40 + // VerifySymbolic queues a symbolic reference verification. 33 41 func (tx *Transaction) VerifySymbolic(name, oldTarget string) error { 34 42 return tx.queue(queuedUpdate{name: name, kind: updateVerifySymbolic, oldTarget: oldTarget}) 35 43 }