Skip to content

Commit 1ebf35c

Browse files
committed
fix splits and order
1 parent 811789a commit 1ebf35c

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

landoscript/src/landoscript/actions/version_bump.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ async def run(
9898
log.info("no files to bump")
9999
return []
100100

101+
def extract_path(diff_text):
102+
return diff_text.split("\n", 1)[0].split(" ")[2][2:]
103+
104+
diffs = sorted(diffs, key=extract_path)
101105
diff = "\n".join(diffs)
102106

103107
with open(os.path.join(public_artifact_dir, "version-bump.diff"), "w+") as f:

landoscript/tests/conftest.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,17 @@ def assert_add_commit_response(action, commit_msg_strings, initial_values, expec
219219

220220
# Extract file paths from diffs and verify they are sorted
221221
file_paths = []
222-
for diff in diffs:
222+
for i, diff in enumerate(diffs):
223223
if not diff:
224224
continue
225225

226-
path_line = diff.split("\n")[0]
227-
if path_line.startswith("diff --git"):
228-
file_path = path_line.split(" ")[2][2:]
229-
file_paths.append(file_path)
226+
if i == 0:
227+
path_line = diff.split("\n")[0]
228+
else:
229+
path_line = "diff" + diff.split("\n")[0]
230+
231+
file_path = path_line.split(" ")[2][2:]
232+
file_paths.append(file_path)
230233

231234
assert file_paths == sorted(file_paths), f"Files in diff are not sorted. Got: {file_paths}"
232235

0 commit comments

Comments
 (0)