Re: [PATCH] sequencer: cleanup for gcc 8.2.1 warning
From: Carlo Arenas <hidden>
Date: 2018-10-25 07:11:03
On Wed, Oct 24, 2018 at 11:22 PM Junio C Hamano [off-list ref] wrote:
and they would read naturally. But may be it is a bit too cute an idea? I dunno.
my first idea was to replace it with a helper called touch_file, since I was expecting it will be a popular operation as flag files are common in shell scripts and that name will be second nature to anyone porting them. the fact that the quiet flag was created with a single '\n' in the code just immediately above this make me go for the proposed "solution" instead (which I verified wouldn't change behaviour as you described in your post; I apologize for not documenting it in the commit and wasting your time). would something like this work better? (not to apply, and probably mangled)
--- a/sequencer.c
+++ b/sequencer.c@@ -35,6 +35,8 @@ #define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION" +#define touch_file(path) write_file(path, "%s", "") + const char sign_off_header[] = "Signed-off-by: "; static const char cherry_picked_prefix[] = "(cherry picked from commit ";
@@ -2389,7 +2391,7 @@ int write_basic_state(struct replay_opts *opts,const char *head_name,
write_file(rebase_path_quiet(), "\n");
if (opts->verbose)
- write_file(rebase_path_verbose(), "");
+ touch_file(rebase_path_verbose());
if (opts->strategy)
write_file(rebase_path_strategy(), "%s\n", opts->strategy);
if (opts->xopts_nr > 0)