author | Junio C Hamano <gitster@pobox.com> | |
Sun, 22 Jun 2008 06:28:58 +0000 (23:28 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 22 Jun 2008 07:44:26 +0000 (00:44 -0700) | ||
commit | 9022a495a3c407859560d4ac4a278c0d6ad58837 | |
tree | 38a8b3e0e2813cef7ebfcc69b094bc3bb06ffc65 | tree | snapshot |
parent | 73f03627f4f1b0f66b30fa96a25537f3600cce0b | commit | diff |
rerere: rerere_created_at() and has_resolution() abstraction
There were too many places in the code how an entry in the rerere database
looks like, and the garbage_collect() function that iterates over
subdirectories of the rr-cache directory was the worse offender.
Introduce two helper functions, rerere_created_at() and has_resolution(),
to abstract out the logic a bit better.
Incidentally this fixes a small memory leak in garbage_collect()
function. The path list to collect the entries to be pruned were defined
to strdup the paths but the caller was feeding a path after doing an extra
copy. Because the list does not have to be sorted by conflict signature
hash, we use path_list_append() instead of path_list_insert().
While we are at it, make a conflicted hunk comparision in handle_file() a
bit easier to read.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
There were too many places in the code how an entry in the rerere database
looks like, and the garbage_collect() function that iterates over
subdirectories of the rr-cache directory was the worse offender.
Introduce two helper functions, rerere_created_at() and has_resolution(),
to abstract out the logic a bit better.
Incidentally this fixes a small memory leak in garbage_collect()
function. The path list to collect the entries to be pruned were defined
to strdup the paths but the caller was feeding a path after doing an extra
copy. Because the list does not have to be sorted by conflict signature
hash, we use path_list_append() instead of path_list_insert().
While we are at it, make a conflicted hunk comparision in handle_file() a
bit easier to read.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-rerere.c | diff | blob | history |