| 1 |
|
| MODULE = Git::Raw PACKAGE = Git::Raw::Stash |
| 2 |
|
| |
| 3 |
|
| void |
| 4 |
|
| apply(class, repo, index, ...) |
| 5 |
|
| SV *class |
| 6 |
|
| Repository repo |
| 7 |
|
| size_t index |
| 8 |
|
| |
| 9 |
|
| PREINIT: |
| 10 |
|
| int rc; |
| 11 |
|
| |
| 12 |
1 |
| git_stash_apply_options stash_apply_opts = GIT_STASH_APPLY_OPTIONS_INIT; |
| 13 |
|
| |
| 14 |
|
| CODE: |
| 15 |
1 |
▶ | if (items >= 4) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items >= 4) { |
1 |
0 |
1 |
|
| 16 |
1 |
| HV *opts = git_ensure_hv(ST(3), "stash_apply_opts"); |
| 17 |
1 |
| git_hv_to_stash_apply_opts(opts, &stash_apply_opts); |
| 18 |
|
| } |
| 19 |
|
| |
| 20 |
1 |
| rc = git_stash_apply( |
| 21 |
|
| repo -> repository, |
| 22 |
|
| index, |
| 23 |
|
| &stash_apply_opts |
| 24 |
|
| ); |
| 25 |
1 |
| git_check_error(rc); |
| 26 |
|
| |
| 27 |
|
| void |
| 28 |
|
| pop(class, repo, index, ...) |
| 29 |
|
| SV *class |
| 30 |
|
| Repository repo |
| 31 |
|
| size_t index |
| 32 |
|
| |
| 33 |
|
| PREINIT: |
| 34 |
|
| int rc; |
| 35 |
|
| |
| 36 |
1 |
| git_stash_apply_options stash_apply_opts = GIT_STASH_APPLY_OPTIONS_INIT; |
| 37 |
|
| |
| 38 |
|
| CODE: |
| 39 |
1 |
▶ | if (items >= 4) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items >= 4) { |
1 |
0 |
1 |
|
| 40 |
1 |
| HV *opts = git_ensure_hv(ST(3), "stash_apply_opts"); |
| 41 |
1 |
| git_hv_to_stash_apply_opts(opts, &stash_apply_opts); |
| 42 |
|
| } |
| 43 |
|
| |
| 44 |
1 |
| rc = git_stash_pop( |
| 45 |
|
| repo -> repository, |
| 46 |
|
| index, |
| 47 |
|
| &stash_apply_opts |
| 48 |
|
| ); |
| 49 |
1 |
| git_check_error(rc); |
| 50 |
|
| |
| 51 |
|
| SV * |
| 52 |
|
| save(class, repo, stasher, msg, ...) |
| 53 |
|
| SV *class |
| 54 |
|
| SV *repo |
| 55 |
|
| Signature stasher |
| 56 |
|
| SV *msg |
| 57 |
|
| |
| 58 |
|
| PROTOTYPE: $$$$;$ |
| 59 |
|
| |
| 60 |
|
| PREINIT: |
| 61 |
|
| int rc; |
| 62 |
|
| |
| 63 |
|
| Repository repo_ptr; |
| 64 |
|
| |
| 65 |
|
| git_oid oid; |
| 66 |
8 |
| unsigned int stash_flags = GIT_STASH_DEFAULT; |
| 67 |
|
| |
| 68 |
|
| CODE: |
| 69 |
8 |
| repo_ptr = GIT_SV_TO_PTR(Repository, repo); |
| 70 |
|
| |
| 71 |
8 |
▶ | if (items == 5) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (items == 5) { |
4 |
4 |
8 |
|
| 72 |
|
| AV *flags; |
| 73 |
|
| SV **flag; |
| 74 |
4 |
| size_t i = 0, count = 0; |
| 75 |
|
| |
| 76 |
4 |
| flags = git_ensure_av(ST(4), "opts"); |
| 77 |
|
| |
| 78 |
8 |
▶ | while ((flag = av_fetch(flags, i++, 0))) { |
Branch: 1 branch
| Branch | True | False | Total |
| while ((flag = av_fetch(flags, i++, 0))) { |
5 |
3 |
8 |
|
| 79 |
5 |
| const char *opt = NULL; |
| 80 |
5 |
▶ | if (!SvPOK(*flag)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvPOK(*flag)) |
1 |
4 |
5 |
|
| 81 |
1 |
| continue; |
| 82 |
|
| |
| 83 |
4 |
| opt = git_ensure_pv(*flag, "flag"); |
| 84 |
|
| |
| 85 |
4 |
▶ | if (strcmp(opt, "keep_index") == 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (strcmp(opt, "keep_index") == 0) |
1 |
3 |
4 |
|
| 86 |
1 |
| stash_flags |= GIT_STASH_KEEP_INDEX; |
| 87 |
3 |
▶ | else if (strcmp(opt, "include_untracked") == 0) |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strcmp(opt, "include_untracked") == 0) |
1 |
2 |
3 |
|
| 88 |
1 |
| stash_flags |= GIT_STASH_INCLUDE_UNTRACKED; |
| 89 |
2 |
▶ | else if (strcmp(opt, "include_ignored") == 0) |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strcmp(opt, "include_ignored") == 0) |
1 |
1 |
2 |
|
| 90 |
1 |
| stash_flags |= GIT_STASH_INCLUDE_IGNORED; |
| 91 |
|
| else |
| 92 |
1 |
| croak_usage("Unknown value for flag '%s', expected " |
| 93 |
|
| "'keep_index', 'include_untracked' or 'include_ignored'", |
| 94 |
|
| opt); |
| 95 |
|
| |
| 96 |
3 |
| ++count; |
| 97 |
|
| } |
| 98 |
|
| } |
| 99 |
|
| |
| 100 |
7 |
| rc = git_stash_save(&oid, repo_ptr -> repository, |
| 101 |
|
| stasher, |
| 102 |
|
| git_ensure_pv(msg, "msg"), |
| 103 |
|
| stash_flags |
| 104 |
|
| ); |
| 105 |
|
| |
| 106 |
7 |
| RETVAL = &PL_sv_undef; |
| 107 |
7 |
▶ | if (rc != GIT_ENOTFOUND) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (rc != GIT_ENOTFOUND) { |
6 |
1 |
7 |
|
| 108 |
|
| Commit commit; |
| 109 |
6 |
| git_check_error(rc); |
| 110 |
|
| |
| 111 |
6 |
| rc = git_commit_lookup(&commit, |
| 112 |
|
| repo_ptr -> repository, &oid |
| 113 |
|
| ); |
| 114 |
6 |
| git_check_error(rc); |
| 115 |
|
| |
| 116 |
6 |
| GIT_NEW_OBJ_WITH_MAGIC( |
| 117 |
|
| RETVAL, "Git::Raw::Commit", commit, SvRV(repo) |
| 118 |
|
| ); |
| 119 |
|
| } |
| 120 |
|
| |
| 121 |
|
| OUTPUT: RETVAL |
| 122 |
|
| |
| 123 |
|
| void |
| 124 |
|
| foreach(class, repo, cb) |
| 125 |
|
| SV *class |
| 126 |
|
| SV *repo |
| 127 |
|
| SV *cb |
| 128 |
|
| |
| 129 |
|
| PREINIT: |
| 130 |
|
| int rc; |
| 131 |
|
| |
| 132 |
|
| CODE: |
| 133 |
27 |
| git_foreach_payload payload = { |
| 134 |
9 |
| GIT_SV_TO_PTR(Repository, repo), |
| 135 |
|
| repo, |
| 136 |
9 |
| git_ensure_cv(cb, "callback") |
| 137 |
|
| }; |
| 138 |
|
| |
| 139 |
9 |
| rc = git_stash_foreach( |
| 140 |
9 |
| payload.repo_ptr -> repository, git_stash_foreach_cb, &payload |
| 141 |
|
| ); |
| 142 |
9 |
▶ | if (rc != GIT_EUSER) |
Branch: 1 branch
| Branch | True | False | Total |
| if (rc != GIT_EUSER) |
6 |
3 |
9 |
|
| 143 |
6 |
| git_check_error(rc); |
| 144 |
|
| |
| 145 |
|
| void |
| 146 |
|
| drop(class, repo, index) |
| 147 |
|
| SV *class |
| 148 |
|
| Repository repo |
| 149 |
|
| size_t index |
| 150 |
|
| |
| 151 |
|
| PREINIT: |
| 152 |
|
| int rc; |
| 153 |
|
| |
| 154 |
|
| CODE: |
| 155 |
2 |
| rc = git_stash_drop(repo -> repository, index); |
| 156 |
2 |
| git_check_error(rc); |