Skip to content

Commit

Permalink
fix: index out of bounds when outside a git repo
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswalz committed Oct 20, 2020
1 parent 22c944f commit 3702858
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 16 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down

0 comments on commit 3702858

Please sign in to comment.