sync_default_gems: Should match with the beginning of the strings
`git status -z` result is NUL-separated, and can contain newline characters.
This commit is contained in:
parent
04d291a490
commit
c67e496886
@ -478,13 +478,13 @@ def sync_default_gems_with_commits(gem, ranges, edit: nil)
|
|||||||
skipped = true
|
skipped = true
|
||||||
elsif /^CONFLICT/ =~ result
|
elsif /^CONFLICT/ =~ result
|
||||||
result = pipe_readlines(%W"git status --porcelain -z")
|
result = pipe_readlines(%W"git status --porcelain -z")
|
||||||
result.map! {|line| line[/^.U (.*)/, 1]}
|
result.map! {|line| line[/\A.U (.*)/, 1]}
|
||||||
result.compact!
|
result.compact!
|
||||||
ignore, conflict = result.partition {|name| IGNORE_FILE_PATTERN =~ name}
|
ignore, conflict = result.partition {|name| IGNORE_FILE_PATTERN =~ name}
|
||||||
unless ignore.empty?
|
unless ignore.empty?
|
||||||
system(*%W"git reset HEAD --", *ignore)
|
system(*%W"git reset HEAD --", *ignore)
|
||||||
File.unlink(*ignore)
|
File.unlink(*ignore)
|
||||||
ignore = pipe_readlines(%W"git status --porcelain -z" + ignore).map! {|line| line[/^.. (.*)/, 1]}
|
ignore = pipe_readlines(%W"git status --porcelain -z" + ignore).map! {|line| line[/\A.. (.*)/, 1]}
|
||||||
system(*%W"git checkout HEAD --", *ignore) unless ignore.empty?
|
system(*%W"git checkout HEAD --", *ignore) unless ignore.empty?
|
||||||
end
|
end
|
||||||
unless conflict.empty?
|
unless conflict.empty?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user