added some logs and moved where the post request is made
This commit is contained in:
parent
7f64d79bbe
commit
0eac8fc5cf
|
|
@ -33,7 +33,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/thockin/glogr"
|
"github.com/thockin/glogr"
|
||||||
"github.com/thockin/logr"
|
"github.com/thockin/logr"
|
||||||
|
|
@ -277,6 +277,16 @@ func updateSymlink(ctx context.Context, gitRoot, link, newDir string) error {
|
||||||
}
|
}
|
||||||
log.V(1).Infof("renamed symlink %s to %s", "tmp-link", link)
|
log.V(1).Infof("renamed symlink %s to %s", "tmp-link", link)
|
||||||
|
|
||||||
|
// If there is a symlink update callback, call it
|
||||||
|
if len(*flSymlinkUpdatePostUrl) > 0 {
|
||||||
|
log.V(0).Infof("sending post request to %s", *flSymlinkUpdatePostUrl)
|
||||||
|
// Send the post request
|
||||||
|
_, err := http.NewRequest("POST", *flSymlinkUpdatePostUrl, nil)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error sending symlink update callback post request: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Clean up previous worktree
|
// Clean up previous worktree
|
||||||
if len(currentDir) > 0 {
|
if len(currentDir) > 0 {
|
||||||
if err = os.RemoveAll(currentDir); err != nil {
|
if err = os.RemoveAll(currentDir); err != nil {
|
||||||
|
|
@ -292,15 +302,6 @@ func updateSymlink(ctx context.Context, gitRoot, link, newDir string) error {
|
||||||
|
|
||||||
log.V(1).Infof("pruned old worktrees")
|
log.V(1).Infof("pruned old worktrees")
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is a symlink update callback, call it
|
|
||||||
if len(*flSymlinkUpdateCallback) > 0 {
|
|
||||||
// Send the post request
|
|
||||||
resp, err := http.NewRequest("POST", url, nil)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error sending symlink update callback post request: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue