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 <iveqy@iveqy.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Fredrik Gustafsson committed
Jun 17, 2013 at 11:55 UTC
b545cd15af873fe15e692daaa6e804b191b451cc
1 file changed
+2
-2
git-submodule.sh
+2
-2
@@ -1129,16 +1129,16 @@ cmd_status()
1129
say "-$sha1 $displaypath"
1130
continue;
1131
fi
1132
- set_name_rev "$sm_path" "$sha1"
1132
if git diff-files --ignore-submodules=dirty --quiet -- "$sm_path"
1133
then
1134
+ set_name_rev "$sm_path" "$sha1"
1135
say " $sha1 $displaypath$revname"
1136
else
1137
if test -z "$cached"
1138
then
1139
sha1=$(clear_local_git_env; cd "$sm_path" && git rev-parse --verify HEAD)
1140
- set_name_rev "$sm_path" "$sha1"
1140
fi
1141
+ set_name_rev "$sm_path" "$sha1"
1142
say "+$sha1 $displaypath$revname"
1143
fi
1144