From 730be65514cac409073ad41faf3599889a3d7ca7 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Sat, 28 Feb 2015 16:08:16 +0100 Subject: [PATCH 1/2] Ignore symlinks in repository statistics --- lib/linguist/repository.rb | 4 +- test/fixtures/SVG/alg_schema.link.svg | 1 + test/fixtures/SVG/alg_schema.svg | 269 ++++++++++++++++++++++++++ 3 files changed, 272 insertions(+), 2 deletions(-) create mode 120000 test/fixtures/SVG/alg_schema.link.svg create mode 100644 test/fixtures/SVG/alg_schema.svg diff --git a/lib/linguist/repository.rb b/lib/linguist/repository.rb index 895a3754..b45b825d 100644 --- a/lib/linguist/repository.rb +++ b/lib/linguist/repository.rb @@ -150,9 +150,9 @@ module Linguist next if delta.binary if [:added, :modified].include? delta.status - # Skip submodules + # Skip submodules and symlinks mode = delta.new_file[:mode] - next if (mode & 040000) != 0 + next if (mode & 0040000) != 0 || (mode & 0120000) != 0 blob = Linguist::LazyBlob.new(repository, delta.new_file[:oid], new, mode.to_s(8)) diff --git a/test/fixtures/SVG/alg_schema.link.svg b/test/fixtures/SVG/alg_schema.link.svg new file mode 120000 index 00000000..2f2cb2e4 --- /dev/null +++ b/test/fixtures/SVG/alg_schema.link.svg @@ -0,0 +1 @@ +alg_schema.svg \ No newline at end of file diff --git a/test/fixtures/SVG/alg_schema.svg b/test/fixtures/SVG/alg_schema.svg new file mode 100644 index 00000000..cd709914 --- /dev/null +++ b/test/fixtures/SVG/alg_schema.svg @@ -0,0 +1,269 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + Sequence KEY256 bits + + + + + Salt96 bits Counter32 bits + + + + + AES Cipher + + + + + + + Secure random data128 bits + + + Division by alphabet lengthrepeated passcode-length times. + + + + Passcode2-16 characters + + + + From f98e6bdac728a32366b8bea25796b572f3e8dc09 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Sat, 4 Jul 2015 17:14:30 +0200 Subject: [PATCH 2/2] Use proper format for symlinks, submodules and trees --- lib/linguist/repository.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/linguist/repository.rb b/lib/linguist/repository.rb index b45b825d..181ddf0e 100644 --- a/lib/linguist/repository.rb +++ b/lib/linguist/repository.rb @@ -152,7 +152,8 @@ module Linguist if [:added, :modified].include? delta.status # Skip submodules and symlinks mode = delta.new_file[:mode] - next if (mode & 0040000) != 0 || (mode & 0120000) != 0 + mode_format = (mode & 0170000) + next if mode_format == 0120000 || mode_format == 040000 || mode_format == 0160000 blob = Linguist::LazyBlob.new(repository, delta.new_file[:oid], new, mode.to_s(8))