Skip to content

Commit

Permalink
[#171] [#172] Permission and path with whitespaces fixes (#173)
Browse files Browse the repository at this point in the history
* fix: failed to process Git repository at path with whitespaces (#172)

Closes #172

Signed-off-by: Pierre-Yves Lapersonne <[email protected]>

* fix: execution permission to Shell script missing (#171)

Closes #171

Signed-off-by: Pierre-Yves Lapersonne <[email protected]>

---------

Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
  • Loading branch information
pylapp authored Sep 16, 2024
1 parent 2eb20d5 commit 04d5572
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [Licenses Inventory] Update to v4.0.6 ([#160](https://github.com/Orange-OpenSource/floss-toolbox/issues/160))

### Fixed

- [Diver] Missing execution permission for extract-emails-from-history.sh ([#171](https://github.com/Orange-OpenSource/floss-toolbox/issues/171))
- [Diver] Failed to process repositories at path with whitespaces ([#172](https://github.com/Orange-OpenSource/floss-toolbox/issues/172))

## [2.20.0](https://github.com/Orange-OpenSource/floss-toolbox/compare/2.20.0..2.19.0) - 2024-04-04

### Added
Expand Down
Empty file modified toolbox/diver/extract-emails-from-history.sh
100644 → 100755
Empty file.
14 changes: 7 additions & 7 deletions toolbox/diver/generate-contributors-file.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Authors: See CONTRIBUTORS.txt
# Software description: A toolbox of scripts to help work of forges admins and open source referents

# Version.............: 1.0.0
# Version.............: 1.0.1
# Since...............: 03/04/2023
# Description.........: Using the Git history, generates a CONTRIBUTORS.md file

Expand Down Expand Up @@ -56,7 +56,7 @@
print(f"✏️ Creating folder '{TEMP_FOLDER}' with internal stuff in target")
os.makedirs(TEMP_FOLDER_FULL_PATH, exist_ok=True)

# Check if Git repository is empty (check if there are at least 1 commit in the logs)
# Check if Git repository is empty (check if there is at least 1 commit in the logs)
command_result_output = subprocess.check_output("git log --oneline -1 > /dev/null 2>&1 | wc -l", shell=True)
command_result = int(command_result_output.decode().strip())
if command_result == "0":
Expand All @@ -67,15 +67,15 @@

# Dump Git logs
print("✏️ Dumping Git logs")
# Create the log file, go to targetn and run the git command
# Format the output to have first name, last name (upercased) and email, sorted alphabetically ascending
# Deal also the case where we only have one value between first and last name
# Create the log file, go to target, and run the git command.
# Format the output to have first name, last name (upercased) and email, sorted ascending alphabetically.
# Deal also the case where we only have one value between first and last name.
git_log_command = """
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}
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}"
""".format(target=target, log_file=GIT_LOG_TEMP_FILE_PATH)
os.system(git_log_command)

contributors_count_output = subprocess.check_output("cat {log_file} | wc -l".format(log_file=GIT_LOG_TEMP_FILE_PATH), shell=True)
contributors_count_output = subprocess.check_output("cat '{log_file}' | wc -l".format(log_file=GIT_LOG_TEMP_FILE_PATH), shell=True)
contributors_count = int(contributors_count_output.decode().strip())
print(f"👉 Found maybe {contributors_count} contributors")

Expand Down

0 comments on commit 04d5572

Please sign in to comment.