Skip to content

Commit 64da4dd

Browse files
authored
Clarify assumptions in tools/lintdiff.py in comment (#3067)
## Changes Capture thread in comments: #3021 (comment)
1 parent 669d3b3 commit 64da4dd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/lintdiff.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ def main():
3030
if args.head:
3131
args.ref = "HEAD"
3232

33+
# All paths are relative to repo root, so we need to ensure we're in the right directory.
3334
gitroot = parse_lines(["git", "rev-parse", "--show-toplevel"])[0]
3435
os.chdir(gitroot)
3536

37+
# Get list of changed files relative to repo root.
38+
# Note: Paths are always relative to repo root, even when running from subdirectories.
39+
# Example: Running from tools/ returns 'tools/lintdiff.py' rather than just 'lintdiff.py'.
3640
changed = parse_lines(["git", "diff", "--name-only", args.ref, "--", "."])
3741

3842
# We need to pass packages to golangci-lint, not individual files.

0 commit comments

Comments
 (0)