MCPcopy Create free account
hub / github.com/go-git/go-git / doUpdateFileToIndex

Method doUpdateFileToIndex

worktree_status.go:533–552  ·  view source on GitHub ↗
(e *index.Entry, filename string, h plumbing.Hash)

Source from the content-addressed store, hash-verified

531}
532
533func (w *Worktree) doUpdateFileToIndex(e *index.Entry, filename string, h plumbing.Hash) error {
534 info, err := w.Filesystem.Lstat(filename)
535 if err != nil {
536 return err
537 }
538
539 e.Hash = h
540 e.ModifiedAt = info.ModTime()
541 e.Mode, err = filemode.NewFromOSFileMode(info.Mode())
542 if err != nil {
543 return err
544 }
545
546 if e.Mode.IsRegular() {
547 e.Size = uint32(info.Size())
548 }
549
550 fillSystemInfo(e, info.Sys())
551 return nil
552}
553
554// Remove removes files from the working tree and from the index.
555func (w *Worktree) Remove(path string) (plumbing.Hash, error) {

Callers 2

doAddFileToIndexMethod · 0.95

Calls 5

NewFromOSFileModeFunction · 0.92
LstatMethod · 0.80
IsRegularMethod · 0.80
ModeMethod · 0.65
SizeMethod · 0.65

Tested by

no test coverage detected