diff options
author | Nicolas Guichard <nicolas@guichard.eu> | 2024-10-09 07:58:20 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-10-09 10:52:46 -0700 |
commit | 436892123dd9d442fe4f534bba6f7ead635db06c (patch) | |
tree | 332a50ff257c0fe795279b8ed6717cca666ee22e /commit.c | |
parent | 68c9fcb027b4bd2e5d10618829937ee50503c281 (diff) |
rebase-merges: try and use branch names as labels
When interactively rebasing merge commits, the commit message is parsed to
extract a probably meaningful label name. For instance if the merge commit
is “Merge branch 'feature0'”, then the rebase script will have thes lines:
```
label feature0
merge -C $sha feature0 # “Merge branch 'feature0'
```
This heuristic fails in the case of octopus merges or when the merge commit
message is actually unrelated to the parent commits.
An example that combines both is:
```
*---. 967bfa4 (HEAD -> integration) Integration
|\ \ \
| | | * 2135be1 (feature2, feat2) Feature 2
| |_|/
|/| |
| | * c88b01a Feature 1
| |/
|/|
| * 75f3139 (feat0) Feature 0
|/
* 25c86d0 (main) Initial commit
```
yields the labels Integration, Integration-2 and Integration-3.
Fix this by using a branch name for each merge commit's parent that is the
tip of at least one branch, and falling back to a label derived from the
merge commit message otherwise.
In the example above, the labels become feat0, Integration and feature2.
Signed-off-by: Nicolas Guichard <nicolas@guichard.eu>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions