MCPcopy Index your code
hub / github.com/go-git/go-git / Close

Method Close

storage/filesystem/dotgit/writers.go:97–127  ·  view source on GitHub ↗

Close closes all the file descriptors and save the final packfile, if nothing was written, the tempfiles are deleted without writing a packfile.

()

Source from the content-addressed store, hash-verified

95// Close closes all the file descriptors and save the final packfile, if nothing
96// was written, the tempfiles are deleted without writing a packfile.
97func (w *PackWriter) Close() error {
98 defer func() {
99 if w.Notify != nil && w.writer != nil && w.writer.Finished() {
100 w.Notify(w.checksum, w.writer)
101 }
102
103 close(w.result)
104 }()
105
106 if err := w.synced.Close(); err != nil {
107 return err
108 }
109
110 if err := w.waitBuildIndex(); err != nil {
111 return err
112 }
113
114 if err := w.fr.Close(); err != nil {
115 return err
116 }
117
118 if err := w.fw.Close(); err != nil {
119 return err
120 }
121
122 if w.writer == nil || !w.writer.Finished() {
123 return w.clean()
124 }
125
126 return w.save()
127}
128
129func (w *PackWriter) clean() error {
130 return w.fs.Remove(w.fw.Name())

Callers

nothing calls this directly

Calls 5

waitBuildIndexMethod · 0.95
cleanMethod · 0.95
saveMethod · 0.95
FinishedMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected