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

Adjust the text replacement logic #30

Merged
merged 3 commits into from
Nov 6, 2023

Conversation

mcdonnnj
Copy link
Member

@mcdonnnj mcdonnnj commented Sep 27, 2023

🗣 Description

This pull request adjusts the functionality of the repository name replacement logic in the following ways:

  • Change how the .git/ directory is ignored.
  • Do not change the .github/dependabot.yml file.
  • Also perform a replacement of <src_org>/<src_repo> and not just <src_repo>.

💭 Motivation and context

I originally looked at this to handle the second bullet point of the above list because there are attribution comments in the Dependabot configuration file. These should not be replaced in repositories based on a skeleton project and there is nothing else that would warrant replacement in that file so it is safe to ignore it completely. While looking at the logic I noticed that the find seemed to inefficiently ignore the .git/ directory and I have run into a problem when using this tool to start projects in my personal account where I have instances of cisagov/<new_repo_name> such as in the README badges.

🧪 Testing

Automated tests pass. I tested the find logic in my WSL container and on my work MacBook to check the logic under both Linux and macOS systems.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated
    to reflect the changes in this PR.
  • All new and existing tests pass.

It is more performant to prune the entire .git/ directory than to check
each object and see if it begins with './.git' as is currently being
done.
Source repository names may show up in attribution comments for ignore
directives in this file. We do not want to replace these and there is
nothing else that would need to be replaced in this file.
Add an additional `-exec` to the name replacement logic to include the
replacement of the organization name. This will replace any instances
of <src_org>/<src_repo> with <dest_org>/<dest_repo< before the
replacement of repository names occurs. This will help ensure that all
appropriate name replacements are taking place.
@mcdonnnj mcdonnnj added breaking change This issue or pull request involves changes to existing functionality bug This issue or pull request addresses broken functionality improvement This issue or pull request will add or improve functionality, maintainability, or ease of use labels Sep 27, 2023
@mcdonnnj mcdonnnj self-assigned this Sep 27, 2023
Copy link
Member

@dav3r dav3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@mcdonnnj mcdonnnj merged commit 2bd5c06 into develop Nov 6, 2023
4 checks passed
@mcdonnnj mcdonnnj deleted the improvement/adjust_replacement_find branch November 6, 2023 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change This issue or pull request involves changes to existing functionality bug This issue or pull request addresses broken functionality improvement This issue or pull request will add or improve functionality, maintainability, or ease of use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants