| 1 |
|
| MODULE = Git::Raw PACKAGE = Git::Raw::Filter |
| 2 |
|
| |
| 3 |
|
| SV * |
| 4 |
|
| create(class, name, attributes) |
| 5 |
|
| const char *class |
| 6 |
|
| const char *name |
| 7 |
|
| const char *attributes |
| 8 |
|
| |
| 9 |
|
| PREINIT: |
| 10 |
|
| Filter filter; |
| 11 |
|
| |
| 12 |
|
| CODE: |
| 13 |
4 |
| Newxz(filter, 1, git_raw_filter); |
| 14 |
|
| |
| 15 |
4 |
| Newxz(filter -> name, strlen(name) + 1, char); |
| 16 |
4 |
| strcpy(filter -> name, name); |
| 17 |
|
| |
| 18 |
4 |
| Newxz(filter -> attributes, strlen(attributes) + 1, char); |
| 19 |
4 |
| strcpy(filter -> attributes, attributes); |
| 20 |
|
| |
| 21 |
4 |
| filter -> filter.version = GIT_FILTER_VERSION; |
| 22 |
4 |
| filter -> filter.attributes = filter -> attributes; |
| 23 |
|
| |
| 24 |
4 |
| GIT_NEW_OBJ(RETVAL, |
| 25 |
|
| class, filter |
| 26 |
|
| ); |
| 27 |
|
| |
| 28 |
|
| OUTPUT: RETVAL |
| 29 |
|
| |
| 30 |
|
| void |
| 31 |
|
| callbacks(self, callbacks) |
| 32 |
|
| Filter self |
| 33 |
|
| HV *callbacks |
| 34 |
|
| |
| 35 |
|
| PREINIT: |
| 36 |
5 |
| git_filter_callbacks *cbs = NULL; |
| 37 |
|
| |
| 38 |
|
| CODE: |
| 39 |
5 |
| cbs = &self -> callbacks; |
| 40 |
|
| |
| 41 |
5 |
| git_clean_filter_callbacks(cbs); |
| 42 |
|
| |
| 43 |
5 |
▶ | if ((cbs -> initialize = get_callback_option( |
Branch: 1 branch
| Branch | True | False | Total |
| if ((cbs -> initialize = get_callback_option( |
1 |
4 |
5 |
|
| 44 |
|
| callbacks, "initialize"))) |
| 45 |
1 |
| self -> filter.initialize = git_filter_init_cbb; |
| 46 |
|
| |
| 47 |
5 |
▶ | if ((cbs -> shutdown = get_callback_option( |
Branch: 1 branch
| Branch | True | False | Total |
| if ((cbs -> shutdown = get_callback_option( |
2 |
3 |
5 |
|
| 48 |
|
| callbacks,"shutdown"))) |
| 49 |
2 |
| self -> filter.shutdown = git_filter_shutdown_cbb; |
| 50 |
|
| |
| 51 |
5 |
▶ | if ((cbs -> check = get_callback_option( |
Branch: 1 branch
| Branch | True | False | Total |
| if ((cbs -> check = get_callback_option( |
3 |
2 |
5 |
|
| 52 |
|
| callbacks, "check"))) |
| 53 |
3 |
| self -> filter.check = git_filter_check_cbb; |
| 54 |
|
| |
| 55 |
5 |
▶ | if ((cbs -> apply = get_callback_option( |
Branch: 1 branch
| Branch | True | False | Total |
| if ((cbs -> apply = get_callback_option( |
5 |
0 |
5 |
|
| 56 |
|
| callbacks, "apply"))) |
| 57 |
5 |
| self -> filter.apply = git_filter_apply_cbb; |
| 58 |
|
| |
| 59 |
5 |
▶ | if ((cbs -> cleanup = get_callback_option( |
Branch: 1 branch
| Branch | True | False | Total |
| if ((cbs -> cleanup = get_callback_option( |
1 |
4 |
5 |
|
| 60 |
|
| callbacks, "cleanup"))) |
| 61 |
1 |
| self -> filter.cleanup = git_filter_cleanup_cbb; |
| 62 |
|
| |
| 63 |
|
| void |
| 64 |
|
| register(self, priority) |
| 65 |
|
| Filter self |
| 66 |
|
| int priority |
| 67 |
|
| |
| 68 |
|
| PREINIT: |
| 69 |
|
| int rc; |
| 70 |
|
| |
| 71 |
|
| CODE: |
| 72 |
5 |
▶ | if (!self -> filter.initialize && |
Branch: 1 branch
| Branch | True | False | Total |
| if (!self -> filter.initialize && |
4 |
1 |
5 |
|
| 73 |
4 |
▶ | !self -> filter.shutdown && |
Branch: 1 branch
| Branch | True | False | Total |
| !self -> filter.shutdown && |
4 |
0 |
4 |
|
| 74 |
4 |
▶ | !self -> filter.check && |
Branch: 1 branch
| Branch | True | False | Total |
| !self -> filter.check && |
2 |
2 |
4 |
|
| 75 |
2 |
▶ | !self -> filter.apply && |
Branch: 1 branch
| Branch | True | False | Total |
| !self -> filter.apply && |
1 |
1 |
2 |
|
| 76 |
1 |
▶ | !self -> filter.cleanup) |
Branch: 1 branch
| Branch | True | False | Total |
| !self -> filter.cleanup) |
1 |
0 |
1 |
|
| 77 |
1 |
| croak_usage("No callbacks registered for filter '%s'", self -> name); |
| 78 |
|
| |
| 79 |
4 |
| rc = git_filter_register( |
| 80 |
4 |
| self -> name, &self -> filter, priority |
| 81 |
|
| ); |
| 82 |
4 |
| git_check_error(rc); |
| 83 |
|
| |
| 84 |
|
| void |
| 85 |
|
| unregister(self) |
| 86 |
|
| Filter self |
| 87 |
|
| |
| 88 |
|
| PREINIT: |
| 89 |
|
| int rc; |
| 90 |
|
| |
| 91 |
|
| CODE: |
| 92 |
3 |
| rc = git_filter_unregister(self -> name); |
| 93 |
3 |
| git_check_error(rc); |
| 94 |
|
| |
| 95 |
|
| void |
| 96 |
|
| DESTROY(self) |
| 97 |
|
| Filter self |
| 98 |
|
| |
| 99 |
|
| PREINIT: |
| 100 |
4 |
| int rc = 0; |
| 101 |
|
| |
| 102 |
4 |
| git_filter_callbacks *cbs = NULL; |
| 103 |
|
| |
| 104 |
|
| CODE: |
| 105 |
4 |
| cbs = &self -> callbacks; |
| 106 |
|
| |
| 107 |
4 |
▶ | if (git_filter_lookup(self -> name)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (git_filter_lookup(self -> name)) |
1 |
3 |
4 |
|
| 108 |
1 |
| rc = git_filter_unregister(self -> name); |
| 109 |
|
| |
| 110 |
4 |
| git_clean_filter_callbacks(cbs); |
| 111 |
|
| |
| 112 |
4 |
| Safefree(self -> attributes); |
| 113 |
4 |
| Safefree(self -> name); |
| 114 |
4 |
| Safefree(self); |
| 115 |
|
| |
| 116 |
4 |
| git_check_error(rc); |