| 2119 | "Create a new worktree for this repository. If ref is specified, no new \ |
| 2120 | branch will be created and the provided ref will be checked out instead."); |
| 2121 | PyObject * |
| 2122 | Repository_add_worktree(Repository *self, PyObject *args) |
| 2123 | { |
| 2124 | char *c_name; |
| 2125 | PyBytesObject *py_path = NULL; |
| 2126 | char *c_path = NULL; |
| 2127 | Reference *py_reference = NULL; |
| 2128 | git_worktree *wt; |
| 2129 | git_worktree_add_options add_opts = GIT_WORKTREE_ADD_OPTIONS_INIT; |
| 2130 | |
| 2131 | int err; |
| 2132 | |
| 2133 | if (!PyArg_ParseTuple(args, "sO&|O!", &c_name, PyUnicode_FSConverter, &py_path, &ReferenceType, &py_reference)) |
| 2134 | return NULL; |
| 2135 | |
| 2136 | if (py_path != NULL) |
| 2137 | c_path = PyBytes_AS_STRING(py_path); |
| 2138 | |
| 2139 | if(py_reference != NULL) |
| 2140 | add_opts.ref = py_reference->reference; |
| 2141 | |
| 2142 | err = git_worktree_add(&wt, self->repo, c_name, c_path, &add_opts); |
| 2143 | Py_XDECREF(py_path); |
| 2144 | if (err < 0) |
| 2145 | return Error_set(err); |
| 2146 | |
| 2147 | return wrap_worktree(self, wt); |
| 2148 | } |
| 2149 | |
| 2150 | PyDoc_STRVAR(Repository_lookup_worktree__doc__, |
| 2151 | "lookup_worktree(name: str) -> Worktree\n" |
nothing calls this directly
no test coverage detected
searching dependent graphs…