Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redact all the lines in src/ from @sonicdcer #1584

Closed
wants to merge 1 commit into from
Closed

Conversation

Xeeynamo
Copy link
Owner

@Xeeynamo Xeeynamo commented Sep 4, 2024

def redact_author_lines(file_name, author):
    try:
        result = subprocess.run(
            ["git", "blame", "-C", "-C", "-C", "-M", file_name],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            text=True
        )
        lines = result.stdout.splitlines()
        with open(file_name, 'r') as file:
            original_lines = file.readlines()
        redacted_lines = []
        for i, line in enumerate(lines):
            if author in line:
                redacted_lines.append("REDACTED\n")
            else:
                redacted_lines.append(original_lines[i])
        with open(file_name, 'w') as file:
            file.writelines(redacted_lines)
    except subprocess.CalledProcessError as e:
        print(f"Error running git blame on {file_name}: {e}")
    except Exception as e:
        print(f"Error processing file {file_name}: {e}")

for file_name in file_list:
    redact_author_lines(file_name, "Alejandro")

Required before merging #1565 . This only takes account of the files in src/. I will create a follow-up PR for include/. The build is failing, so we need to push commits to this PR to fix it over time. Some functions might get totally replaced.

The script uses a git blame -C -C -C to take account of files that moved via file splits and refactors. This is done programmatically to ensure contributions are accurately removed. I double-checked the results to ensure the script works accurately.

@sozud
Copy link
Collaborator

sozud commented Sep 4, 2024

My opinion is that this isn't the right approach, we need to go PR by PR and revert each one. If SD originally submitted a function, modifications to that function are a derived work of his. So we can't just do a git blame and remove any line that has his authorship on current master. I'd create a wiki page with a list of his PRs and check each one off as they are reverted. This would also allow an incremental process rather than fixing a monster PR like this

@KiritoDv
Copy link

KiritoDv commented Sep 5, 2024

I don't wanna create more problems but you can't just remove code from someone since like sozud said, any other code could be a derivate from this work, and could even cause legal problems to you, just saying.

@bismurphy
Copy link
Collaborator

I am very happy to have the opportunity to close this PR. Lots of good code that will not go to waste.

@bismurphy bismurphy closed this Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants