app/models/repository_mirror.rb
def needs_push(payloads=[])
    return true if payloads.empty?
    return true if push_mode==PUSHMODE_MIRROR
    
    refspec_parse = explicit_refspec.match(/^\+?([^:]*)(:[^:]*)?$/)
    payloads.each do |payload|
      if splitpath = refcomp_parse(payload[:ref])
        return true if payload[:ref] == refspec_parse[1]  # Explicit Reference Spec complete path
        return true if splitpath[:name] == refspec_parse[1] # Explicit Reference Spec no type
        return true if include_all_branches && splitpath[:type] == "heads"
        return true if include_all_tags && splitpath[:type] == "tags"
      end
    end
    false
  end
# If we have an explicit refspec, check it against incoming payloads
# Special case: if we do not pass in any payloads, return true
If we have an explicit refspec, check it against incoming payloads
Special case: if we do not pass in any payloads, return true
If we have an explicit refspec check it against incoming payloads Special case : if we do not pass in any payloads return true
def needs_push(payloads=[])
    return true if payloads.empty?
    return true if push_mode==PUSHMODE_MIRROR
    refspec_parse = explicit_refspec.match(/^\+?([^:]*)(:[^:]*)?$/)
    payloads.each do |payload|
      if splitpath = refcomp_parse(payload[:ref])
        return true if payload[:ref] == refspec_parse[1]  
        return true if splitpath[:name] == refspec_parse[1] 
        return true if include_all_branches && splitpath[:type] == "heads"
        return true if include_all_tags && splitpath[:type] == "tags"
      end
    end
    false
  end
def needs_push ( payloads = [ ] ) return true if payloads . empty? return true if push_mode == PUSHMODE_MIRROR refspec_parse = explicit_refspec . match ( / ^ \+ ?([^:]*)(:[^:]*)?$ / ) payloads . each do | payload | if splitpath = refcomp_parse ( payload [ :ref ] ) return true if payload [ :ref ] == refspec_parse [ 1 ] return true if splitpath [ :name ] == refspec_parse [ 1 ] return true if include_all_branches && splitpath [ :type ] == "heads" return true if include_all_tags && splitpath [ :type ] == "tags" end end false end
If we have an explicit refspec, check it against incoming payloads
Special case: if we do not pass in any payloads, return true
If we have an explicit refspec check it against incoming payloads Special case : if we do not pass in any payloads return true
# Explicit Reference Spec complete path # Explicit Reference Spec no type
payloads