Code

commit: reduce use of redundant global variables
authorJunio C Hamano <gitster@pobox.com>
Fri, 19 Aug 2011 18:58:18 +0000 (11:58 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Aug 2011 18:58:18 +0000 (11:58 -0700)
commit06bb643b72cc6c67d7c0ac9b8d923463bae68822
treeab52ede9b662ee7e1c300ebfba6a13fd3d47dc91
parentf696543dad6c7ba27b0c4fab167a5687263a9ba0
commit: reduce use of redundant global variables

The file-scope global variable head_sha1[] was used to hold the object
name of the current HEAD commit (unless we are about to make an initial
commit). Also there is an independent "static int initial_commit".

Fix all the functions on the call-chain that use these two variables to
take a new "(const) struct commit *current_head" argument instead, and
replace their uses, e.g. "if (initial_commit)" becomes "if (!current_head)"
and a reference to "head_sha1" becomes "current_head->object.sha1".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit.c