From c67e49688642b5a650f53765dd11c1202d1ea57f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 12 Oct 2022 11:38:44 +0900 Subject: sync_default_gems: Should match with the beginning of the strings `git status -z` result is NUL-separated, and can contain newline characters. --- tool/sync_default_gems.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tool/sync_default_gems.rb') diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index 1e8c086dcf..530ec6e7b3 100755 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -478,13 +478,13 @@ def sync_default_gems_with_commits(gem, ranges, edit: nil) skipped = true elsif /^CONFLICT/ =~ result result = pipe_readlines(%W"git status --porcelain -z") - result.map! {|line| line[/^.U (.*)/, 1]} + result.map! {|line| line[/\A.U (.*)/, 1]} result.compact! ignore, conflict = result.partition {|name| IGNORE_FILE_PATTERN =~ name} unless ignore.empty? system(*%W"git reset HEAD --", *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? end unless conflict.empty? -- cgit v1.2.1