Skip commits that are empty after conflict resolution
This commit is contained in:
parent
eee83af34c
commit
925ce3f4fb
@ -558,16 +558,15 @@ module SyncDefaultGems
|
|||||||
puts "Pick #{sha} from #{repo}."
|
puts "Pick #{sha} from #{repo}."
|
||||||
|
|
||||||
# Attempt to cherry-pick a commit
|
# Attempt to cherry-pick a commit
|
||||||
skipped = false
|
|
||||||
result = IO.popen(%W"git cherry-pick #{sha}", &:read)
|
result = IO.popen(%W"git cherry-pick #{sha}", &:read)
|
||||||
if result =~ /nothing\ to\ commit/
|
if result =~ /nothing\ to\ commit/
|
||||||
`git reset`
|
`git reset`
|
||||||
skipped = true
|
|
||||||
puts "Skip empty commit #{sha}"
|
puts "Skip empty commit #{sha}"
|
||||||
|
next
|
||||||
end
|
end
|
||||||
next if skipped
|
|
||||||
|
|
||||||
# Skip empty commits or deal with conflicts
|
# Skip empty commits or deal with conflicts
|
||||||
|
skipped = false
|
||||||
if result.empty?
|
if result.empty?
|
||||||
skipped = true
|
skipped = true
|
||||||
elsif /^CONFLICT/ =~ result
|
elsif /^CONFLICT/ =~ result
|
||||||
@ -585,6 +584,7 @@ module SyncDefaultGems
|
|||||||
end
|
end
|
||||||
ignored_paths.each do |path|
|
ignored_paths.each do |path|
|
||||||
if File.exist?(path)
|
if File.exist?(path)
|
||||||
|
puts "Removing: #{path}"
|
||||||
system("git", "reset", path)
|
system("git", "reset", path)
|
||||||
rm_rf(path)
|
rm_rf(path)
|
||||||
end
|
end
|
||||||
@ -609,6 +609,12 @@ module SyncDefaultGems
|
|||||||
# UA: unmerged, added by them
|
# UA: unmerged, added by them
|
||||||
# AA: unmerged, both added
|
# AA: unmerged, both added
|
||||||
unmerged = pipe_readlines(%W"git status --porcelain -z")
|
unmerged = pipe_readlines(%W"git status --porcelain -z")
|
||||||
|
if unmerged.empty?
|
||||||
|
# Everything was removed as `ignored_paths`. Skip this commit.
|
||||||
|
`git reset` && `git checkout .` && `git clean -fd`
|
||||||
|
puts "Skip empty commit #{sha}"
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
# For YARP, we want to handle DD: deleted by both.
|
# For YARP, we want to handle DD: deleted by both.
|
||||||
if gem == "yarp"
|
if gem == "yarp"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user