5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 01:31:41 +00:00

fix: change git_sh method to accept array of params #12919
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
jazzari 2023-07-20 15:31:38 -03:00
parent 42b6744f81
commit ca9fa31cf1
2 changed files with 8 additions and 5 deletions

View file

@ -6,7 +6,6 @@ class GitPushJob < ApplicationJob
# @param :site [Site]
# @return [nil]
def perform(site)
#detectar que el repo local tiene repo remoto
site.repository.push if site.repository.origin
end
end

View file

@ -154,7 +154,7 @@ class Site
#
# @return [Boolean]
def gc
git_sh("git gc")
git_sh("git", "gc")
end
# Pushea cambios al repositorio remoto
@ -162,7 +162,7 @@ class Site
# @return [Boolean, nil]
def push
origin.push(rugged.head.canonical_name, credentials: credentials)
git_sh("git lfs push")
git_sh("git", "lfs", "push", "origin", "#{default_branch}")
end
private
@ -191,11 +191,15 @@ class Site
Pathname.new(file).relative_path_from(Pathname.new(path)).to_s
end
def git_sh(cmd)
# Ejecuta un comando de git
#
# @param :args [Array]
# @return [Boolean]
def git_sh(*args)
env = { 'PATH' => '/usr/bin', 'LANG' => ENV['LANG'], 'HOME' => path }
r = nil
Open3.popen2e(env, cmd, unsetenv_others: true, chdir: path) do |_, _, t|
Open3.popen2e(env, args, unsetenv_others: true, chdir: path) do |_, _, t|
r = t.value
end