From 37028584fcb7bb71c3a485a787cb56e65eb363cd Mon Sep 17 00:00:00 2001 From: chriswalz Date: Tue, 20 Oct 2020 09:02:45 -0400 Subject: [PATCH] fix: index out of bounds when outside a git repo --- README.md | 9 +++++++++ main.go | 20 ++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 11b5b2d..ac41771 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,18 @@ - new commands like `bit sync` that vastly simplify your workflow - commands from **git-extras** such as `bit release` & `bit info` - **fully compatible with git** allowing you to fallback to git if need be. +- update using `bit update` +- get insight into how bit works using `bit --debug` + +--- **Coming Soon** --- +- checkout pull requests from github +- improved `bit sync` +- more completions! ## Install / Update +**new versions** of bit can now update using `bit update` + ### using `cURL` (Simplest way to install) ```shell script diff --git a/main.go b/main.go index 715ae49..9f7ad80 100644 --- a/main.go +++ b/main.go @@ -39,14 +39,26 @@ func main() { } // verify is git repo - if !bitcmd.IsGitRepo() && os.Args[1] != "update" { - if len(os.Args) == 2 && os.Args[1] == "--version" { + if len(os.Args) >= 2 { + if os.Args[1] == "--version" { fmt.Println("bit version v0.7.5") bitcmd.PrintGitVersion() return } - fmt.Println("fatal: not a git repository (or any of the parent directories): .git") - return + } else { + + } + if !bitcmd.IsGitRepo() { + if len(os.Args) >= 2 && os.Args[1] == "update" { + // do nothing here, proceed to update path + } else if len(os.Args) == 2 && os.Args[1] == "--version" { + fmt.Println("bit version v0.7.5") + bitcmd.PrintGitVersion() + return + } else { + fmt.Println("fatal: not a git repository (or any of the parent directories): .git") + return + } } bitcliCmds := []string{"save", "sync", "help", "info", "release", "update"}