Sha256: 0ef337276d784205e83319bf7009b11306731c50490c7f89dde13da3741e8201

Contents?: true

Size: 1.54 KB

Versions: 7

Compression:

Stored size: 1.54 KB

Contents

# Disable git-lfs at checkout time, we run install --local and pull later 
Autobuild::Git.default_config['filter.lfs.smudge'] = 'git-lfs smudge --skip -- %f'
Autobuild::Git.default_config['filter.lfs.required'] = 'false'

module Autobuild
    Git.add_post_hook(always: true) do |importer, package|
        lfs_dir = File.join(package.srcdir, '.git', 'lfs')
        if File.directory?(lfs_dir)
            importer.run_git(package, 'lfs', 'install', '--force', '--local', '--skip-smudge')

            includes = importer.options.fetch(:lfs_include, '')
            if includes.empty?
                begin
                    importer.run_git_bare(package, 'config', '--local', '--unset', 'lfs.fetchinclude')
                rescue SubcommandFailed => e
                    raise if e.status != 5
                end
            else
                importer.run_git_bare(package, 'config', '--local', 'lfs.fetchinclude', includes)
            end

            excludes = importer.options.fetch(:lfs_exclude, '')
            if excludes.empty?
                begin
                    importer.run_git_bare(package, 'config', '--local', '--unset', 'lfs.fetchexclude')
                rescue SubcommandFailed => e
                    raise if e.status != 5
                end
            else
                importer.run_git_bare(package, 'config', '--local', 'lfs.fetchexclude', excludes)
            end

            if importer.options[:lfs] != false
                importer.run_git(package, 'lfs', 'pull', importer.remote_name)
            end
        end
    end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
autobuild-1.16.0 lib/autobuild/import/git-lfs.rb
autobuild-1.15.0 lib/autobuild/import/git-lfs.rb
autobuild-1.14.1 lib/autobuild/import/git-lfs.rb
autobuild-1.14.0 lib/autobuild/import/git-lfs.rb
autobuild-1.13.0 lib/autobuild/import/git-lfs.rb
autobuild-1.13.0.pre1 lib/autobuild/import/git-lfs.rb
autobuild-1.12.3 lib/autobuild/import/git-lfs.rb