Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #4 from zapadinsky/master

Windows support
  • Loading branch information...
commit c1b93e589a81fa888370383a8136e67388b2b452 2 parents 30828f9 + 77f004e
@schacon schacon authored
View
5 README.rdoc
@@ -14,7 +14,7 @@ Setup the attributes filter settings.
Setup the .gitattributes file to map extensions to the filter.
(in repo - once)
- $ echo "*.mov filter=media" > .gitattributes
+ $ echo "*.mov filter=media -crlf" > .gitattributes
Staging files with those extensions will automatically copy them to the
media buffer area (.git/media) until you run 'git media sync' wherein they
@@ -76,6 +76,9 @@ that is. If you want to upload & delete the local cache of media files, run:
$ sudo gem install git-media-0.1.1.gem
== Notes for Windows
+It is important to switch off git smart newline character support for media files.
+Use "-crlf" switch in .gitattributes (for example "*.mov filter=media -crlf") or config option "core.autocrlf = false".
+
If installing on windows, you might run into a problem verifying certificates
for S3 or something. If that happens, modify
C:\Ruby191\lib\ruby\gems\1.9.1\gems\right_http_connection-1.2.4\lib\right_http_connection.rb
View
4 lib/git-media/filter-clean.rb
@@ -24,7 +24,9 @@ def self.run!
tempfile.close
# calculate and print the SHA of the data
- puts hx = hashfunc.hexdigest
+ STDOUT.print hx = hashfunc.hexdigest
+ STDOUT.binmode
+ STDOUT.write("\n")
# move the tempfile to our media buffer area
media_file = File.join(media_buffer, hx)
View
7 lib/git-media/filter-smudge.rb
@@ -6,8 +6,8 @@ def self.run!
can_download = false # TODO: read this from config and implement
# read checksum size
- sha = STDIN.read(41)
- if STDIN.eof? && sha[40, 1] == "\n"
+ sha = STDIN.readline(64).strip # read no more than 64 bytes
+ if STDIN.eof? && sha.length == 40 && sha.match(/^[0-9a-fA-F]+$/) != nil
# this is a media file
media_file = File.join(media_buffer, sha.chomp)
if File.exists?(media_file)
@@ -25,7 +25,8 @@ def self.run!
end
end
else
- # if more than 40 chars, just output
+ # if it is not a 40 character long hash, just output
+ STDERR.puts('Unknown git-media file format')
print sha
while data = STDIN.read(4096)
print data
Please sign in to comment.
Something went wrong with that request. Please try again.