@@ -47,7 +47,12 @@ func OpenRepository(ctx context.Context, repoPath string) (*Repository, error) {
4747 repoPath , err := filepath .Abs (repoPath )
4848 if err != nil {
4949 return nil , err
50- } else if ! isDir (repoPath ) {
50+ }
51+ exist , err := util .IsDir (repoPath )
52+ if err != nil {
53+ return nil , err
54+ }
55+ if ! exist {
5156 return nil , util .NewNotExistErrorf ("no such file or directory" )
5257 }
5358
@@ -62,7 +67,7 @@ func OpenRepository(ctx context.Context, repoPath string) (*Repository, error) {
6267func (repo * Repository ) CatFileBatch (ctx context.Context ) (WriteCloserError , * bufio.Reader , func (), error ) {
6368 if repo .batch == nil {
6469 var err error
65- repo .batch , err = repo . NewBatch (ctx )
70+ repo .batch , err = NewBatch (ctx , repo . Path )
6671 if err != nil {
6772 return nil , nil , nil , err
6873 }
@@ -76,7 +81,7 @@ func (repo *Repository) CatFileBatch(ctx context.Context) (WriteCloserError, *bu
7681 }
7782
7883 log .Debug ("Opening temporary cat file batch for: %s" , repo .Path )
79- tempBatch , err := repo . NewBatch (ctx )
84+ tempBatch , err := NewBatch (ctx , repo . Path )
8085 if err != nil {
8186 return nil , nil , nil , err
8287 }
@@ -87,7 +92,7 @@ func (repo *Repository) CatFileBatch(ctx context.Context) (WriteCloserError, *bu
8792func (repo * Repository ) CatFileBatchCheck (ctx context.Context ) (WriteCloserError , * bufio.Reader , func (), error ) {
8893 if repo .check == nil {
8994 var err error
90- repo .check , err = repo . NewBatchCheck (ctx )
95+ repo .check , err = NewBatchCheck (ctx , repo . Path )
9196 if err != nil {
9297 return nil , nil , nil , err
9398 }
@@ -101,7 +106,7 @@ func (repo *Repository) CatFileBatchCheck(ctx context.Context) (WriteCloserError
101106 }
102107
103108 log .Debug ("Opening temporary cat file batch-check for: %s" , repo .Path )
104- tempBatchCheck , err := repo . NewBatchCheck (ctx )
109+ tempBatchCheck , err := NewBatchCheck (ctx , repo . Path )
105110 if err != nil {
106111 return nil , nil , nil , err
107112 }
0 commit comments