lib/licensed/git.rb
# Returns the most recent git SHA for a file or directory
# or nil if SHA is not available
#
# descriptor - file or directory to retrieve latest SHA for
Returns the most recent git SHA for a file or directory
or nil if SHA is not available

file or directory to retrieve latest SHA for
Returns the most recent git SHA for a file or directory or nil if SHA is not available file or directory to retrieve latest SHA for
def version(descriptor)
        return unless available? && descriptor
        dir = File.directory?(descriptor) ? descriptor : File.dirname(descriptor)
        file = File.directory?(descriptor) ? "." : File.basename(descriptor)
        Dir.chdir dir do
          Licensed::Shell.execute("git", "rev-list", "-1", "HEAD", "--", file, allow_failure: true)
        end
      end
def version ( descriptor ) return unless available? && descriptor dir = File . directory? ( descriptor ) ? descriptor : File . dirname ( descriptor ) file = File . directory? ( descriptor ) ? "." : File . basename ( descriptor ) Dir . chdir dir do Licensed :: Shell . execute ( "git" , "rev-list" , "-1" , "HEAD" , "--" , file , allow_failure : true ) end end
Returns the most recent git SHA for a file or directory
or nil if SHA is not available
Returns the most recent git SHA for a file or directory or nil if SHA is not available
descriptor
<not_specific>