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

Properly mkdir when file exists at the same path and refactor #83

Merged
merged 4 commits into from
Jun 28, 2023

Conversation

angelhof
Copy link
Member

Clean up the summary/commit logic to use the same core, and fixed the bug in #18

@angelhof angelhof linked an issue Jun 28, 2023 that may be closed by this pull request
Copy link
Contributor

@mgree mgree left a comment

Choose a reason for hiding this comment

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

I think it's okay to not be perfect here---we already will break in a few spots on newlines in filenames, and it's a bit of an overhaul to do better.

try
summary_output=$(process_changes "$SANDBOX_DIR" "$changed_files")

while IFS= read -r summary_line; do
local_file="$(echo "$summary_line" | cut -c 4-)"
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic is good, but could break with particularly nasty filenames (e.g., newlines). The most robust approach is to null terminate, à la find ... -print0 or xargs -0.

Copy link
Member Author

Choose a reason for hiding this comment

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

Great, will add an issue so that we can properly fix it (add the necessary tests). We can merge this for now (since it is a more impactful fix).

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.

commit can't mkdir on an existing file
2 participants