diff options
author | 2015-08-24 09:12:53 -0700 | |
---|---|---|
committer | 2015-08-24 11:18:59 -0700 | |
commit | 25b763ba7a544d05fc46ad601f3f9c50a4cea8b0 (patch) | |
tree | af6b22fc2b3422382f38173ac7f4538553398d6f /t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side | |
parent | am: let --signoff override --no-signoff (diff) | |
download | tgif-25b763ba7a544d05fc46ad601f3f9c50a4cea8b0.tar.xz |
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>
Diffstat (limited to 't/t4013/diff.diff-tree_--pretty_--patch-with-stat_side')
0 files changed, 0 insertions, 0 deletions