Last active
March 3, 2021 22:43
-
-
Save jonico/eed1fca0d4a9bf6ce95286d99aea177b to your computer and use it in GitHub Desktop.
Search through all reachable commits in all branches and tags in all repos on GitHub Enterprise Server for a pattern (run it on a backup system)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Replace the string "Hyrule" with your search pattern - only run on backup system - will take a LOOOONG time to run through | |
ghe-console -y <<'ENDSCRIPT' | |
Repository.find_each do |repository| | |
if repository.active && !repository.empty? then | |
host,path = GitHub::Routing.lookup_route(repository.nwo) | |
puts "Processing repo #{repository.nwo} ..." | |
refs=`git --git-dir=#{path} rev-list --branches --tags | sort | uniq` | |
refs.each_line do |ref| | |
if system("git --git-dir=#{path} grep 'Hyrule' #{ref}") | |
puts "Found pattern in ref #{ref} in repo #{repository.nwo}: " | |
puts `git --git-dir=#{path} grep 'Hyrule' #{ref}` | |
end | |
end | |
end | |
end | |
ENDSCRIPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment