How do I define a global gitignore, or implement it as a global pre-receive hook, in gitlab?
- 阅读更多 关于 How do I define a global gitignore, or implement it as a global pre-receive hook, in gitlab?
问题 In the ruby hook, I need to check the staged file format and restrict the commit, If the commit have .exe or .dll file. I got the idea to get the file list in ruby git diff --cached --name-only --diff-filter=ACM , But I failed to use the line in ruby script because I am newbie for ruby script. #!/usr/bin/env ruby Dir[git diff --cached --name-only --diff-filter=ACM].any? do |f| %w|.txt .pdf .dll|.include?(File.extname(f)) puts "Your commit have exe or dll file. Kindly remove the file an$ exit