Answer architecture round 1: 1 🔴, 2 🟡 (0 misread); read the branch's round titles and default branch one way for rule-hook and round-count
This commit is contained in:
+6
-4
@@ -19,7 +19,7 @@ def commits(simples: list[Simple], home: str) -> list[Commit]:
|
||||
for simple in simples:
|
||||
invoked = git_subcommand(simple.words, simple.directory, home)
|
||||
if invoked and invoked[0] == "commit":
|
||||
found.append(Commit(invoked[2], *commit_message(invoked[1]), "--amend" in invoked[1]))
|
||||
found.append(Commit(invoked[2], *commit_message(invoked[1])))
|
||||
return found
|
||||
|
||||
|
||||
@@ -37,14 +37,16 @@ def git_subcommand(words: list[str], directory: str, home: str) -> tuple[str, li
|
||||
return None
|
||||
|
||||
|
||||
def commit_message(args: list[str]) -> tuple[list[str], bool]:
|
||||
"""git commit's messages, and whether it reads one from a file."""
|
||||
def commit_message(args: list[str]) -> tuple[list[str], bool, bool]:
|
||||
"""git commit's messages, whether it reads one from a file, and whether it amends."""
|
||||
messages = []
|
||||
from_file = False
|
||||
amends = False
|
||||
words = iter(args)
|
||||
for word in words:
|
||||
if word == "--":
|
||||
break
|
||||
amends = amends or word == "--amend"
|
||||
name, equals, value = word.partition("=")
|
||||
if name in ("--message", "--file"):
|
||||
given = value if equals else next(words, "")
|
||||
@@ -56,4 +58,4 @@ def commit_message(args: list[str]) -> tuple[list[str], bool]:
|
||||
continue
|
||||
messages += [given] if name == "--message" else []
|
||||
from_file = from_file or name == "--file"
|
||||
return messages, from_file
|
||||
return messages, from_file, amends
|
||||
|
||||
Reference in New Issue
Block a user