subtree: performance improvement for finding unexpected parent commits

After testing a previous patch at larger scale, a performance issue was detected when using git show to locate parent revisions, with a single run of the git show command taking 2 seconds or longer in a complex repo. When the command is required tens or hundreds of times in a run of the script, the additional wait time is unaccepatable. Replacing the command with git rev-parse resulted in significantly increased performance, with the command in question returning instantly. Signed-off-by: Roger Strain <rstrain@swri.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Roger Strain committed Oct 12, 2018 at 08:52 UTC 19ad68d95d6f8104eca1e86f8d1dfae50c7fb268
1 file changed +1 -1
contrib/subtree/git-subtree.sh
+1 -1
@@ -633,7 +633,7 @@ process_split_commit () {
633 else
634 # processing commit without normal parent information;
635 # fetch from repo
636 - parents=$(git show -s --pretty=%P "$rev")
636 + parents=$(git rev-parse "$rev^@")
637 extracount=$(($extracount + 1))
638 fi
639