Fix repositories breaking with sub-repo permissions (#59420)

This commit is contained in:
Petri-Johan Last 2024-01-15 12:26:19 +02:00 committed by GitHub
parent bf07701350
commit dac501d85e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 5 deletions

View File

@ -45,6 +45,7 @@ All notable changes to Sourcegraph are documented in this file.
- The blame column no longer ignores whitespace-only changes by default. [#58134](https://github.com/sourcegraph/sourcegraph/pull/58134)
- Long lines now wrap correctly in the diff view. [#58138](https://github.com/sourcegraph/sourcegraph/pull/58138)
- Fixed an issue in the search input where pressing Enter after selecting a suggestion would sometimes insert another suggestions instead of submitting the query. [#58186](https://github.com/sourcegraph/sourcegraph/pull/58186)
- Fixed an issue where having sub-repo permissions enabled could cause repositories with a large number of files in directories to become unviewable. [#59420](https://github.com/sourcegraph/sourcegraph/pull/59420)
### Removed

View File

@ -158,7 +158,9 @@ export const FilesCard: FC<FilePanelProps> = ({ entries, historyEntries, classNa
const fileHistoryByPath = useMemo(() => {
const fileHistoryByPath: Record<string, TreeHistoryFields['history']['nodes'][number]['commit']> = {}
for (const entry of historyEntries || []) {
fileHistoryByPath[entry.path] = entry.history.nodes[0].commit
if (entry.history.nodes.length > 0) {
fileHistoryByPath[entry.path] = entry.history.nodes[0].commit
}
}
return fileHistoryByPath
}, [historyEntries])

View File

@ -1226,7 +1226,6 @@ func (c *clientImplementor) RepoCloneProgress(ctx context.Context, repos ...api.
req := req
p.Go(func(ctx context.Context) (*proto.RepoCloneProgressResponse, error) {
return client.RepoCloneProgress(ctx, req)
})
}
@ -1239,13 +1238,11 @@ func (c *clientImplementor) RepoCloneProgress(ctx context.Context, repos ...api.
Results: make(map[api.RepoName]*protocol.RepoCloneProgress),
}
for _, r := range res {
for repo, info := range r.Results {
var rp protocol.RepoCloneProgress
rp.FromProto(info)
result.Results[api.RepoName(repo)] = &rp
}
}
return result, nil
@ -1595,7 +1592,6 @@ func (c *clientImplementor) GetObject(ctx context.Context, repo api.RepoName, ob
grpcResp, err := client.GetObject(ctx, req.ToProto())
if err != nil {
return nil, err
}

View File

@ -1911,6 +1911,9 @@ var runCommitLog = func(ctx context.Context, cmd GitCommand, opt CommitsOptions)
func parseCommitLogOutput(r io.Reader) ([]*wrappedCommit, error) {
commitScanner := bufio.NewScanner(r)
// We use an increased buffer size since sub-repo permissions
// can result in very lengthy output.
commitScanner.Buffer(make([]byte, 0, 65536), 4294967296)
commitScanner.Split(commitSplitFunc)
var commits []*wrappedCommit