Skip to content

Commit b545cd1

Browse files
iveqygitster
authored andcommitted
git-submodule.sh: remove duplicate call to set_rev_name
set_rev_name is a possiblly expensive operation. If a submodule has changes in it, set_rev_name was called twice. Move call to set_rev_name so it's only called once, no matter which codepath is taken. Signed-off-by: Fredrik Gustafsson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fb7dfaa commit b545cd1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

git-submodule.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,16 +1129,16 @@ cmd_status()
11291129
say "-$sha1 $displaypath"
11301130
continue;
11311131
fi
1132-
set_name_rev "$sm_path" "$sha1"
11331132
if git diff-files --ignore-submodules=dirty --quiet -- "$sm_path"
11341133
then
1134+
set_name_rev "$sm_path" "$sha1"
11351135
say " $sha1 $displaypath$revname"
11361136
else
11371137
if test -z "$cached"
11381138
then
11391139
sha1=$(clear_local_git_env; cd "$sm_path" && git rev-parse --verify HEAD)
1140-
set_name_rev "$sm_path" "$sha1"
11411140
fi
1141+
set_name_rev "$sm_path" "$sha1"
11421142
say "+$sha1 $displaypath$revname"
11431143
fi
11441144

0 commit comments

Comments
 (0)