Commit 0ac3215c authored by Addshore's avatar Addshore 🏄
Browse files

docker: Fix bugs with mediawiki cloning

parent f2b85898
...@@ -97,47 +97,41 @@ func (m MediaWiki) CloneSetup(options CloneSetupOpts) { ...@@ -97,47 +97,41 @@ func (m MediaWiki) CloneSetup(options CloneSetupOpts) {
os.Exit(1) os.Exit(1)
} }
shallowOptions := ""
if options.UseShallow {
shallowOptions = "--depth=1"
}
if options.GetMediaWiki { if options.GetMediaWiki {
exec.RunTTYCommand(options.Options, exec.Command( cloneAndSetRemote(m.Path(""), startRemoteCore, endRemoteCore, options.UseShallow, options.Options)
"git",
"clone",
shallowOptions,
startRemoteCore,
m.Path("")))
if startRemoteCore != endRemoteCore {
exec.RunTTYCommand(options.Options, exec.Command(
"git",
"-C", m.Path(""),
"remote",
"set-url",
"origin",
endRemoteCore))
}
} }
if options.GetVector { if options.GetVector {
exec.RunTTYCommand(options.Options, exec.Command( cloneAndSetRemote(m.Path("skins/Vector"), startRemoteVector, endRemoteVector, options.UseShallow, options.Options)
}
}
func cloneAndSetRemote(directory string, startRemote string, endRemote string, useShallow bool, options exec.HandlerOptions) {
exec.RunTTYCommand(options, exec.Command(
"git",
gitCloneArguments(directory, startRemote, useShallow)...,
))
if startRemote != endRemote {
exec.RunTTYCommand(options, exec.Command(
"git", "git",
"clone", gitRemoteSetURLArguments(directory, endRemote)...,
shallowOptions, ))
startRemoteVector,
m.Path("skins/Vector")))
if startRemoteCore != endRemoteCore {
exec.RunTTYCommand(options.Options, exec.Command(
"git",
"-C", m.Path("skins/Vector"),
"remote",
"set-url",
"origin",
endRemoteVector))
}
} }
} }
func gitCloneArguments(directory string, remote string, useShallow bool) []string {
args := []string{"clone"}
if useShallow {
args = append(args, "--depth=1")
}
args = append(args, remote)
args = append(args, directory)
return args
}
func gitRemoteSetURLArguments(directory string, newRemote string) []string {
return []string{"-C", directory, "remote", "set-url", "origin", newRemote}
}
/*LocalSettingsIsPresent ...*/ /*LocalSettingsIsPresent ...*/
func (m MediaWiki) LocalSettingsIsPresent() bool { func (m MediaWiki) LocalSettingsIsPresent() bool {
info, err := os.Stat(m.Path("LocalSettings.php")) info, err := os.Stat(m.Path("LocalSettings.php"))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment