|
10 | 10 | # Authors: See CONTRIBUTORS.txt |
11 | 11 | # Software description: A toolbox of scripts to help work of forges admins and open source referents |
12 | 12 |
|
13 | | -# Version.............: 1.0.0 |
| 13 | +# Version.............: 1.0.1 |
14 | 14 | # Since...............: 03/04/2023 |
15 | 15 | # Description.........: Using the Git history, generates a CONTRIBUTORS.md file |
16 | 16 |
|
|
56 | 56 | print(f"✏️ Creating folder '{TEMP_FOLDER}' with internal stuff in target") |
57 | 57 | os.makedirs(TEMP_FOLDER_FULL_PATH, exist_ok=True) |
58 | 58 |
|
59 | | -# Check if Git repository is empty (check if there are at least 1 commit in the logs) |
| 59 | +# Check if Git repository is empty (check if there is at least 1 commit in the logs) |
60 | 60 | command_result_output = subprocess.check_output("git log --oneline -1 > /dev/null 2>&1 | wc -l", shell=True) |
61 | 61 | command_result = int(command_result_output.decode().strip()) |
62 | 62 | if command_result == "0": |
|
67 | 67 |
|
68 | 68 | # Dump Git logs |
69 | 69 | print("✏️ Dumping Git logs") |
70 | | -# Create the log file, go to targetn and run the git command |
71 | | -# Format the output to have first name, last name (upercased) and email, sorted alphabetically ascending |
72 | | -# Deal also the case where we only have one value between first and last name |
| 70 | +# Create the log file, go to target, and run the git command. |
| 71 | +# Format the output to have first name, last name (upercased) and email, sorted ascending alphabetically. |
| 72 | +# Deal also the case where we only have one value between first and last name. |
73 | 73 | git_log_command = """ |
74 | | -touch {log_file} && cd {target} && git log --all --format="%aN <%aE>" | sort | uniq | awk '{{if ($2 !~ /@/) {{print $1, toupper($2), $3}} else {{print $1, $2, $3}}}}' | sort -k2 > {log_file} |
| 74 | +touch "{log_file}" && cd "{target}" && git log --all --format="%aN <%aE>" | sort | uniq | awk '{{if ($2 !~ /@/) {{print $1, toupper($2), $3}} else {{print $1, $2, $3}}}}' | sort -k2 > "{log_file}" |
75 | 75 | """.format(target=target, log_file=GIT_LOG_TEMP_FILE_PATH) |
76 | 76 | os.system(git_log_command) |
77 | 77 |
|
78 | | -contributors_count_output = subprocess.check_output("cat {log_file} | wc -l".format(log_file=GIT_LOG_TEMP_FILE_PATH), shell=True) |
| 78 | +contributors_count_output = subprocess.check_output("cat '{log_file}' | wc -l".format(log_file=GIT_LOG_TEMP_FILE_PATH), shell=True) |
79 | 79 | contributors_count = int(contributors_count_output.decode().strip()) |
80 | 80 | print(f"👉 Found maybe {contributors_count} contributors") |
81 | 81 |
|
|
0 commit comments