зеркало из https://github.com/github/ruby.git
Fix the case of file to be ignored with to be removed
The case of 7fc73ab5f6
, which modified
`.gitignore` and `.github/workflows/main.yml`. Both files need to be
rejected and restored, but since the latter file was not there before,
`git checkout` failed and the former file could not be restored along
with it. To fix this failure, restore the ignored files one by one.
This commit is contained in:
Родитель
afaa164a05
Коммит
3c11cdbcfe
|
@ -596,7 +596,7 @@ module SyncDefaultGems
|
|||
unless ignore.empty?
|
||||
puts "Reset ignored files: #{ignore.join(', ')}"
|
||||
system(*%W"git rm -r --", *ignore)
|
||||
system(*%W"git checkout -f", base, "--", *ignore)
|
||||
ignore.each {|f| system(*%W"git checkout -f", base, "--", f)}
|
||||
end
|
||||
|
||||
if changed.empty?
|
||||
|
|
|
@ -97,7 +97,10 @@ module Test_SyncDefaultGems
|
|||
File.write("#{dir}/.gitignore", "*~\n")
|
||||
Dir.mkdir("#{dir}/lib")
|
||||
File.write("#{dir}/lib/common.rb", ":ok\n")
|
||||
git(*%W"add .gitignore lib/common.rb", chdir: dir)
|
||||
Dir.mkdir("#{dir}/.github")
|
||||
Dir.mkdir("#{dir}/.github/workflows")
|
||||
File.write("#{dir}/.github/workflows/default.yml", "default:\n")
|
||||
git(*%W"add .gitignore lib/common.rb .github", chdir: dir)
|
||||
git(*%W"commit -q -m", "Initialize", chdir: dir)
|
||||
if dir == "src"
|
||||
File.write("#{dir}/lib/fine.rb", "return\n")
|
||||
|
@ -222,5 +225,19 @@ module Test_SyncDefaultGems
|
|||
assert_include top_commit("src", format: "oneline"), "[ruby/#{@target}] New lib"
|
||||
assert_not_operator File, :exist?, "src/docs"
|
||||
end
|
||||
|
||||
def test_gitignore
|
||||
File.write("#@target/.gitignore", "*.bak\n", mode: "a")
|
||||
File.write("#@target/lib/common.rb", "Should.be_merged\n", mode: "a")
|
||||
File.write("#@target/.github/workflows/main.yml", "# Should not merge\n", mode: "a")
|
||||
git(*%W"add .github", chdir: @target)
|
||||
git(*%W"commit -q -m", "Should be common.rb only",
|
||||
*%W".gitignore lib/common.rb .github", chdir: @target)
|
||||
out = assert_sync()
|
||||
assert_not_equal(@sha["src"], top_commit("src"), out)
|
||||
assert_equal("*~\n", File.read("src/.gitignore"), out)
|
||||
assert_equal("#!/bin/sh\n""echo ok\n", File.read("src/tool/ok"), out)
|
||||
assert_not_operator(File, :exist?, "src/.github/workflows/.yml", out)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче