]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/pack-objects.c
pack-objects: refactor write_object() into helper functions
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Wed, 16 May 2012 12:02:10 +0000 (19:02 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 18 May 2012 21:22:15 +0000 (14:22 -0700)
commitc9018b0305a56436c85b292edbeacff04b0ebb5d
treea95afbde202beeb0f53cb0ffc1182a2e3fd9547b
parent754980d02386e09d0277d22284375686c197ddbd
pack-objects: refactor write_object() into helper functions

The function first decides if we want to copy data taken from existing
pack verbatim or we want to encode the data ourselves for the packfile
we are creating and then carries out the decision.  Separate the latter
phase into two helper functions, one for the case the data is reused,
the other for the case the data is produced anew.

A little twist is that it can later turn out that we cannot reuse the
data after we initially decide to do so; in such a case, the "reuse"
helper makes a call to "generate" helper.  It is easier to follow than
the current fallback code that uses "goto" inside a single large
function.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c