sequencer: trivial cleanup
PATCH 1/1 sequencer: trivial cleanup
--- sequencer.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
sequencer.c +1 -4
@@ -466,10 +466,7 @@ static int allow_empty(struct replay_opts *opts, struct commit *commit) empty_commit =is_original_commit_empty (commit);if (empty_commit <0 )return empty_commit; -if (!empty_commit) -return 0 ; -else -return 1 ; +return empty_commit ?0 :1 ; }static int do_pick_commit (struct commit *commit,struct replay_opts *opts)
Signature · 1 line
1.8.4.100.gde18f6d.dirty
Quoted 10 lines · Ramkumar Ramachandra
Signed-off-by Ramkumar Ramachandra <[email protected]>--- sequencer.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)sequencer.c +0
-0
sequencer.c static int allow_empty(struct replay_opts *opts, struct commit *commit) · line 470
Quoted 9 lines
sequencer.c +1
-4@@ -466,10 +466,7 @@ static int allow_empty(struct replay_opts *opts, struct commit *commit) empty_commit =is_original_commit_empty (commit);if (empty_commit <0 )return empty_commit; -if (!empty_commit) -return 0 ; -else -return 1 ; +return empty_commit ?0 :1 ; }
Isn't it the other way around? Moreover, 'return !!empty_commit;' would be simpler.
Signature · 1 line
Felipe Contreras
Hi,
Quoted 15 lines · Felipe Contreras
Quoted 14 lines · Ramkumar Ramachandra
Signed-off-by Ramkumar Ramachandra <[email protected]>--- sequencer.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)sequencer.c +0
-1@@ -466,10 +466,7 @@ static int allow_empty(struct replay_opts *opts, struct commit *commit) empty_commit =is_original_commit_empty (commit);if (empty_commit <0 )return empty_commit; -if (!empty_commit)
Quoted 8 lines
sequencer.c static int allow_empty(struct replay_opts *opts, struct commit *commit) · line 470
Quoted 5 lines
sequencer.c +1
-3-return 0 ; - else - return 1; +return empty_commit ?0 :1 ; }Isn't it the other way around? Moreover, 'return !!empty_commit;' would be simpler.
Considering the possible return values from is_original_commit_empty(), I think all this could be written as
return is_original_commit_empty(commit);
Best,
Gábor
Quoted 12 lines · Felipe Contreras
Quoted 12 lines
sequencer.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)sequencer.c +0
-1@@ -466,10 +466,7 @@ static int allow_empty(struct replay_opts *opts, struct commit *commit) empty_commit =is_original_commit_empty (commit);if (empty_commit <0 )return empty_commit; -if (!empty_commit)
Quoted 8 lines
sequencer.c static int allow_empty(struct replay_opts *opts, struct commit *commit) · line 470
Quoted 5 lines
sequencer.c +1
-3-return 0 ; - else - return 1; +return empty_commit ?0 :1 ; }Isn't it the other way around? Moreover, 'return !!empty_commit;' would be simpler.
Yeah, thanks for pointing out this grave stupidity. This seems to be inconsequential as far as the tests are concerned: have to do some major yak shaving.