Files
git/builtin
Junio C Hamano 25b763ba7a builtin/am: introduce write_state_*() helper functions
There are many calls to write_file() that repeat the same pattern in
the implementation of the builtin version of "am".  They all share
the same traits, i.e they

 - produce a text file with a single string in it;

 - have enough information to produce the entire contents of that
   file;

 - generate the pathname of the file by making a call to am_path(); and

 - they ask write_file() to die() upon failure.

The slight differences among the call sites throw them into roughly
three categories:

 - many write either "t" or "f" based on a boolean value to a file;

 - some write the integer value in decimal text;

 - some others write more general string, e.g. an object name in
   hex, an empty string (i.e. the presense of the file itself serves
   as a flag), etc.

Introduce three helpers, write_state_bool(), write_state_count() and
write_state_text(), to reduce direct calls to write_file().

This is a preparatory step for the next step to ensure that no
"state" file this command leaves in $GIT_DIR is with an incomplete
line at the end.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-24 11:18:59 -07:00
..
2015-06-25 10:47:46 -07:00
2015-08-03 11:01:27 -07:00
2015-07-13 14:02:19 -07:00
2015-08-03 11:01:17 -07:00
2015-06-22 13:17:10 -07:00
2015-08-03 11:01:18 -07:00
2015-07-13 14:02:02 -07:00
2015-03-20 13:11:53 -07:00
2015-08-03 11:01:18 -07:00
2015-08-03 11:01:27 -07:00
2015-06-05 12:17:36 -07:00
2015-07-13 14:02:02 -07:00
2015-06-18 13:18:59 -07:00
2015-06-22 13:17:10 -07:00
2015-05-11 14:23:39 -07:00
2015-08-03 11:01:10 -07:00
2015-07-13 14:02:19 -07:00