mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
pseudo-merge: implement support for reading pseudo-merge commits
Implement the basic API for reading pseudo-merge bitmaps, which consists
of four basic functions:
- pseudo_merge_bitmap()
- use_pseudo_merge()
- apply_pseudo_merges_for_commit()
- cascade_pseudo_merges()
These functions are all documented in pseudo-merge.h, but their rough
descriptions are as follows:
- pseudo_merge_bitmap() reads and inflates the objects EWAH bitmap for
a given pseudo-merge
- use_pseudo_merge() does the same as pseudo_merge_bitmap(), but on
the commits EWAH bitmap, not the objects bitmap
- apply_pseudo_merges_for_commit() applies all satisfied pseudo-merge
commits for a given result set, and cascades any yet-unsatisfied
pseudo-merges if any were applied in the previous step
- cascade_pseudo_merges() applies all pseudo-merges which are
satisfied but have not been previously applied, repeating this
process until no more pseudo-merges can be applied
The core of the API is the latter two functions, which are responsible
for applying pseudo-merges during the object traversal implemented in
the pack-bitmap machinery.
The other two functions (pseudo_merge_bitmap(), and use_pseudo_merge())
are low-level ways to interact with the pseudo-merge machinery, which
will be useful in future commits.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
7c0fae8844
commit
955747b4da
@@ -162,4 +162,48 @@ struct pseudo_merge {
|
||||
*/
|
||||
void free_pseudo_merge_map(struct pseudo_merge_map *pm);
|
||||
|
||||
/*
|
||||
* Loads the bitmap corresponding to the given pseudo-merge from the
|
||||
* map, if it has not already been loaded.
|
||||
*/
|
||||
struct ewah_bitmap *pseudo_merge_bitmap(const struct pseudo_merge_map *pm,
|
||||
struct pseudo_merge *merge);
|
||||
|
||||
/*
|
||||
* Loads the pseudo-merge and its commits bitmap from the given
|
||||
* pseudo-merge map, if it has not already been loaded.
|
||||
*/
|
||||
struct pseudo_merge *use_pseudo_merge(const struct pseudo_merge_map *pm,
|
||||
struct pseudo_merge *merge);
|
||||
|
||||
/*
|
||||
* Applies pseudo-merge(s) containing the given commit to the bitmap
|
||||
* "result".
|
||||
*
|
||||
* If any pseudo-merge(s) were satisfied, returns the number
|
||||
* satisfied, otherwise returns 0. If any were satisfied, the
|
||||
* remaining unsatisfied pseudo-merges are cascaded (see below).
|
||||
*/
|
||||
int apply_pseudo_merges_for_commit(const struct pseudo_merge_map *pm,
|
||||
struct bitmap *result,
|
||||
struct commit *commit, uint32_t commit_pos);
|
||||
|
||||
/*
|
||||
* Applies pseudo-merge(s) which are satisfied according to the
|
||||
* current bitmap in result (or roots, see below). If any
|
||||
* pseudo-merges were satisfied, repeat the process over unsatisfied
|
||||
* pseudo-merge commits until no more pseudo-merges are satisfied.
|
||||
*
|
||||
* Result is the bitmap to which the pseudo-merge(s) are applied.
|
||||
* Roots (if given) is a bitmap of the traversal tip(s) for either
|
||||
* side of a reachability traversal.
|
||||
*
|
||||
* Roots may given instead of a populated results bitmap at the
|
||||
* beginning of a traversal on either side where the reachability
|
||||
* closure over tips is not yet known.
|
||||
*/
|
||||
int cascade_pseudo_merges(const struct pseudo_merge_map *pm,
|
||||
struct bitmap *result,
|
||||
struct bitmap *roots);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user