Skip to content

Instantly share code, notes, and snippets.

@technoweenie
Last active December 1, 2015 18:39
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 technoweenie/aaf3a136ada42deefd92 to your computer and use it in GitHub Desktop.
Save technoweenie/aaf3a136ada42deefd92 to your computer and use it in GitHub Desktop.
script that shows files not in lfs
require "set"
lfs_file_output = `git lfs ls-files`
lfs_files = lfs_file_output.
chomp. # strip ending \n
split("\n"). # array of lines
map { |line| line.split.last } # filename is at the end of the line
current_commit = `git rev-parse HEAD`.chomp
git_output = `git ls-tree #{current_commit} -r`
git_files = git_output.
chomp. # strip ending \n
split("\n"). # array of lines
map { |line| line.split.last } # filename is at the end of the line
extensions = Set.new(%w(
.dll
.exe
.lib
.pdb
.dylib
.rhp
.cubin
.chm
.ai
.psd
.doxdb
.msm
.aqt
.tlb
.zip
.a
))
# filter out files not matching extensions above
git_files = git_files.select do |path|
extensions.include?(File.extname(path).downcase)
end
lfs_set = Set.new(lfs_files)
missing = git_files.reject do |path|
lfs_set.include?(path)
end
if ENV["DEBUG"]
puts "%d LFS file(s):" % lfs_files.size
puts lfs_files
puts
puts "%d Git file(s):" % git_files.size
puts git_files
puts
end
if missing.empty?
puts "All files using Git LFS"
else
puts "%d file(s) not using Git LFS:" % missing.size
puts missing
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment