git: ba120b8d38f3 - main - mfc-candidates: Annotate variables as local

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Mon, 17 Aug 2026 13:43:42 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=ba120b8d38f3f0bc78efa5200807eb9904fbb1f9

commit ba120b8d38f3f0bc78efa5200807eb9904fbb1f9
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-08-12 18:39:11 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-08-17 13:43:25 +0000

    mfc-candidates: Annotate variables as local
    
    And clean up luacheck warnings.
    
    Sponsored by:   Klara, Inc.
    Differential Revision: https://reviews.freebsd.org/D48950
---
 tools/tools/git/mfc-candidates.lua | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/tools/git/mfc-candidates.lua b/tools/tools/git/mfc-candidates.lua
index 0bf1a2f636bd..a120ff641b9a 100755
--- a/tools/tools/git/mfc-candidates.lua
+++ b/tools/tools/git/mfc-candidates.lua
@@ -7,6 +7,9 @@
 -- "MFC from" branch and do not have a corresponding "cherry picked from"
 -- commit in the "MFC to" branch.
 
+-- Global state
+local verbose = 0
+
 -- Execute a command and return its output.  A final newline is stripped,
 -- similar to sh.
 local function exec_command(command)
@@ -102,9 +105,6 @@ local function set_difference(set1, set2)
 	return result
 end
 
--- Global state
-verbose = 0
-
 local function params(from_branch, to_branch, author)
 	print("from:             " .. from_branch)
 	print("to:               " .. to_branch)
@@ -125,9 +125,9 @@ end
 -- Main function
 local function main()
 	local from_branch = "freebsd/main"
-	local to_branch = ""
+	local to_branch
 	local author = os.getenv("USER") or ""
-	local dirspec = nil
+	local dirspec
 
 	local url = exec_command("git remote get-url freebsd 2>/dev/null")
 	local freebsd_repo
@@ -215,7 +215,7 @@ local function main()
 	local result_hashes = set_difference(from_hashes, to_hashes)
 
 	if exclude_file then
-		exclude_hashes = read_exclude(exclude_file)
+		local exclude_hashes = read_exclude(exclude_file)
 		result_hashes = set_difference(result_hashes, exclude_hashes)
 	end