Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/tools/coccinelle/config_fn_ctx.pending.cocci # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / tools / coccinelle / config_fn_ctx.pending.cocci` 144 lines ยท 2076 bytes Raw Blame History 1 @ get_fn @ 2 identifier fn, R; 3 @@ 4 ( 5 ( 6 git_config_from_file 7 | 8 git_config_from_file_with_options 9 | 10 git_config_from_mem 11 | 12 git_config_from_blob_oid 13 | 14 read_early_config 15 | 16 read_very_early_config 17 | 18 config_with_options 19 | 20 git_config 21 | 22 git_protected_config 23 | 24 config_from_gitmodules 25 ) 26 (fn, ...) 27 | 28 repo_config(R, fn, ...) 29 ) 30 31 @ extends get_fn @ 32 identifier C1, C2, D; 33 @@ 34 int fn(const char *C1, const char *C2, 35 + const struct config_context *ctx, 36 void *D); 37 38 @ extends get_fn @ 39 @@ 40 int fn(const char *, const char *, 41 + const struct config_context *, 42 void *); 43 44 @ extends get_fn @ 45 // Don't change fns that look like callback fns but aren't 46 identifier fn2 != tar_filter_config && != git_diff_heuristic_config && 47 != git_default_submodule_config && != git_color_config && 48 != bundle_list_update && != parse_object_filter_config; 49 identifier C1, C2, D1, D2, S; 50 attribute name UNUSED; 51 @@ 52 int fn(const char *C1, const char *C2, 53 + const struct config_context *ctx, 54 void *D1) { 55 <+... 56 ( 57 fn2(C1, C2 58 + , ctx 59 , D2); 60 | 61 if(fn2(C1, C2 62 + , ctx 63 , D2) < 0) { ... } 64 | 65 return fn2(C1, C2 66 + , ctx 67 , D2); 68 | 69 S = fn2(C1, C2 70 + , ctx 71 , D2); 72 ) 73 ...+> 74 } 75 76 @ extends get_fn@ 77 identifier C1, C2, D; 78 attribute name UNUSED; 79 @@ 80 int fn(const char *C1, const char *C2, 81 + const struct config_context *ctx UNUSED, 82 void *D) {...} 83 84 85 // The previous rules don't catch all callbacks, especially if they're defined 86 // in a separate file from the repo_config() call. Fix these manually. 87 @@ 88 identifier C1, C2, D; 89 attribute name UNUSED; 90 @@ 91 int 92 ( 93 git_ident_config 94 | 95 urlmatch_collect_fn 96 | 97 write_one_config 98 | 99 forbid_remote_url 100 | 101 credential_config_callback 102 ) 103 (const char *C1, const char *C2, 104 + const struct config_context *ctx UNUSED, 105 void *D) {...} 106 107 @@ 108 identifier C1, C2, D, D2, S, fn2; 109 @@ 110 int 111 ( 112 http_options 113 | 114 git_status_config 115 | 116 git_commit_config 117 | 118 git_default_core_config 119 | 120 grep_config 121 ) 122 (const char *C1, const char *C2, 123 + const struct config_context *ctx, 124 void *D) { 125 <+... 126 ( 127 fn2(C1, C2 128 + , ctx 129 , D2); 130 | 131 if(fn2(C1, C2 132 + , ctx 133 , D2) < 0) { ... } 134 | 135 return fn2(C1, C2 136 + , ctx 137 , D2); 138 | 139 S = fn2(C1, C2 140 + , ctx 141 , D2); 142 ) 143 ...+> 144 }