Skip to content

feat: add rename-file command#1149

Merged
hyperupcall merged 4 commits intotj:mainfrom
CodeByZach:add-git-rename-file
Aug 2, 2024
Merged

feat: add rename-file command#1149
hyperupcall merged 4 commits intotj:mainfrom
CodeByZach:add-git-rename-file

Conversation

@CodeByZach
Copy link
Copy Markdown
Contributor

@CodeByZach CodeByZach commented Jul 10, 2024

Rename a file or directory and ensure Git recognizes the change, regardless of filesystem case-sensitivity. It combines the functionality of the mv command and git mv. This is particularly useful for renaming files or directories to change only their case, which might not be detected by Git on case-insensitive filesystems.

I initially considered naming it git-mv due to its intuitive functionality. However, I noticed that the naming convention in the repository includes both commands with and without the dash following "git-". To avoid conflict with the native git mv command, I opted for git-rename-file instead.

  • Added new command 'rename-file' to rename files and directories within a Git repository regardless of filesystem case-sensitivity.
  • Updated AUTHORS and documentation in Commands.md.
  • Implemented bash, zsh, and fish completions for 'rename-file'.
  • Created manual pages for 'rename-file' in various formats (man, html, md).
  • Updated index.txt to include 'rename-file' command.

- Added new command 'rename-file' to rename files and directories within a Git repository regardless of filesystem case-sensitivity.
- Updated AUTHORS and documentation in Commands.md.
- Implemented bash, zsh, and fish completions for 'rename-file'.
- Created manual pages for 'rename-file' in various formats (man, html, md).
- Updated index.txt to include 'rename-file' command.
@CodeByZach CodeByZach marked this pull request as ready for review July 10, 2024 00:42
Comment thread bin/git-rename-file
Comment thread bin/git-rename-file
Comment thread bin/git-rename-file
Comment thread bin/git-rename-file Outdated
Comment thread bin/git-rename-file Outdated
Comment thread bin/git-rename-file
# Check if the destination directory exists
DEST_DIR=$(dirname "$DESTINATION")
if ! check_case_sensitive_exists "$DEST_DIR"; then
echo "Error: Destination directory '$DEST_DIR' does not exist."
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Small nit, but it would be good to redirect all errors to standard error. I believe that's consistent with the rest of the code;

@hyperupcall
Copy link
Copy Markdown
Collaborator

Thanks, this looks good - I had a few suggestions;

@CodeByZach
Copy link
Copy Markdown
Contributor Author

Apologies, just catching up here. What's left before this can be merged?

@hyperupcall
Copy link
Copy Markdown
Collaborator

hyperupcall commented Jul 24, 2024

@CodeByZach Hey, a must is to have the lint check in CI pass (if it's a lot of issues, running shfmt locally should speed things up). While you do that it would be a good idea to address the code change recommendations

@CodeByZach
Copy link
Copy Markdown
Contributor Author

CodeByZach commented Jul 24, 2024

@CodeByZach Hey, a must is to have the lint check in CI pass (if it's a lot of issues, running shfmt locally should speed things up). While you do that it would be a good idea to address the code change recommendations

Seems easy enough. Will get on it.
image

@spacewander spacewander requested a review from hyperupcall July 26, 2024 03:12
@hyperupcall
Copy link
Copy Markdown
Collaborator

hyperupcall commented Jul 26, 2024

@CodeByZach Thank you for the update; I'll be able to merge this once @spacewander's comments here and here are addressed;

@CodeByZach
Copy link
Copy Markdown
Contributor Author

@CodeByZach Thank you for the update; I'll be able to merge this once @spacewander's comments here and here are addressed;

Should now be addressed.

Copy link
Copy Markdown
Collaborator

@hyperupcall hyperupcall left a comment

Choose a reason for hiding this comment

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

Thanks, changes are good

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.

3 participants