Skip to content

Commit

Permalink
fixed rename handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nleanba committed Mar 4, 2024
1 parent c0b51e4 commit e43c515
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/repoActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export function getModifiedAfter(
args: [
"diff",
"--name-status",
"--no-renames", // handle renames as a deletion and an addition
fromCommit,
tillCommit,
],
Expand All @@ -102,6 +103,14 @@ export function getModifiedAfter(
const typedFiles = new TextDecoder().decode(stdout).split("\n").filter((s) =>
s.length > 0
).map((s) => s.split(/(\s+)/).filter((p) => p.trim().length > 0));
const weirdFiles = typedFiles.filter((t) =>
t[0] !== "A" && t[0] !== "M" && t[0] !== "D"
);
if (weirdFiles.length) {
log(`Unclear how to handle these files:\n - ${
weirdFiles.map((t) => t.join).join("\n - ")
}`);
}
return ({
added: typedFiles.filter((t) => t[0] === "A").map((t) => t[1]),
modified: typedFiles.filter((t) => t[0] === "M").map((t) => t[1]),
Expand Down

0 comments on commit e43c515

Please sign in to comment.