Revision f43ba60e2c3bec4925eee229fa0f420dd1296f0c authored by Linus Torvalds on 13 April 2006, 17:01:02 UTC, committed by Junio C Hamano on 13 April 2006, 18:26:56 UTC
This trivially avoids keeping the commit message data around after we
don't need it any more, avoiding a continually growing "git log" memory
footprint.

It's not a huge deal, but it's somewhat noticeable. For the current kernel
tree, doing a full "git log" I got

 - before: /usr/bin/time git log > /dev/null
	0.81user 0.02system 0:00.84elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+8851minor)pagefaults 0swaps

 - after: /usr/bin/time git log > /dev/null
	0.79user 0.03system 0:00.83elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+5039minor)pagefaults 0swaps

ie the touched pages dropped from 8851 to 5039. For the historic kernel
archive, the numbers are 18357->11037 minor page faults.

We could/should in theory free the commits themselves, but that's really a
lot harder, since during revision traversal we may hit the same commit
twice through different children having it as a parent, even after we've
shown it once (when that happens, we'll silently ignore it next time, but
we still need the "struct commit" to know).

And as the commit message data is clearly the biggest part of the commit,
this is the really easy 60% solution.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent d533524
Raw File
t3500-cherry.sh
#!/bin/sh
#
# Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland
#

test_description='git-cherry should detect patches integrated upstream

This test cherry-picks one local change of two into master branch, and
checks that git-cherry only returns the second patch in the local branch
'
. ./test-lib.sh

export GIT_AUTHOR_EMAIL=bogus_email_address

test_expect_success \
    'prepare repository with topic branch, and check cherry finds the 2 patches from there' \
    'echo First > A &&
     git-update-index --add A &&
     git-commit -m "Add A." &&

     git-checkout -b my-topic-branch &&

     echo Second > B &&
     git-update-index --add B &&
     git-commit -m "Add B." &&

     sleep 2 &&
     echo AnotherSecond > C &&
     git-update-index --add C &&
     git-commit -m "Add C." &&

     git-checkout -f master &&

     echo Third >> A &&
     git-update-index A &&
     git-commit -m "Modify A." &&

     expr "$(echo $(git-cherry master my-topic-branch) )" : "+ [^ ]* + .*"
'

test_expect_success \
    'check that cherry with limit returns only the top patch'\
    'expr "$(echo $(git-cherry master my-topic-branch my-topic-branch^1) )" : "+ [^ ]*"
'

test_expect_success \
    'cherry-pick one of the 2 patches, and check cherry recognized one and only one as new' \
    'git-cherry-pick my-topic-branch^0 &&
     echo $(git-cherry master my-topic-branch) &&
     expr "$(echo $(git-cherry master my-topic-branch) )" : "+ [^ ]* - .*"
'

test_done
back to top