Close closes all the file descriptors and save the final packfile, if nothing was written, the tempfiles are deleted without writing a packfile.
()
| 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. |
| 97 | func (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 | |
| 129 | func (w *PackWriter) clean() error { |
| 130 | return w.fs.Remove(w.fw.Name()) |
nothing calls this directly
no test coverage detected