Skip to content

Commit 19ad68d

Browse files
Roger Straingitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 68f8ff8 commit 19ad68d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/subtree/git-subtree.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ process_split_commit () {
633633
else
634634
# processing commit without normal parent information;
635635
# fetch from repo
636-
parents=$(git show -s --pretty=%P "$rev")
636+
parents=$(git rev-parse "$rev^@")
637637
extracount=$(($extracount + 1))
638638
fi
639639

0 commit comments

Comments
 (0)