diff options
| author | Junio C Hamano <gitster@pobox.com> | 2019-01-29 12:47:54 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2019-01-29 12:47:54 -0800 |
| commit | 5d3635db19c6dff4fb063fabfa4161fd3b8285f0 (patch) | |
| tree | 30671c79e96d06267eda7d088a4ef7fd86c3ad47 /sha1-array.c | |
| parent | f33989464ecfc05a937328430b7e74819f7285dd (diff) | |
| parent | be76c2128234d94b47f7087152ee55d08bb65d88 (diff) | |
| download | git-5d3635db19c6dff4fb063fabfa4161fd3b8285f0.tar.xz | |
Merge branch 'sb/submodule-recursive-fetch-gets-the-tip'
"git fetch --recurse-submodules" may not fetch the necessary commit
that is bound to the superproject, which is getting corrected.
* sb/submodule-recursive-fetch-gets-the-tip:
fetch: ensure submodule objects fetched
submodule.c: fetch in submodules git directory instead of in worktree
submodule: migrate get_next_submodule to use repository structs
repository: repo_submodule_init to take a submodule struct
submodule: store OIDs in changed_submodule_names
submodule.c: tighten scope of changed_submodule_names struct
submodule.c: sort changed_submodule_names before searching it
submodule.c: fix indentation
sha1-array: provide oid_array_filter
Diffstat (limited to 'sha1-array.c')
| -rw-r--r-- | sha1-array.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sha1-array.c b/sha1-array.c index b94e0ec0f5..d922e94e3f 100644 --- a/sha1-array.c +++ b/sha1-array.c @@ -77,3 +77,20 @@ int oid_array_for_each_unique(struct oid_array *array, } return 0; } + +void oid_array_filter(struct oid_array *array, + for_each_oid_fn want, + void *cb_data) +{ + unsigned nr = array->nr, src, dst; + struct object_id *oids = array->oid; + + for (src = dst = 0; src < nr; src++) { + if (want(&oids[src], cb_data)) { + if (src != dst) + oidcpy(&oids[dst], &oids[src]); + dst++; + } + } + array->nr = dst; +} |
