path: root/builtin/annotate.c
diff options
authorJunio C Hamano <>2015-08-24 16:12:53 (GMT)
committerJunio C Hamano <>2015-08-24 18:18:59 (GMT)
commit25b763ba7a544d05fc46ad601f3f9c50a4cea8b0 (patch)
treeaf6b22fc2b3422382f38173ac7f4538553398d6f /builtin/annotate.c
parentb5e823594cff190bc18361207a89b08d57b038d7 (diff)
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 <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/annotate.c')
0 files changed, 0 insertions, 0 deletions