Skip to content

Instantly share code, notes, and snippets.

@patmaddox
Created July 6, 2021 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patmaddox/61ddf773f7b65bd2b42cee7f4e5e574d to your computer and use it in GitHub Desktop.
Save patmaddox/61ddf773f7b65bd2b42cee7f4e5e574d to your computer and use it in GitHub Desktop.
a script to show which untracked files will get annexed and which will be tracked by git
#!/usr/bin/env ruby
largefiles = `git annex config --get annex.largefiles`
untracked_files = `git ls-files --others --exclude-standard`
annex_files = []
git_files = []
untracked_files.split("\n").each do |file|
`git annex matchexpression "#{largefiles}" --largefiles --file "#{file}"`
if $?.exitstatus == 0
annex_files << file
else
git_files << file
end
end
puts "files to annex:"
annex_files.each {|f| puts "\t- #{f}"}
puts
puts "files to git:"
git_files.each {|f| puts "\t- #{f}"}
puts
puts "annex.largefiles:"
puts "\t#{largefiles}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment