Code

revert: Eliminate global "commit" variable
authorRamkumar Ramachandra <artagnon@gmail.com>
Thu, 4 Aug 2011 10:39:04 +0000 (16:09 +0530)
committerJunio C Hamano <gitster@pobox.com>
Thu, 4 Aug 2011 22:40:42 +0000 (15:40 -0700)
commit708f9d96d95be7e9912eea8350fdf3f04484695f
tree96fc05edc024ba41c47a994701bdb8100dac8425
parent54decbd4d858f21e2c31601f91675700c7093b1f
revert: Eliminate global "commit" variable

Functions which act on commits currently rely on a file-scope static
variable to be set before they're called.  Consequently, the API and
corresponding callsites are ugly and unclear.  Remove this variable
and change their API to accept the commit to act on as additional
argument so that the callsites change from looking like

  commit = prepare_a_commit();
  act_on_commit();

to looking like

  commit = prepare_a_commit();
  act_on_commit(commit);

This change is also in line with our long-term goal of exposing some
of these functions through a public API.

Inspired-by: Christian Couder <chriscool@tuxfamily.org>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/revert.c