Skip to content

Instantly share code, notes, and snippets.

@leifericf
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save leifericf/83f69fb1d631fcf55322 to your computer and use it in GitHub Desktop.

Select an option

Save leifericf/83f69fb1d631fcf55322 to your computer and use it in GitHub Desktop.

Revisions

  1. Leif Eric Fredheim renamed this gist Oct 30, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. Leif Eric Fredheim revised this gist Jun 27, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git_hash.rb
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    def git_hash(file)
    data = File.read(file)
    size = data.bytesize.to_s
    Digest::SHA1.hexdigest("blob " + size + "\0" + data) # Git's hashing algorithm
    Digest::SHA1.hexdigest('blob ' + size + "\0" + data) # Git's hashing algorithm
    end

    puts git_hash(ARGV[0])
  3. Leif Eric Fredheim revised this gist Jun 27, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git_hash.rb
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    def git_hash(file)
    data = File.read(file)
    size = data.bytesize.to_s
    Digest::SHA1.hexdigest("blob " + size + "\0" + data) # Git's hasing algorithm
    Digest::SHA1.hexdigest("blob " + size + "\0" + data) # Git's hashing algorithm
    end

    puts git_hash(ARGV[0])
  4. Leif Eric Fredheim renamed this gist Jun 27, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion githash.rb → git_hash.rb
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    def git_hash(file)
    data = File.read(file)
    size = data.bytesize.to_s
    Digest::SHA1.hexdigest("blob " + size + "\0" + data)
    Digest::SHA1.hexdigest("blob " + size + "\0" + data) # Git's hasing algorithm
    end

    puts git_hash(ARGV[0])
  5. Leif Eric Fredheim created this gist Jun 27, 2014.
    11 changes: 11 additions & 0 deletions githash.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    #!/usr/bin/env ruby

    require 'digest/sha1'

    def git_hash(file)
    data = File.read(file)
    size = data.bytesize.to_s
    Digest::SHA1.hexdigest("blob " + size + "\0" + data)
    end

    puts git_hash(ARGV[0])