{"thread":{"id":"34173","subject":"[PATCH] [submodule] Remove duplicate call to set_rev_name","startedAt":"2013-06-17T09:55:36Z","lastAt":"2013-06-21T17:03:44Z","messageCount":3,"participants":["Fredrik Gustafsson","Heiko Voigt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"221048","messageId":"1371462936-9672-1-git-send-email-iveqy@iveqy.com","threadId":"34173","inReplyTo":null,"subject":"[PATCH] [submodule] Remove duplicate call to set_rev_name","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2013-06-17T09:55:36Z","receivedAt":"2013-06-17T09:55:36Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"set_rev_name is a possible expensive operation. If a submodule has\nchanges in it, set_rev_name was called twice.\n\nSolution is to move set_rev_name so it's only called once, no matter the\ncodepath taken.\n\nSigned-off-by: Fredrik Gustafsson <iveqy@iveqy.com>\n---\n git-submodule.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 79bfaac..75feaf1 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -1129,16 +1129,16 @@ cmd_status()\n \t\t\tsay \"-$sha1 $displaypath\"\n \t\t\tcontinue;\n \t\tfi\n-\t\tset_name_rev \"$sm_path\" \"$sha1\"\n \t\tif git diff-files --ignore-submodules=dirty --quiet -- \"$sm_path\"\n \t\tthen\n+\t\t\tset_name_rev \"$sm_path\" \"$sha1\"\n \t\t\tsay \" $sha1 $displaypath$revname\"\n \t\telse\n \t\t\tif test -z \"$cached\"\n \t\t\tthen\n \t\t\t\tsha1=$(clear_local_git_env; cd \"$sm_path\" && git rev-parse --verify HEAD)\n-\t\t\t\tset_name_rev \"$sm_path\" \"$sha1\"\n \t\t\tfi\n+\t\t\tset_name_rev \"$sm_path\" \"$sha1\"\n \t\t\tsay \"+$sha1 $displaypath$revname\"\n \t\tfi\n \n-- \n1.8.0\n"},{"id":"221528","messageId":"20130620215812.GA2687@sandbox-ub","threadId":"34173","inReplyTo":"1371462936-9672-1-git-send-email-iveqy@iveqy.com","subject":"Re: [PATCH] [submodule] Remove duplicate call to set_rev_name","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2013-06-20T21:58:12Z","receivedAt":"2013-06-20T21:58:12Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"Hi,\n\nOn Mon, Jun 17, 2013 at 11:55:36AM +0200, Fredrik Gustafsson wrote:\n> set_rev_name is a possible expensive operation. If a submodule has\n> changes in it, set_rev_name was called twice.\n> \n> Solution is to move set_rev_name so it's only called once, no matter the\n> codepath taken.\n\nLooks good to me.\n\nCheers Heiko\n"},{"id":"221613","messageId":"7vy5a3mm4v.fsf@alter.siamese.dyndns.org","threadId":"34173","inReplyTo":"20130620215812.GA2687@sandbox-ub","subject":"Re: [PATCH] [submodule] Remove duplicate call to set_rev_name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-21T17:03:44Z","receivedAt":"2013-06-21T17:03:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Heiko Voigt <hvoigt@hvoigt.net> writes:\n\n> Hi,\n>\n> On Mon, Jun 17, 2013 at 11:55:36AM +0200, Fredrik Gustafsson wrote:\n>> set_rev_name is a possible expensive operation. If a submodule has\n>> changes in it, set_rev_name was called twice.\n>> \n>> Solution is to move set_rev_name so it's only called once, no matter the\n>> codepath taken.\n>\n> Looks good to me.\n\nThanks.\n"}]}