File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import (
2020
2121 "github.com/Unknwon/com"
2222 "github.com/go-xorm/xorm"
23+ "github.com/mcuadros/go-version"
2324)
2425
2526// MirrorQueue holds an UniqueQueue object of the mirror
@@ -70,7 +71,17 @@ func (m *Mirror) ScheduleNextUpdate() {
7071}
7172
7273func remoteAddress (repoPath string ) (string , error ) {
73- cmd := git .NewCommand ("remote" , "get-url" , "origin" )
74+ var cmd * git.Command
75+ binVersion , err := git .BinVersion ()
76+ if err != nil {
77+ return "" , err
78+ }
79+ if version .Compare (binVersion , "2.7" , ">=" ) {
80+ cmd = git .NewCommand ("remote" , "get-url" , "origin" )
81+ } else {
82+ cmd = git .NewCommand ("config" , "--get" , "remote.origin.url" )
83+ }
84+
7485 result , err := cmd .RunInDir (repoPath )
7586 if err != nil {
7687 if strings .HasPrefix (err .Error (), "exit status 128 - fatal: No such remote " ) {
You can’t perform that action at this time.
0 commit comments