@@ -13,6 +13,8 @@ import (
13
13
survey "gopkg.in/AlecAivazis/survey.v1"
14
14
)
15
15
16
+ const gowlSite = "gowl.site"
17
+
16
18
func toSelection (r Repository ) string {
17
19
return fmt .Sprintf ("*%-5v %-45v %-10v %v" , r .Star , r .FullName , r .Language , r .License )
18
20
}
@@ -163,6 +165,9 @@ func CmdGet(handler IHandler, root string, force bool, shallow bool, recursive b
163
165
dst := filepath .Join (root , handler .GetPrefix (), repo .FullName )
164
166
if _ , err := os .Stat (dst ); os .IsNotExist (err ) {
165
167
clone (cloneURL , dst , shallow , recursive )
168
+ if err := execCommand (& dst , "git" , "config" , gowlSite , repo .SiteURL ); err != nil {
169
+ return errors .Wrap (err , "Fail to config gowl.site " + repo .SiteURL )
170
+ }
166
171
if handler .GetOverrideUser () {
167
172
if err := configureUser (dst , handler .GetUserName (), handler .GetMailAddress ()); err != nil {
168
173
return errors .Wrap (err , "Fail to configure " + dst )
@@ -175,6 +180,9 @@ func CmdGet(handler IHandler, root string, force bool, shallow bool, recursive b
175
180
return errors .Wrap (err , "Fail to remove " + dst )
176
181
}
177
182
clone (cloneURL , dst , shallow , recursive )
183
+ if err := execCommand (& dst , "git" , "config" , gowlSite , repo .SiteURL ); err != nil {
184
+ return errors .Wrap (err , "Fail to config gowl.site " + repo .SiteURL )
185
+ }
178
186
if handler .GetOverrideUser () {
179
187
if err := configureUser (dst , handler .GetUserName (), handler .GetMailAddress ()); err != nil {
180
188
return errors .Wrap (err , "Fail to configure " + dst )
@@ -233,12 +241,15 @@ func CmdWeb(handler IHandler, root string, browser string) error {
233
241
return errors .Wrap (err , "Fail to select a repository." )
234
242
}
235
243
236
- remoteURL , err := getCommandStdout (& selection , "git" , "config" , "--get" , "remote.origin.url" )
244
+ siteURL , err := getCommandStdout (& selection , "git" , "config" , "--get" , "gowl.site" )
245
+ if siteURL == "" {
246
+ return errors .Wrap (err , "Site URL is not set. [gowl.site in .git/config]" )
247
+ }
237
248
if err != nil {
238
- return errors .Wrap (err , "Fail to get remote origin URL" )
249
+ return errors .Wrap (err , "Fail to get site URL" )
239
250
}
240
251
241
- if err := execCommand (nil , browser , remoteURL ); err != nil {
252
+ if err := execCommand (nil , browser , siteURL ); err != nil {
242
253
return errors .Wrap (err , fmt .Sprintf ("Fail to open repository %v" , selection ))
243
254
}
244
255
0 commit comments