File tree 2 files changed +15
-16
lines changed
2 files changed +15
-16
lines changed Original file line number Diff line number Diff line change 8
8
exit (1 )
9
9
10
10
11
- def post_commit ():
11
+ def post_commit () -> None :
12
12
backup_file = Path (get_backup_file_path ())
13
13
14
14
# remove backup file if it exists
@@ -17,4 +17,5 @@ def post_commit():
17
17
18
18
19
19
if __name__ == "__main__" :
20
- exit (post_commit ())
20
+ post_commit ()
21
+ exit (0 )
Original file line number Diff line number Diff line change 13
13
exit (1 )
14
14
15
15
16
- def prepare_commit_msg (commit_msg_file : Path ) -> int :
16
+ def prepare_commit_msg (commit_msg_file : str ) -> int :
17
17
# check if the commit message needs to be generated using commitizen
18
- if (
19
- subprocess .run (
20
- [
21
- "cz" ,
22
- "check" ,
23
- "--commit-msg-file" ,
24
- commit_msg_file ,
25
- ],
26
- capture_output = True ,
27
- ).returncode
28
- != 0
29
- ):
18
+ exit_code = subprocess .run (
19
+ [
20
+ "cz" ,
21
+ "check" ,
22
+ "--commit-msg-file" ,
23
+ commit_msg_file ,
24
+ ],
25
+ capture_output = True ,
26
+ ).returncode
27
+ if exit_code != 0 :
30
28
backup_file = Path (get_backup_file_path ())
31
-
32
29
if backup_file .is_file ():
33
30
# confirm if commit message from backup file should be reused
34
31
answer = input ("retry with previous message? [y/N]: " )
@@ -54,6 +51,7 @@ def prepare_commit_msg(commit_msg_file: Path) -> int:
54
51
55
52
# write message to backup file
56
53
shutil .copyfile (commit_msg_file , backup_file )
54
+ return 0
57
55
58
56
59
57
if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments