Skip to content

Commit

Permalink
Fix bug with case-insensitive filesystems
Browse files Browse the repository at this point in the history
- Path exists conflict is no longer triggered when the casing of a
  filename is changed. e.g from abc.md to ABC.md
  • Loading branch information
ayoisaiah committed May 4, 2021
1 parent cfa294a commit a59b18b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func getAllVariables(str string) (replaceVars, error) {
return v, nil
}

// regexReplace handles string replacement in regex mode
// regexReplace handles string replacement
func (op *Operation) regexReplace(
r *regexp.Regexp,
fileName, replacement string,
Expand Down
3 changes: 2 additions & 1 deletion src/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ func (op *Operation) detectConflicts() {
if _, err := os.Stat(target); err == nil ||
errors.Is(err, os.ErrExist) {
// Don't report a conflict for an unchanged filename
if source == target {
// Also handles case-insensitive filesystems
if strings.EqualFold(source, target) {
continue
}

Expand Down

0 comments on commit a59b18b

Please sign in to comment.