NewIndex allocates a new index. It won't be associated with any file on the filesystem or repository
()
| 116 | // NewIndex allocates a new index. It won't be associated with any |
| 117 | // file on the filesystem or repository |
| 118 | func NewIndex() (*Index, error) { |
| 119 | var ptr *C.git_index |
| 120 | |
| 121 | runtime.LockOSThread() |
| 122 | defer runtime.UnlockOSThread() |
| 123 | |
| 124 | if err := C.git_index_new(&ptr); err < 0 { |
| 125 | return nil, MakeGitError(err) |
| 126 | } |
| 127 | |
| 128 | return newIndexFromC(ptr, nil), nil |
| 129 | } |
| 130 | |
| 131 | // OpenIndex creates a new index at the given path. If the file does |
| 132 | // not exist it will be created when Write() is called. |
searching dependent graphs…