Skip to content

Commit 4d705dc

Browse files
committed
[git] Rename IsRepo() to Checkwd()
The function will also be responsible for checking the annex version and upgrading if necessary.
1 parent 4a7c8da commit 4d705dc

17 files changed

+25
-20
lines changed

ginclient/repos.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ func (gincl *Client) CloneRepo(repopath string, clonechan chan<- git.RepoFileSta
454454
// If a new commit is created and a default remote exists, the new commit is pushed to initialise the remote as well.
455455
// Returns 'true' if (and only if) a commit was created.
456456
func CommitIfNew() (bool, error) {
457-
if !git.IsRepo() {
457+
if !git.Checkwd() {
458458
return false, fmt.Errorf("not a repository")
459459
}
460460
_, err := git.RevParse("HEAD")
@@ -635,7 +635,7 @@ func CheckoutFileCopies(commithash string, paths []string, outpath string, suffi
635635
// Optionally initialised as a bare repository (for annex directory remotes).
636636
func (gincl *Client) InitDir(bare bool) error {
637637
initerr := ginerror{Origin: "InitDir", Description: "Error initialising local directory"}
638-
if !git.IsRepo() {
638+
if !git.Checkwd() {
639639
err := git.Init(bare)
640640
if err != nil {
641641
initerr.UError = err.Error()

gincmd/addremotecmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func defaultRemoteIfUnset(name string) {
152152
}
153153

154154
func addRemote(cmd *cobra.Command, args []string) {
155-
if !git.IsRepo() {
155+
if !git.Checkwd() {
156156
Die(ginerrors.NotInRepo)
157157
}
158158
flags := cmd.Flags()

gincmd/commitcmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
func commit(cmd *cobra.Command, args []string) {
1616
prStyle := determinePrintStyle(cmd)
17-
if !git.IsRepo() {
17+
if !git.Checkwd() {
1818
Die(ginerrors.NotInRepo)
1919
}
2020

gincmd/downloadcmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func download(cmd *cobra.Command, args []string) {
1717
// TODO: no client necessary? Just use remotes
1818
conf := config.Read()
1919
gincl := ginclient.New(conf.DefaultServer)
20-
if !git.IsRepo() {
20+
if !git.Checkwd() {
2121
Die(ginerrors.NotInRepo)
2222
}
2323
remote, err := ginclient.DefaultRemote()

gincmd/getcontentcmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func getContent(cmd *cobra.Command, args []string) {
1616
// TODO: no need for client; use remotes (and all keys?)
1717
gincl := ginclient.New(conf.DefaultServer)
1818
requirelogin(cmd, gincl, prStyle != psJSON)
19-
if !git.IsRepo() {
19+
if !git.Checkwd() {
2020
Die(ginerrors.NotInRepo)
2121
}
2222

gincmd/lockcmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
func lock(cmd *cobra.Command, args []string) {
1414
prStyle := determinePrintStyle(cmd)
15-
if !git.IsRepo() {
15+
if !git.Checkwd() {
1616
Die(ginerrors.NotInRepo)
1717
}
1818
if prStyle != psJSON {

gincmd/lscmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
func lsRepo(cmd *cobra.Command, args []string) {
18-
if !git.IsRepo() {
18+
if !git.Checkwd() {
1919
Die(ginerrors.NotInRepo)
2020
}
2121

gincmd/remotescmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func printremotes(cmd *cobra.Command, args []string) {
1515
flags := cmd.Flags()
1616
jsonout, _ := flags.GetBool("json")
1717

18-
if !git.IsRepo() {
18+
if !git.Checkwd() {
1919
Die(ginerrors.NotInRepo)
2020
}
2121

gincmd/removecontentcmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func remove(cmd *cobra.Command, args []string) {
2424
conf := config.Read()
2525
gincl := ginclient.New(conf.DefaultServer)
2626
requirelogin(cmd, gincl, prStyle != psJSON)
27-
if !git.IsRepo() {
27+
if !git.Checkwd() {
2828
Die(ginerrors.NotInRepo)
2929
}
3030
nitems := countItemsRemove(args)

gincmd/removeremotecmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
func rmRemote(cmd *cobra.Command, args []string) {
13-
if !git.IsRepo() {
13+
if !git.Checkwd() {
1414
Die(ginerrors.NotInRepo)
1515
}
1616
name := args[0]

0 commit comments

Comments
 (0)