diff mbox series

[5/9] subtree: define a variable before its first use in 'find_latest_squash'

Message ID 200f7341c91df2cd616cbc4bdcd8025bed3af7ea.1666365220.git.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit 34ab458cb1df13ca400c10bbc4ff69c75a4e217e
Headers show
Series subtree: fix split and merge after annotated tag was squash-merged | expand

Commit Message

Philippe Blain Oct. 21, 2022, 3:13 p.m. UTC
From: Philippe Blain <levraiphilippeblain@gmail.com>

The function 'find_latest_squash' takes a single argument, 'dir', but a
debug statement uses this variable before it takes its value from $1.

This statement thus gets the value of 'dir' from the calling function,
which currently is the same as the 'dir' argument, so it works but it
is confusing.

Move the definition of 'dir' before its first use.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/subtree/git-subtree.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 89f1eb756f0..d91a9679075 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -374,10 +374,10 @@  try_remove_previous () {
 # Usage: find_latest_squash DIR
 find_latest_squash () {
 	assert test $# = 1
+	dir="$1"
 	debug "Looking for latest squash ($dir)..."
 	local indent=$(($indent + 1))
 
-	dir="$1"
 	sq=
 	main=
 	sub=