Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def main(argv):
# does not filter. It does not weight either: boosting seeds inside it and penalising files outside
# it was swept over 57 real commits and was worth at most 0.012 recall@10 against not doing it, which
# is noise at that sample size. The menu is worth printing for the reader; it is not worth ranking on.
rank = rank_dirs(g, scope_terms(g, task)) if not scopes else None
rank = rank_dirs(g, scope_terms(g, task)) if not scopes else None; flat = False
if not scopes:
# One candidate is not a choice: take it and SAY SO, rather than refusing and being handed back
# the only path there was. This is NOT the offered-scope case above, so it is not marked
Expand All @@ -430,6 +430,11 @@ def main(argv):
if sole:
scopes = [sole]
print(f"scope: {sole} (the only package this graph indexes; --in overrides)\n")
elif g.sym and not dirs_with_counts(g):
# every indexed file sits at the root, so the root is the one scope there is, and it narrows nothing.
# Refusing here offered an empty menu: a correction the reader could not act on (#1345)
flat = True
print("scope: the repository root (every indexed file sits there; --in overrides)\n")
elif rank:
# Several candidates, and a caller holding an issue and no symbol — which is the caller this
# verb was written for, and by construction the one who cannot name the scope. Refusing here
Expand All @@ -452,7 +457,7 @@ def main(argv):
+ ("…" if n > 4 else "") + ")")
print(" no --in was given, so NOTHING below is narrowed to it — "
"pass --in <path> to narrow.\n")
bad = require_scope(g, scopes, terms, rank=rank, flag=' --in-offered')
bad = None if flat else require_scope(g, scopes, terms, rank=rank, flag=' --in-offered')
if bad is not None: return bad

# a symbol is kept when it is under ANY of the scopes -- the union, because the caller naming two roots
Expand Down
Loading