Skip to content

Commit 2000a67

Browse files
committed
remove unused code
1 parent d675289 commit 2000a67

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

services/repository/files/tree.go

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -404,38 +404,21 @@ func GetTreeInformation(ctx context.Context, repo *repo_model.Repository, treePa
404404
}
405405

406406
// get root entries
407-
rootEntry, err := commit.GetTreeEntryByPath("")
408-
if err != nil {
409-
return nil, err
410-
}
411407
rootEntries, err := commit.ListEntries()
412408
if err != nil {
413409
return nil, err
414410
}
415411

416-
var dir string
417-
var lastDirEntry *git.TreeEntry
418-
if treePath == "" {
419-
dir = treePath
420-
lastDirEntry = rootEntry
421-
} else {
422-
lastDirEntry, err = commit.GetTreeEntryByPath(treePath)
412+
dir := treePath
413+
if dir != "" {
414+
lastDirEntry, err := commit.GetTreeEntryByPath(treePath)
423415
if err != nil {
424416
return nil, err
425417
}
426-
dir = treePath
427418
if lastDirEntry.IsRegular() {
428419
// path.Dir cannot correctly handle .xxx file
429420
dir, _ = path.Split(treePath)
430421
dir = strings.TrimRight(dir, "/")
431-
if dir == "" {
432-
lastDirEntry = rootEntry
433-
} else {
434-
lastDirEntry, err = commit.GetTreeEntryByPath(dir)
435-
if err != nil {
436-
return nil, err
437-
}
438-
}
439422
}
440423
}
441424

0 commit comments

Comments
 (0)