Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package repo
  2. import (
  3. "fmt"
  4. "strings"
  5. )
  6. const advertise_refs = "--advertise-refs"
  7. func command(cmd string, opts ...string) string {
  8. return fmt.Sprintf("git %s %s", cmd, strings.Join(opts, " "))
  9. }
  10. /*func upload_pack(repository_path string, opts ...string) string {
  11. cmd = "upload-pack"
  12. opts = append(opts, "--stateless-rpc", repository_path)
  13. return command(cmd, opts...)
  14. }
  15. func receive_pack(repository_path string, opts ...string) string {
  16. cmd = "receive-pack"
  17. opts = append(opts, "--stateless-rpc", repository_path)
  18. return command(cmd, opts...)
  19. }*/
  20. /*func update_server_info(repository_path, opts = {}, &block)
  21. cmd = "update-server-info"
  22. args = []
  23. opts.each {|k,v| args << command_options[k] if command_options.has_key?(k) }
  24. opts[:args] = args
  25. Dir.chdir(repository_path) do # "git update-server-info" does not take a parameter to specify the repository, so set the working directory to the repository
  26. self.command(cmd, opts, &block)
  27. end
  28. end
  29. def get_config_setting(repository_path, key)
  30. path = get_config_location(repository_path)
  31. raise "Config file could not be found for repository in #{repository_path}." unless path
  32. self.command("config", {:args => ["-f #{path}", key]}).chomp
  33. end
  34. def get_config_location(repository_path)
  35. non_bare = File.join(repository_path,'.git') # This is where the config file will be if the repository is non-bare
  36. if File.exists?(non_bare) then # The repository is non-bare
  37. non_bare_config = File.join(non_bare, 'config')
  38. return non_bare_config if File.exists?(non_bare_config)
  39. else # We are dealing with a bare repository
  40. bare_config = File.join(repository_path, "config")
  41. return bare_config if File.exists?(bare_config)
  42. end
  43. return nil
  44. end
  45. end
  46. */