| 1 |
|
| MODULE = Git::Raw PACKAGE = Git::Raw::Config |
| 2 |
|
| |
| 3 |
|
| Config |
| 4 |
|
| new(class) |
| 5 |
|
| SV *class |
| 6 |
|
| |
| 7 |
|
| PREINIT: |
| 8 |
|
| int rc; |
| 9 |
|
| Config cfg; |
| 10 |
|
| |
| 11 |
|
| CODE: |
| 12 |
2 |
| rc = git_config_new(&cfg); |
| 13 |
2 |
| git_check_error(rc); |
| 14 |
|
| |
| 15 |
2 |
| RETVAL = cfg; |
| 16 |
|
| |
| 17 |
|
| OUTPUT: RETVAL |
| 18 |
|
| |
| 19 |
|
| void |
| 20 |
|
| add_file(self, path, level) |
| 21 |
|
| Config self |
| 22 |
|
| SV *path |
| 23 |
|
| int level |
| 24 |
|
| |
| 25 |
|
| PREINIT: |
| 26 |
|
| int rc; |
| 27 |
|
| |
| 28 |
|
| CODE: |
| 29 |
2 |
| rc = git_config_add_file_ondisk( |
| 30 |
|
| self, git_ensure_pv(path, "path"), level, NULL, 0 |
| 31 |
|
| ); |
| 32 |
2 |
| git_check_error(rc); |
| 33 |
|
| |
| 34 |
|
| SV * |
| 35 |
|
| bool(self, name, ...) |
| 36 |
|
| Config self |
| 37 |
|
| SV *name |
| 38 |
|
| |
| 39 |
|
| PROTOTYPE: $$;$ |
| 40 |
|
| |
| 41 |
|
| PREINIT: |
| 42 |
|
| int rc, value; |
| 43 |
|
| |
| 44 |
10 |
| const char *id = NULL; |
| 45 |
|
| |
| 46 |
|
| CODE: |
| 47 |
10 |
| id = git_ensure_pv(name, "name"); |
| 48 |
|
| |
| 49 |
10 |
▶ | if (items == 3) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items == 3) { |
5 |
5 |
10 |
|
| 50 |
5 |
| value = git_ensure_iv(ST(2), "value"); |
| 51 |
|
| |
| 52 |
4 |
| rc = git_config_set_bool(self, id, value); |
| 53 |
|
| } else { |
| 54 |
5 |
▶ | if ((rc = git_config_get_bool(&value, self, id)) == GIT_ENOTFOUND) |
Branch: 1 branch
| Branch | True | False | Total |
| if ((rc = git_config_get_bool(&value, self, id)) == GIT_ENOTFOUND) |
3 |
2 |
5 |
|
| 55 |
3 |
| XSRETURN_UNDEF; |
| 56 |
|
| } |
| 57 |
|
| |
| 58 |
6 |
| git_check_error(rc); |
| 59 |
6 |
| RETVAL = newSViv(value); |
| 60 |
|
| |
| 61 |
|
| OUTPUT: RETVAL |
| 62 |
|
| |
| 63 |
|
| SV * |
| 64 |
|
| int(self, name, ...) |
| 65 |
|
| Config self |
| 66 |
|
| SV *name |
| 67 |
|
| |
| 68 |
|
| PROTOTYPE: $$;$ |
| 69 |
|
| |
| 70 |
|
| PREINIT: |
| 71 |
|
| int rc, value; |
| 72 |
|
| |
| 73 |
3 |
| const char *id = NULL; |
| 74 |
|
| |
| 75 |
|
| CODE: |
| 76 |
3 |
| id = git_ensure_pv(name, "name"); |
| 77 |
|
| |
| 78 |
3 |
▶ | if (items == 3) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items == 3) { |
1 |
2 |
3 |
|
| 79 |
1 |
| value = git_ensure_iv(ST(2), "value"); |
| 80 |
|
| |
| 81 |
1 |
| rc = git_config_set_int32(self, id, value); |
| 82 |
|
| } else { |
| 83 |
2 |
▶ | if ((rc = git_config_get_int32(&value, self, id)) == GIT_ENOTFOUND) |
Branch: 1 branch
| Branch | True | False | Total |
| if ((rc = git_config_get_int32(&value, self, id)) == GIT_ENOTFOUND) |
1 |
1 |
2 |
|
| 84 |
1 |
| XSRETURN_UNDEF; |
| 85 |
|
| } |
| 86 |
|
| |
| 87 |
2 |
| git_check_error(rc); |
| 88 |
2 |
| RETVAL = newSViv(value); |
| 89 |
|
| |
| 90 |
|
| OUTPUT: RETVAL |
| 91 |
|
| |
| 92 |
|
| SV * |
| 93 |
|
| str(self, name, ...) |
| 94 |
|
| Config self |
| 95 |
|
| SV *name |
| 96 |
|
| |
| 97 |
|
| PROTOTYPE: $$;$ |
| 98 |
|
| |
| 99 |
|
| PREINIT: |
| 100 |
|
| int rc; |
| 101 |
|
| const char *value; |
| 102 |
|
| |
| 103 |
28 |
| const char *id = NULL; |
| 104 |
|
| CODE: |
| 105 |
28 |
| id = git_ensure_pv(name, "name"); |
| 106 |
|
| |
| 107 |
28 |
▶ | if (items == 3) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items == 3) { |
10 |
18 |
28 |
|
| 108 |
10 |
| value = git_ensure_pv(ST(2), "value"); |
| 109 |
|
| |
| 110 |
10 |
| rc = git_config_set_string(self, id, value); |
| 111 |
10 |
| git_check_error(rc); |
| 112 |
|
| |
| 113 |
10 |
| RETVAL = newSVpv(value, 0); |
| 114 |
|
| } else { |
| 115 |
18 |
| git_buf buf = GIT_BUF_INIT_CONST(NULL, 0); |
| 116 |
18 |
▶ | if ((rc = git_config_get_string_buf(&buf, self, id)) == GIT_ENOTFOUND) |
Branch: 1 branch
| Branch | True | False | Total |
| if ((rc = git_config_get_string_buf(&buf, self, id)) == GIT_ENOTFOUND) |
3 |
15 |
18 |
|
| 117 |
3 |
| XSRETURN_UNDEF; |
| 118 |
15 |
| git_check_error(rc); |
| 119 |
|
| |
| 120 |
15 |
| RETVAL = newSVpv(buf.ptr, 0); |
| 121 |
15 |
| git_buf_dispose(&buf); |
| 122 |
|
| } |
| 123 |
|
| |
| 124 |
|
| OUTPUT: RETVAL |
| 125 |
|
| |
| 126 |
|
| SV * |
| 127 |
|
| str_add(self, name, ...) |
| 128 |
|
| Config self |
| 129 |
|
| SV *name |
| 130 |
|
| |
| 131 |
|
| PROTOTYPE: $$;$ |
| 132 |
|
| |
| 133 |
|
| PREINIT: |
| 134 |
|
| int rc; |
| 135 |
|
| const char *value; |
| 136 |
|
| |
| 137 |
4 |
| const char *id = NULL; |
| 138 |
|
| |
| 139 |
|
| AV* av; |
| 140 |
|
| size_t i; |
| 141 |
|
| |
| 142 |
|
| CODE: |
| 143 |
4 |
| id = git_ensure_pv(name, "name"); |
| 144 |
|
| |
| 145 |
4 |
▶ | if (items == 3) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items == 3) { |
2 |
2 |
4 |
|
| 146 |
2 |
| value = git_ensure_pv(ST(2), "value"); |
| 147 |
|
| |
| 148 |
2 |
| rc = git_config_set_multivar(self, id, "^$", value); |
| 149 |
2 |
| git_check_error(rc); |
| 150 |
|
| } |
| 151 |
|
| |
| 152 |
|
| git_config_iterator *iter; |
| 153 |
|
| git_config_entry *entry; |
| 154 |
|
| |
| 155 |
4 |
| rc = git_config_multivar_iterator_new(&iter, self, id, NULL); |
| 156 |
4 |
| git_check_error(rc); |
| 157 |
|
| |
| 158 |
4 |
| av = newAV(); |
| 159 |
|
| |
| 160 |
9 |
▶ | while (git_config_next(&entry, iter) == 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (git_config_next(&entry, iter) == 0) { |
5 |
4 |
9 |
|
| 161 |
5 |
| av_push(av, newSVpv(entry->value, 0)); |
| 162 |
|
| } |
| 163 |
4 |
| git_config_iterator_free(iter); |
| 164 |
|
| |
| 165 |
4 |
▶ | if (av_len(av) == -1 ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (av_len(av) == -1 ) { |
1 |
3 |
4 |
|
| 166 |
1 |
| sv_2mortal(MUTABLE_SV(av)); |
| 167 |
1 |
| XSRETURN_UNDEF; |
| 168 |
|
| } |
| 169 |
|
| |
| 170 |
3 |
| RETVAL = newRV_noinc((SV*)av); |
| 171 |
|
| |
| 172 |
|
| OUTPUT: RETVAL |
| 173 |
|
| |
| 174 |
|
| void |
| 175 |
|
| foreach(self, cb) |
| 176 |
|
| Config self |
| 177 |
|
| SV *cb |
| 178 |
|
| |
| 179 |
|
| PREINIT: |
| 180 |
|
| int rc; |
| 181 |
|
| |
| 182 |
2 |
| git_foreach_payload payload = { NULL, NULL, NULL }; |
| 183 |
|
| |
| 184 |
|
| CODE: |
| 185 |
2 |
| payload.cb = cb; |
| 186 |
|
| |
| 187 |
2 |
| rc = git_config_foreach( |
| 188 |
|
| self, git_config_foreach_cbb, &payload |
| 189 |
|
| ); |
| 190 |
|
| |
| 191 |
2 |
▶ | if (rc != GIT_EUSER) |
Branch: 1 branch
| Branch | True | False | Total |
| if (rc != GIT_EUSER) |
1 |
1 |
2 |
|
| 192 |
1 |
| git_check_error(rc); |
| 193 |
|
| |
| 194 |
|
| Config |
| 195 |
|
| default(class) |
| 196 |
|
| SV *class |
| 197 |
|
| |
| 198 |
|
| PREINIT: |
| 199 |
|
| int rc; |
| 200 |
|
| Config cfg; |
| 201 |
|
| |
| 202 |
|
| CODE: |
| 203 |
2 |
| rc = git_config_open_default(&cfg); |
| 204 |
2 |
| git_check_error(rc); |
| 205 |
|
| |
| 206 |
2 |
| RETVAL = cfg; |
| 207 |
|
| |
| 208 |
|
| OUTPUT: RETVAL |
| 209 |
|
| |
| 210 |
|
| void |
| 211 |
|
| delete(self, name) |
| 212 |
|
| Config self |
| 213 |
|
| SV *name |
| 214 |
|
| |
| 215 |
|
| PREINIT: |
| 216 |
|
| int rc; |
| 217 |
|
| |
| 218 |
|
| CODE: |
| 219 |
1 |
| rc = git_config_delete_entry(self, git_ensure_pv(name, "name")); |
| 220 |
1 |
| git_check_error(rc); |
| 221 |
|
| |
| 222 |
|
| void |
| 223 |
|
| DESTROY(self) |
| 224 |
|
| Config self |
| 225 |
|
| |
| 226 |
|
| CODE: |
| 227 |
18 |
| git_config_free(self); |