diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-08-26 11:32:24 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-08-26 11:32:24 -0700 |
| commit | 3222718ad7d9dfc50e31037bf2f3977d2071fb75 (patch) | |
| tree | fb2bd5fb5cd5d53c84daa07b3a0d6356b3a59583 /commit-reach.h | |
| parent | 3dd2a2feca6e47b2931dadadad44f92a35e8cf51 (diff) | |
| parent | 4b707a6e99651b1ba7c8718f95ee57c6721c85d6 (diff) | |
| download | git-3222718ad7d9dfc50e31037bf2f3977d2071fb75.tar.gz | |
Merge branch 'ds/for-each-ref-is-base'
'git for-each-ref' learned a new "--format" atom to find the branch
that the history leading to a given commit "%(is-base:<commit>)" is
likely based on.
* ds/for-each-ref-is-base:
p1500: add is-base performance tests
for-each-ref: add 'is-base' token
commit: add gentle reference lookup method
commit-reach: add get_branch_base_for_tip
Diffstat (limited to 'commit-reach.h')
| -rw-r--r-- | commit-reach.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/commit-reach.h b/commit-reach.h index bf63cc468f..9a745b7e17 100644 --- a/commit-reach.h +++ b/commit-reach.h @@ -139,4 +139,21 @@ void tips_reachable_from_bases(struct repository *r, struct commit **tips, size_t tips_nr, int mark); +/* + * Given a 'tip' commit and a list potential 'bases', return the index 'i' that + * minimizes the number of commits in the first-parent history of 'tip' and not + * in the first-parent history of 'bases[i]'. + * + * Among a list of long-lived branches that are updated only by merges (with the + * first parent being the previous position of the branch), this would inform + * which branch was used to create the tip reference. + * + * Returns -1 if no common point is found in first-parent histories, which is + * rare, but possible with multiple root commits. + */ +int get_branch_base_for_tip(struct repository *r, + struct commit *tip, + struct commit **bases, + size_t bases_nr); + #endif |
