diff options
author | John Olheiser <42128690+jolheiser@users.noreply.github.com> | 2019-03-15 11:18:01 -0500 |
---|---|---|
committer | techknowlogick <matti@mdranta.net> | 2019-03-15 12:18:01 -0400 |
commit | 4f74bad783c2a5904d72829d2e7ff4eab0bf8ce3 (patch) | |
tree | 98c6aed606584eadc7e017d13aed2500f4e89e16 | |
parent | c55bdca562e8fffaaf4028cf9563443027d52970 (diff) | |
download | gitea-4f74bad783c2a5904d72829d2e7ff4eab0bf8ce3.tar.gz gitea-4f74bad783c2a5904d72829d2e7ff4eab0bf8ce3.zip |
Add way to force checkout (#6322)
-rw-r--r-- | contrib/pr/checkout.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/pr/checkout.go b/contrib/pr/checkout.go index 2eed07631f..9fe1eb573c 100644 --- a/contrib/pr/checkout.go +++ b/contrib/pr/checkout.go @@ -17,6 +17,7 @@ import ( "path" "path/filepath" "runtime" + "strconv" "time" "code.gitea.io/gitea/modules/markup/external" @@ -162,6 +163,12 @@ func main() { return } + // To force checkout (e.g. Windows complains about unclean work tree) set env variable FORCE=true + force, err := strconv.ParseBool(os.Getenv("FORCE")) + if err != nil { + force = false + } + //Otherwise checkout PR if len(os.Args) != 2 { log.Fatal("Need only one arg: the PR number") @@ -221,7 +228,7 @@ func main() { log.Printf("Checkout PR #%s in %s\n", pr, branch) err = tree.Checkout(&git.CheckoutOptions{ Branch: branchRef, - //Force: runtime.GOOS == "windows", + Force: force, }) if err != nil { log.Fatalf("Failed to checkout %s : %v", branch, err) |