mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
git-sed: use "git grep -z" and "xargs -0" to cope with spaces in filenames
Otherwise filenames with spaces result in errors:
$ cat "file with spaces in name"
old
$ git sed old new
sed: can't read file: No such file or directory
sed: can't read with: No such file or directory
sed: can't read spaces: No such file or directory
sed: can't read in: No such file or directory
sed: can't read name: No such file or directory
This commit is contained in:
parent
1ed75978a9
commit
2292e1cebe
|
|
@ -64,6 +64,6 @@ actual command:
|
|||
shift
|
||||
done
|
||||
|
||||
command="git grep -l '$search' | xargs sed -i 's/$search/$replacement/$flags'"
|
||||
git grep -l "$search" | xargs sed -i "s/$search/$replacement/$flags"
|
||||
command="git grep -lz '$search' | xargs -0 sed -i 's/$search/$replacement/$flags'"
|
||||
git grep -lz "$search" | xargs -0 sed -i "s/$search/$replacement/$flags"
|
||||
do_commit
|
||||
|
|
|
|||
Loading…
Reference in a new issue