1 /*
2 * Copyright (C) the libgit2 contributors. All rights reserved.
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */7 modulelibgit2_d.submodule;
8 9 10 privatestaticimportlibgit2_d.buffer;
11 privatestaticimportlibgit2_d.checkout;
12 privatestaticimportlibgit2_d.oid;
13 privatestaticimportlibgit2_d.remote;
14 privatestaticimportlibgit2_d.types;
15 privatestaticimportstd.traits;
16 17 /**
18 * @file git2/submodule.h
19 * @brief Git submodule management utilities
20 *
21 * Submodule support in libgit2 builds a list of known submodules and keeps
22 * it in the repository. The list is built from the .gitmodules file, the
23 * .git/config file, the index, and the HEAD tree. Items in the working
24 * directory that look like submodules (i.e. a git repo) but are not
25 * mentioned in those places won't be tracked.
26 *
27 * @defgroup git_submodule Git submodule management routines
28 * @ingroup Git
29 * @{
30 */31 extern (C):
32 nothrow @nogc:
33 public:
34 35 /**
36 * Return codes for submodule status.
37 *
38 * A combination of these flags will be returned to describe the status of a
39 * submodule. Depending on the "ignore" property of the submodule, some of
40 * the flags may never be returned because they indicate changes that are
41 * supposed to be ignored.
42 *
43 * Submodule info is contained in 4 places: the HEAD tree, the index, config
44 * files (both .git/config and .gitmodules), and the working directory. Any
45 * or all of those places might be missing information about the submodule
46 * depending on what state the repo is in. We consider all four places to
47 * build the combination of status flags.
48 *
49 * There are four values that are not really status, but give basic info
50 * about what sources of submodule data are available. These will be
51 * returned even if ignore is set to "ALL".
52 *
53 * * IN_HEAD - superproject head contains submodule
54 * * IN_INDEX - superproject index contains submodule
55 * * IN_CONFIG - superproject gitmodules has submodule
56 * * IN_WD - superproject workdir has submodule
57 *
58 * The following values will be returned so long as ignore is not "ALL".
59 *
60 * * INDEX_ADDED - in index, not in head
61 * * INDEX_DELETED - in head, not in index
62 * * INDEX_MODIFIED - index and head don't match
63 * * WD_UNINITIALIZED - workdir contains empty directory
64 * * WD_ADDED - in workdir, not index
65 * * WD_DELETED - in index, not workdir
66 * * WD_MODIFIED - index and workdir head don't match
67 *
68 * The following can only be returned if ignore is "NONE" or "UNTRACKED".
69 *
70 * * WD_INDEX_MODIFIED - submodule workdir index is dirty
71 * * WD_WD_MODIFIED - submodule workdir has modified files
72 *
73 * Lastly, the following will only be returned for ignore "NONE".
74 *
75 * * WD_UNTRACKED - wd contains untracked files
76 */77 enumgit_submodule_status_t78 {
79 GIT_SUBMODULE_STATUS_IN_HEAD = 1u << 0,
80 GIT_SUBMODULE_STATUS_IN_INDEX = 1u << 1,
81 GIT_SUBMODULE_STATUS_IN_CONFIG = 1u << 2,
82 GIT_SUBMODULE_STATUS_IN_WD = 1u << 3,
83 GIT_SUBMODULE_STATUS_INDEX_ADDED = 1u << 4,
84 GIT_SUBMODULE_STATUS_INDEX_DELETED = 1u << 5,
85 GIT_SUBMODULE_STATUS_INDEX_MODIFIED = 1u << 6,
86 GIT_SUBMODULE_STATUS_WD_UNINITIALIZED = 1u << 7,
87 GIT_SUBMODULE_STATUS_WD_ADDED = 1u << 8,
88 GIT_SUBMODULE_STATUS_WD_DELETED = 1u << 9,
89 GIT_SUBMODULE_STATUS_WD_MODIFIED = 1u << 10,
90 GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED = 1u << 11,
91 GIT_SUBMODULE_STATUS_WD_WD_MODIFIED = 1u << 12,
92 GIT_SUBMODULE_STATUS_WD_UNTRACKED = 1u << 13,
93 }
94 95 //Declaration name in C language96 enum97 {
98 GIT_SUBMODULE_STATUS_IN_HEAD = .git_submodule_status_t.GIT_SUBMODULE_STATUS_IN_HEAD,
99 GIT_SUBMODULE_STATUS_IN_INDEX = .git_submodule_status_t.GIT_SUBMODULE_STATUS_IN_INDEX,
100 GIT_SUBMODULE_STATUS_IN_CONFIG = .git_submodule_status_t.GIT_SUBMODULE_STATUS_IN_CONFIG,
101 GIT_SUBMODULE_STATUS_IN_WD = .git_submodule_status_t.GIT_SUBMODULE_STATUS_IN_WD,
102 GIT_SUBMODULE_STATUS_INDEX_ADDED = .git_submodule_status_t.GIT_SUBMODULE_STATUS_INDEX_ADDED,
103 GIT_SUBMODULE_STATUS_INDEX_DELETED = .git_submodule_status_t.GIT_SUBMODULE_STATUS_INDEX_DELETED,
104 GIT_SUBMODULE_STATUS_INDEX_MODIFIED = .git_submodule_status_t.GIT_SUBMODULE_STATUS_INDEX_MODIFIED,
105 GIT_SUBMODULE_STATUS_WD_UNINITIALIZED = .git_submodule_status_t.GIT_SUBMODULE_STATUS_WD_UNINITIALIZED,
106 GIT_SUBMODULE_STATUS_WD_ADDED = .git_submodule_status_t.GIT_SUBMODULE_STATUS_WD_ADDED,
107 GIT_SUBMODULE_STATUS_WD_DELETED = .git_submodule_status_t.GIT_SUBMODULE_STATUS_WD_DELETED,
108 GIT_SUBMODULE_STATUS_WD_MODIFIED = .git_submodule_status_t.GIT_SUBMODULE_STATUS_WD_MODIFIED,
109 GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED = .git_submodule_status_t.GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED,
110 GIT_SUBMODULE_STATUS_WD_WD_MODIFIED = .git_submodule_status_t.GIT_SUBMODULE_STATUS_WD_WD_MODIFIED,
111 GIT_SUBMODULE_STATUS_WD_UNTRACKED = .git_submodule_status_t.GIT_SUBMODULE_STATUS_WD_UNTRACKED,
112 }
113 114 enumGIT_SUBMODULE_STATUS__IN_FLAGS = 0x000Fu;
115 enumGIT_SUBMODULE_STATUS__INDEX_FLAGS = 0x0070u;
116 enumGIT_SUBMODULE_STATUS__WD_FLAGS = 0x3F80u;
117 118 pragma(inline, true)
119 purenothrow @safe @nogc120 boolGIT_SUBMODULE_STATUS_IS_UNMODIFIED(T)(S)
121 if (std.traits.isIntegral!(T))
122 123 do124 {
125 return (S & ~.GIT_SUBMODULE_STATUS__IN_FLAGS) == 0;
126 }
127 128 pragma(inline, true)
129 purenothrow @safe @nogc130 boolGIT_SUBMODULE_STATUS_IS_INDEX_UNMODIFIED(T)(S)
131 if (std.traits.isIntegral!(T))
132 133 do134 {
135 return (S & .GIT_SUBMODULE_STATUS__INDEX_FLAGS) == 0;
136 }
137 138 pragma(inline, true)
139 purenothrow @safe @nogc140 boolGIT_SUBMODULE_STATUS_IS_WD_UNMODIFIED(T)(S)
141 if (std.traits.isIntegral!(T))
142 143 do144 {
145 return (S & (.GIT_SUBMODULE_STATUS__WD_FLAGS & ~.git_submodule_status_t.GIT_SUBMODULE_STATUS_WD_UNINITIALIZED)) == 0;
146 }
147 148 pragma(inline, true)
149 purenothrow @safe @nogc150 boolGIT_SUBMODULE_STATUS_IS_WD_DIRTY(T)(S)
151 if (std.traits.isIntegral!(T))
152 153 do154 {
155 return (S & (.git_submodule_status_t.GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED | .git_submodule_status_t.GIT_SUBMODULE_STATUS_WD_WD_MODIFIED | .git_submodule_status_t.GIT_SUBMODULE_STATUS_WD_UNTRACKED)) != 0;
156 }
157 158 /**
159 * Function pointer to receive each submodule
160 *
161 * Params:
162 * sm = git_submodule currently being visited
163 * name = name of the submodule
164 * payload = value you passed to the foreach function as payload
165 *
166 * Returns: 0 on success or error code
167 */168 aliasgit_submodule_cb = intfunction(libgit2_d.types.git_submodule* sm, const (char)* name, void* payload);
169 170 /**
171 * Submodule update options structure
172 *
173 * Initialize with `GIT_SUBMODULE_UPDATE_OPTIONS_INIT`. Alternatively, you can
174 * use `git_submodule_update_options_init`.
175 */176 structgit_submodule_update_options177 {
178 uintversion_;
179 180 /**
181 * These options are passed to the checkout step. To disable
182 * checkout, set the `checkout_strategy` to
183 * `git_checkout_strategy_t.GIT_CHECKOUT_NONE`. Generally you will want the use
184 * git_checkout_strategy_t.GIT_CHECKOUT_SAFE to update files in the working
185 * directory.
186 */187 libgit2_d.checkout.git_checkout_optionscheckout_opts;
188 189 /**
190 * Options which control the fetch, including callbacks.
191 *
192 * The callbacks to use for reporting fetch progress, and for acquiring
193 * credentials in the event they are needed.
194 */195 libgit2_d.remote.git_fetch_optionsfetch_opts;
196 197 /**
198 * Allow fetching from the submodule's default remote if the target
199 * commit isn't found. Enabled by default.
200 */201 intallow_fetch;
202 }
203 204 enumGIT_SUBMODULE_UPDATE_OPTIONS_VERSION = 1;
205 206 pragma(inline, true)
207 purenothrow @safe @nogc208 .git_submodule_update_optionsGIT_SUBMODULE_UPDATE_OPTIONS_INIT()
209 210 do211 {
212 libgit2_d.checkout.git_checkout_optionsCHECKOUT_OPTION =
213 {
214 version_: libgit2_d.checkout.GIT_CHECKOUT_OPTIONS_VERSION,
215 checkout_strategy: libgit2_d.checkout.git_checkout_strategy_t.GIT_CHECKOUT_SAFE,
216 };
217 218 .git_submodule_update_optionsOUTPUT =
219 {
220 version_: .GIT_SUBMODULE_UPDATE_OPTIONS_VERSION,
221 checkout_opts: CHECKOUT_OPTION,
222 fetch_opts: libgit2_d.remote.GIT_FETCH_OPTIONS_INIT(),
223 allow_fetch: 1,
224 };
225 226 returnOUTPUT;
227 }
228 229 /**
230 * Initialize git_submodule_update_options structure
231 *
232 * Initializes a `git_submodule_update_options` with default values. Equivalent to
233 * creating an instance with `GIT_SUBMODULE_UPDATE_OPTIONS_INIT`.
234 *
235 * Params:
236 * opts = The `git_submodule_update_options` struct to initialize.
237 * version = The struct version; pass `GIT_SUBMODULE_UPDATE_OPTIONS_VERSION`.
238 *
239 * Returns: Zero on success; -1 on failure.
240 */241 //GIT_EXTERN242 intgit_submodule_update_options_init(.git_submodule_update_options* opts, uintversion_);
243 244 /**
245 * Update a submodule. This will clone a missing submodule and
246 * checkout the subrepository to the commit specified in the index of
247 * the containing repository. If the submodule repository doesn't contain
248 * the target commit (e.g. because fetchRecurseSubmodules isn't set), then
249 * the submodule is fetched using the fetch options supplied in options.
250 *
251 * Params:
252 * submodule = Submodule object
253 * init = If the submodule is not initialized, setting this flag to true will initialize the submodule before updating. Otherwise, this will return an error if attempting to update an uninitialzed repository. but setting this to true forces them to be updated.
254 * options = configuration options for the update. If null, the function works as though GIT_SUBMODULE_UPDATE_OPTIONS_INIT was passed.
255 *
256 * Returns: 0 on success, any non-zero return value from a callback function, or a negative value to indicate an error (use `git_error_last` for a detailed error message).
257 */258 //GIT_EXTERN259 intgit_submodule_update(libgit2_d.types.git_submodule* submodule, intinit, .git_submodule_update_options* options);
260 261 /**
262 * Lookup submodule information by name or path.
263 *
264 * Given either the submodule name or path (they are usually the same), this
265 * returns a structure describing the submodule.
266 *
267 * There are two expected error scenarios:
268 *
269 * - The submodule is not mentioned in the HEAD, the index, and the config,
270 * but does "exist" in the working directory (i.e. there is a subdirectory
271 * that appears to be a Git repository). In this case, this function
272 * returns git_error_code.GIT_EEXISTS to indicate a sub-repository exists but not in a
273 * state where a git_submodule can be instantiated.
274 * - The submodule is not mentioned in the HEAD, index, or config and the
275 * working directory doesn't contain a value git repo at that path.
276 * There may or may not be anything else at that path, but nothing that
277 * looks like a submodule. In this case, this returns git_error_code.GIT_ENOTFOUND.
278 *
279 * You must call `git_submodule_free` when done with the submodule.
280 *
281 * Params:
282 * out_ = Output ptr to submodule; pass null to just get return code
283 * repo = The parent repository
284 * name = The name of or path to the submodule; trailing slashes okay
285 *
286 * Returns: 0 on success, git_error_code.GIT_ENOTFOUND if submodule does not exist, git_error_code.GIT_EEXISTS if a repository is found in working directory only, -1 on other errors.
287 */288 //GIT_EXTERN289 intgit_submodule_lookup(libgit2_d.types.git_submodule** out_, libgit2_d.types.git_repository* repo, const (char)* name);
290 291 /**
292 * Release a submodule
293 *
294 * Params:
295 * submodule = Submodule object
296 */297 //GIT_EXTERN298 voidgit_submodule_free(libgit2_d.types.git_submodule* submodule);
299 300 /**
301 * Iterate over all tracked submodules of a repository.
302 *
303 * See the note on `git_submodule` above. This iterates over the tracked
304 * submodules as described therein.
305 *
306 * If you are concerned about items in the working directory that look like
307 * submodules but are not tracked, the diff API will generate a diff record
308 * for workdir items that look like submodules but are not tracked, showing
309 * them as added in the workdir. Also, the status API will treat the entire
310 * subdirectory of a contained git repo as a single git_status_t.GIT_STATUS_WT_NEW item.
311 *
312 * Params:
313 * repo = The repository
314 * callback = Function to be called with the name of each submodule. Return a non-zero value to terminate the iteration.
315 * payload = Extra data to pass to callback
316 *
317 * Returns: 0 on success, -1 on error, or non-zero return value of callback
318 */319 //GIT_EXTERN320 intgit_submodule_foreach(libgit2_d.types.git_repository* repo, .git_submodule_cbcallback, void* payload);
321 322 /**
323 * Set up a new git submodule for checkout.
324 *
325 * This does "git submodule add" up to the fetch and checkout of the
326 * submodule contents. It preps a new submodule, creates an entry in
327 * .gitmodules and creates an empty initialized repository either at the
328 * given path in the working directory or in .git/modules with a gitlink
329 * from the working directory to the new repo.
330 *
331 * To fully emulate "git submodule add" call this function, then open the
332 * submodule repo and perform the clone step as needed (if you don't need
333 * anything custom see `git_submodule_add_clone()`). Lastly, call
334 * `git_submodule_add_finalize()` to wrap up adding the new submodule and
335 * .gitmodules to the index to be ready to commit.
336 *
337 * You must call `git_submodule_free` on the submodule object when done.
338 *
339 * Params:
340 * out_ = The newly created submodule ready to open for clone
341 * repo = The repository in which you want to create the submodule
342 * url = URL for the submodule's remote
343 * path = Path at which the submodule should be created
344 * use_gitlink = Should workdir contain a gitlink to the repo in .git/modules vs. repo directly in workdir.
345 *
346 * Returns: 0 on success, git_error_code.GIT_EEXISTS if submodule already exists, -1 on other errors.
347 */348 //GIT_EXTERN349 intgit_submodule_add_setup(libgit2_d.types.git_submodule** out_, libgit2_d.types.git_repository* repo, const (char)* url, const (char)* path, intuse_gitlink);
350 351 /**
352 * Perform the clone step for a newly created submodule.
353 *
354 * This performs the necessary `git_clone` to setup a newly-created submodule.
355 *
356 * Params:
357 * out_ = The newly created repository object. Optional.
358 * submodule = The submodule currently waiting for its clone.
359 * opts = The options to use.
360 *
361 * Returns: 0 on success, -1 on other errors (see git_clone).
362 */363 //GIT_EXTERN364 intgit_submodule_clone(libgit2_d.types.git_repository** out_, libgit2_d.types.git_submodule* submodule, const (.git_submodule_update_options)* opts);
365 366 /**
367 * Resolve the setup of a new git submodule.
368 *
369 * This should be called on a submodule once you have called add setup
370 * and done the clone of the submodule. This adds the .gitmodules file
371 * and the newly cloned submodule to the index to be ready to be committed
372 * (but doesn't actually do the commit).
373 *
374 * Params:
375 * submodule = The submodule to finish adding.
376 */377 //GIT_EXTERN378 intgit_submodule_add_finalize(libgit2_d.types.git_submodule* submodule);
379 380 /**
381 * Add current submodule HEAD commit to index of superproject.
382 *
383 * Params:
384 * submodule = The submodule to add to the index
385 * write_index = Boolean if this should immediately write the index file. If you pass this as false, you will have to get the git_index and explicitly call `git_index_write()` on it to save the change.
386 *
387 * Returns: 0 on success, <0 on failure
388 */389 //GIT_EXTERN390 intgit_submodule_add_to_index(libgit2_d.types.git_submodule* submodule, intwrite_index);
391 392 /**
393 * Get the containing repository for a submodule.
394 *
395 * This returns a pointer to the repository that contains the submodule.
396 * This is a just a reference to the repository that was passed to the
397 * original `git_submodule_lookup()` call, so if that repository has been
398 * freed, then this may be a dangling reference.
399 *
400 * Params:
401 * submodule = Pointer to submodule object
402 *
403 * Returns: Pointer to `libgit2_d.types.git_repository`
404 */405 //GIT_EXTERN406 libgit2_d.types.git_repository* git_submodule_owner(libgit2_d.types.git_submodule* submodule);
407 408 /**
409 * Get the name of submodule.
410 *
411 * Params:
412 * submodule = Pointer to submodule object
413 *
414 * Returns: Pointer to the submodule name
415 */416 //GIT_EXTERN417 const (char)* git_submodule_name(libgit2_d.types.git_submodule* submodule);
418 419 /**
420 * Get the path to the submodule.
421 *
422 * The path is almost always the same as the submodule name, but the
423 * two are actually not required to match.
424 *
425 * Params:
426 * submodule = Pointer to submodule object
427 *
428 * Returns: Pointer to the submodule path
429 */430 //GIT_EXTERN431 const (char)* git_submodule_path(libgit2_d.types.git_submodule* submodule);
432 433 /**
434 * Get the URL for the submodule.
435 *
436 * Params:
437 * submodule = Pointer to submodule object
438 *
439 * Returns: Pointer to the submodule url
440 */441 //GIT_EXTERN442 const (char)* git_submodule_url(libgit2_d.types.git_submodule* submodule);
443 444 /**
445 * Resolve a submodule url relative to the given repository.
446 *
447 * Params:
448 * out_ = buffer to store the absolute submodule url in
449 * repo = Pointer to repository object
450 * url = Relative url
451 *
452 * Returns: 0 or an error code
453 */454 //GIT_EXTERN455 intgit_submodule_resolve_url(libgit2_d.buffer.git_buf* out_, libgit2_d.types.git_repository* repo, const (char)* url);
456 457 /**
458 * Get the branch for the submodule.
459 *
460 * Params:
461 * submodule = Pointer to submodule object
462 *
463 * Returns: Pointer to the submodule branch
464 */465 //GIT_EXTERN466 const (char)* git_submodule_branch(libgit2_d.types.git_submodule* submodule);
467 468 /**
469 * Set the branch for the submodule in the configuration
470 *
471 * After calling this, you may wish to call `git_submodule_sync()` to
472 * write the changes to the checked out submodule repository.
473 *
474 * Params:
475 * repo = the repository to affect
476 * name = the name of the submodule to configure
477 * branch = Branch that should be used for the submodule
478 *
479 * Returns: 0 on success, <0 on failure
480 */481 //GIT_EXTERN482 intgit_submodule_set_branch(libgit2_d.types.git_repository* repo, const (char)* name, const (char)* branch);
483 484 /**
485 * Set the URL for the submodule in the configuration
486 *
487 *
488 * After calling this, you may wish to call `git_submodule_sync()` to
489 * write the changes to the checked out submodule repository.
490 *
491 * Params:
492 * repo = the repository to affect
493 * name = the name of the submodule to configure
494 * url = URL that should be used for the submodule
495 *
496 * Returns: 0 on success, <0 on failure
497 */498 //GIT_EXTERN499 intgit_submodule_set_url(libgit2_d.types.git_repository* repo, const (char)* name, const (char)* url);
500 501 /**
502 * Get the OID for the submodule in the index.
503 *
504 * Params:
505 * submodule = Pointer to submodule object
506 *
507 * Returns: Pointer to git_oid or null if submodule is not in index.
508 */509 //GIT_EXTERN510 const (libgit2_d.oid.git_oid)* git_submodule_index_id(libgit2_d.types.git_submodule* submodule);
511 512 /**
513 * Get the OID for the submodule in the current HEAD tree.
514 *
515 * Params:
516 * submodule = Pointer to submodule object
517 *
518 * Returns: Pointer to git_oid or null if submodule is not in the HEAD.
519 */520 //GIT_EXTERN521 const (libgit2_d.oid.git_oid)* git_submodule_head_id(libgit2_d.types.git_submodule* submodule);
522 523 /**
524 * Get the OID for the submodule in the current working directory.
525 *
526 * This returns the OID that corresponds to looking up 'HEAD' in the checked
527 * out submodule. If there are pending changes in the index or anything
528 * else, this won't notice that. You should call `git_submodule_status()`
529 * for a more complete picture about the state of the working directory.
530 *
531 * Params:
532 * submodule = Pointer to submodule object
533 *
534 * Returns: Pointer to git_oid or null if submodule is not checked out.
535 */536 //GIT_EXTERN537 const (libgit2_d.oid.git_oid)* git_submodule_wd_id(libgit2_d.types.git_submodule* submodule);
538 539 /**
540 * Get the ignore rule that will be used for the submodule.
541 *
542 * These values control the behavior of `git_submodule_status()` for this
543 * submodule. There are four ignore values:
544 *
545 * - **git_submodule_ignore_t.GIT_SUBMODULE_IGNORE_NONE** will consider any change to the contents
546 * of the submodule from a clean checkout to be dirty, including the
547 * addition of untracked files. This is the default if unspecified.
548 * - **git_submodule_ignore_t.GIT_SUBMODULE_IGNORE_UNTRACKED** examines the contents of the
549 * working tree (i.e. call `git_status_foreach()` on the submodule) but
550 * UNTRACKED files will not count as making the submodule dirty.
551 * - **git_submodule_ignore_t.GIT_SUBMODULE_IGNORE_DIRTY** means to only check if the HEAD of the
552 * submodule has moved for status. This is fast since it does not need to
553 * scan the working tree of the submodule at all.
554 * - **git_submodule_ignore_t.GIT_SUBMODULE_IGNORE_ALL** means not to open the submodule repo.
555 * The working directory will be consider clean so long as there is a
556 * checked out version present.
557 *
558 * Params:
559 * submodule = The submodule to check
560 *
561 * Returns: The current libgit2_d.types.git_submodule_ignore_t valyue what will be used for this submodule.
562 */563 //GIT_EXTERN564 libgit2_d.types.git_submodule_ignore_tgit_submodule_ignore(libgit2_d.types.git_submodule* submodule);
565 566 /**
567 * Set the ignore rule for the submodule in the configuration
568 *
569 * This does not affect any currently-loaded instances.
570 *
571 * Params:
572 * repo = the repository to affect
573 * name = the name of the submdule
574 * ignore = The new value for the ignore rule
575 *
576 * Returns: 0 or an error code
577 */578 //GIT_EXTERN579 intgit_submodule_set_ignore(libgit2_d.types.git_repository* repo, const (char)* name, libgit2_d.types.git_submodule_ignore_tignore);
580 581 /**
582 * Get the update rule that will be used for the submodule.
583 *
584 * This value controls the behavior of the `git submodule update` command.
585 * There are four useful values documented with `libgit2_d.types.git_submodule_update_t`.
586 *
587 * Params:
588 * submodule = The submodule to check
589 *
590 * Returns: The current libgit2_d.types.git_submodule_update_t value that will be used for this submodule.
591 */592 //GIT_EXTERN593 libgit2_d.types.git_submodule_update_tgit_submodule_update_strategy(libgit2_d.types.git_submodule* submodule);
594 595 /**
596 * Set the update rule for the submodule in the configuration
597 *
598 * This setting won't affect any existing instances.
599 *
600 * Params:
601 * repo = the repository to affect
602 * name = the name of the submodule to configure
603 * update = The new value to use
604 *
605 * Returns: 0 or an error code
606 */607 //GIT_EXTERN608 intgit_submodule_set_update(libgit2_d.types.git_repository* repo, const (char)* name, libgit2_d.types.git_submodule_update_tupdate);
609 610 /**
611 * Read the fetchRecurseSubmodules rule for a submodule.
612 *
613 * This accesses the submodule.<name>.fetchRecurseSubmodules value for
614 * the submodule that controls fetching behavior for the submodule.
615 *
616 * Note that at this time, libgit2 does not honor this setting and the
617 * fetch functionality current ignores submodules.
618 *
619 * Returns: 0 if fetchRecurseSubmodules is false, 1 if true
620 */621 //GIT_EXTERN622 libgit2_d.types.git_submodule_recurse_tgit_submodule_fetch_recurse_submodules(libgit2_d.types.git_submodule* submodule);
623 624 /**
625 * Set the fetchRecurseSubmodules rule for a submodule in the configuration
626 *
627 * This setting won't affect any existing instances.
628 *
629 * Params:
630 * repo = the repository to affect
631 * name = the submodule to configure
632 * fetch_recurse_submodules = Boolean value
633 *
634 * Returns: old value for fetchRecurseSubmodules
635 */636 //GIT_EXTERN637 intgit_submodule_set_fetch_recurse_submodules(libgit2_d.types.git_repository* repo, const (char)* name, libgit2_d.types.git_submodule_recurse_tfetch_recurse_submodules);
638 639 /**
640 * Copy submodule info into ".git/config" file.
641 *
642 * Just like "git submodule init", this copies information about the
643 * submodule into ".git/config". You can use the accessor functions
644 * above to alter the in-memory git_submodule object and control what
645 * is written to the config, overriding what is in .gitmodules.
646 *
647 * Params:
648 * submodule = The submodule to write into the superproject config
649 * overwrite = By default, existing entries will not be overwritten, but setting this to true forces them to be updated.
650 *
651 * Returns: 0 on success, <0 on failure.
652 */653 //GIT_EXTERN654 intgit_submodule_init(libgit2_d.types.git_submodule* submodule, intoverwrite);
655 656 /**
657 * Set up the subrepository for a submodule in preparation for clone.
658 *
659 * This function can be called to init and set up a submodule
660 * repository from a submodule in preparation to clone it from
661 * its remote.
662 *
663 * Params:
664 * out_ = Output pointer to the created git repository.
665 * sm = The submodule to create a new subrepository from.
666 * use_gitlink = Should the workdir contain a gitlink to the repo in .git/modules vs. repo directly in workdir.
667 *
668 * Returns: 0 on success, <0 on failure.
669 */670 //GIT_EXTERN671 intgit_submodule_repo_init(libgit2_d.types.git_repository** out_, const (libgit2_d.types.git_submodule)* sm, intuse_gitlink);
672 673 /**
674 * Copy submodule remote info into submodule repo.
675 *
676 * This copies the information about the submodules URL into the checked out
677 * submodule config, acting like "git submodule sync". This is useful if
678 * you have altered the URL for the submodule (or it has been altered by a
679 * fetch of upstream changes) and you need to update your local repo.
680 */681 //GIT_EXTERN682 intgit_submodule_sync(libgit2_d.types.git_submodule* submodule);
683 684 /**
685 * Open the repository for a submodule.
686 *
687 * This is a newly opened repository object. The caller is responsible for
688 * calling `git_repository_free()` on it when done. Multiple calls to this
689 * function will return distinct `libgit2_d.types.git_repository` objects. This will only
690 * work if the submodule is checked out into the working directory.
691 *
692 * Params:
693 * repo = Pointer to the submodule repo which was opened
694 * submodule = Submodule to be opened
695 *
696 * Returns: 0 on success, <0 if submodule repo could not be opened.
697 */698 //GIT_EXTERN699 intgit_submodule_open(libgit2_d.types.git_repository** repo, libgit2_d.types.git_submodule* submodule);
700 701 /**
702 * Reread submodule info from config, index, and HEAD.
703 *
704 * Call this to reread cached submodule information for this submodule if
705 * you have reason to believe that it has changed.
706 *
707 * Params:
708 * submodule = The submodule to reload
709 * force = Force reload even if the data doesn't seem out of date
710 *
711 * Returns: 0 on success, <0 on error
712 */713 //GIT_EXTERN714 intgit_submodule_reload(libgit2_d.types.git_submodule* submodule, intforce);
715 716 /**
717 * Get the status for a submodule.
718 *
719 * This looks at a submodule and tries to determine the status. It
720 * will return a combination of the `GIT_SUBMODULE_STATUS` values above.
721 * How deeply it examines the working directory to do this will depend
722 * on the `libgit2_d.types.git_submodule_ignore_t` value for the submodule.
723 *
724 * Params:
725 * status = Combination of `GIT_SUBMODULE_STATUS` flags
726 * repo = the repository in which to look
727 * name = name of the submodule
728 * ignore = the ignore rules to follow
729 *
730 * Returns: 0 on success, <0 on error
731 */732 //GIT_EXTERN733 intgit_submodule_status(uint* status, libgit2_d.types.git_repository* repo, const (char)* name, libgit2_d.types.git_submodule_ignore_tignore);
734 735 /**
736 * Get the locations of submodule information.
737 *
738 * This is a bit like a very lightweight version of `git_submodule_status`.
739 * It just returns a made of the first four submodule status values (i.e.
740 * the ones like git_submodule_status_t.GIT_SUBMODULE_STATUS_IN_HEAD, etc) that tell you where the
741 * submodule data comes from (i.e. the HEAD commit, gitmodules file, etc.).
742 * This can be useful if you want to know if the submodule is present in the
743 * working directory at this point in time, etc.
744 *
745 * Params:
746 * location_status = Combination of first four `GIT_SUBMODULE_STATUS` flags
747 * submodule = Submodule for which to get status
748 *
749 * Returns: 0 on success, <0 on error
750 */751 //GIT_EXTERN752 intgit_submodule_location(uint* location_status, libgit2_d.types.git_submodule* submodule);
753 754 /** @} */