Skip to contentSkip to conversation

ez: get_series_details: correctly compute 'base_commit' for all strategies

PATCH Applied Philippe Blain 2 participants 2 messages Feb 22, 2023 – Mar 3, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ez: get_series_details: correctly compute 'base_commit' for all strategies

In f0fad6e (ez: refactor based on initial feedback, 2022-07-20), support was added for the 'branch-description' strategy, but 'get_series_details' was not changed to account for the fact that if the cover letter is stored in the branch description, base_commit and start_commit should be the same commit.

This was also missed when 9e95d52 (ez: implement tip-commit strategy, 2022-07-27) added support for the 'tip-commit' strategy and changed get_series_details to adjust the end commit of the series.

Fix that by setting 'base_commit' to 'start_commit's parent only for the 'commit' strategy, and to 'start_commit' for other strategies.

---
 b4/ez.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
b4/ez.py +6 -3
index 74afddc..5f4d744 100644
@@ -940,10 +940,13 @@ def get_addresses_from_cmd(cmdargs: List[str], msgbytes: bytes) -> List[Tuple[st
 def get_series_details(start_commit: Optional[str] = None) -> Tuple[str, str, str, List[str], str, str]:
     if not start_commit:
         start_commit = get_series_start()
-    gitargs = ['rev-parse', f'{start_commit}~1']
-    lines = b4.git_get_command_lines(None, gitargs)
-    base_commit = lines[0]
     strategy = get_cover_strategy()
+    if strategy == 'commit':
+        gitargs = ['rev-parse', f'{start_commit}~1']
+        lines = b4.git_get_command_lines(None, gitargs)
+        base_commit = lines[0]
+    else:
+        base_commit = start_commit
     if strategy == 'tip-commit':
         cover_commit = find_cover_commit()
         endrange = b4.git_revparse_obj(f'{cover_commit}~1')

---
base-commit: ada3021c64dd484e53219eb3af55da6c8f25d0ec
change-id: 20230221-fix-base-commit-for-non-commit-strategies-a0d6ef465d86 --
b4

#1 lore raw
Quoted 11 lines · Philippe Blain

In f0fad6e (ez: refactor based on initial feedback, 2022-07-20), support was added for the 'branch-description' strategy, but 'get_series_details' was not changed to account for the fact that if the cover letter is stored in the branch description, base_commit and start_commit should be the same commit.

This was also missed when 9e95d52 (ez: implement tip-commit strategy, 2022-07-27) added support for the 'tip-commit' strategy and changed get_series_details to adjust the end commit of the series.

[...]

Applied, thanks!

[1/1] ez: get_series_details: correctly compute 'base_commit' for all strategies

      commit: 221cc6ccd40d3e643bc65b34f2fca72ad2a69363

Best regards,

Signature · 1 line
Konstantin Ryabitsev <[email protected]>