Commit 4368921
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>1 parent 68c9fcb commit 4368921
File tree
3 files changed
+25
-16
lines changed- t
3 files changed
+25
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5819 | 5819 | | |
5820 | 5820 | | |
5821 | 5821 | | |
5822 | | - | |
| 5822 | + | |
5823 | 5823 | | |
5824 | 5824 | | |
5825 | 5825 | | |
| |||
5842 | 5842 | | |
5843 | 5843 | | |
5844 | 5844 | | |
| 5845 | + | |
5845 | 5846 | | |
5846 | 5847 | | |
5847 | 5848 | | |
| |||
5902 | 5903 | | |
5903 | 5904 | | |
5904 | 5905 | | |
5905 | | - | |
5906 | | - | |
| 5906 | + | |
| 5907 | + | |
5907 | 5908 | | |
5908 | 5909 | | |
5909 | 5910 | | |
5910 | | - | |
| 5911 | + | |
5911 | 5912 | | |
5912 | 5913 | | |
5913 | 5914 | | |
5914 | | - | |
| 5915 | + | |
5915 | 5916 | | |
5916 | | - | |
| 5917 | + | |
5917 | 5918 | | |
5918 | 5919 | | |
5919 | 5920 | | |
5920 | 5921 | | |
5921 | 5922 | | |
5922 | 5923 | | |
5923 | 5924 | | |
| 5925 | + | |
| 5926 | + | |
| 5927 | + | |
| 5928 | + | |
| 5929 | + | |
| 5930 | + | |
| 5931 | + | |
| 5932 | + | |
5924 | 5933 | | |
5925 | 5934 | | |
5926 | 5935 | | |
| |||
5933 | 5942 | | |
5934 | 5943 | | |
5935 | 5944 | | |
5936 | | - | |
| 5945 | + | |
5937 | 5946 | | |
5938 | 5947 | | |
5939 | 5948 | | |
| |||
6041 | 6050 | | |
6042 | 6051 | | |
6043 | 6052 | | |
6044 | | - | |
| 6053 | + | |
6045 | 6054 | | |
6046 | 6055 | | |
6047 | 6056 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1870 | 1870 | | |
1871 | 1871 | | |
1872 | 1872 | | |
1873 | | - | |
| 1873 | + | |
1874 | 1874 | | |
1875 | 1875 | | |
1876 | 1876 | | |
| |||
1881 | 1881 | | |
1882 | 1882 | | |
1883 | 1883 | | |
1884 | | - | |
| 1884 | + | |
1885 | 1885 | | |
1886 | 1886 | | |
1887 | 1887 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
| 122 | + | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
465 | | - | |
| 465 | + | |
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
469 | | - | |
| 469 | + | |
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
| |||
0 commit comments