Re: [PATCH v2 08/11] rebase: remove redundant strbuf

From
Phillip Wood <hidden>
Date
2021-09-14 10:34:03
Reply to
René Scharfe, 2021-09-13
Hi René

Thanks for looking at this series

On 13/09/2021 19:34, René Scharfe wrote:
Am 13.09.21 um 17:19 schrieb Phillip Wood via GitGitGadget:
quoted
From: Phillip Wood <redacted>
I'd rather see the use of that multi-purpose "buf" reduced, e.g. we
could simplify path-building like this in a few cases:

-       strbuf_reset(&buf);
-       strbuf_addf(&buf, "%s/applying", apply_dir());
-       if(file_exists(buf.buf))
+       if (file_exists(mkpath("%s/applying", apply_dir())))

Sure, this looks a bit lispy, but still better than the old code
because there is no state to carry around and reset when "buf" is
repurposed.
That's a nice suggestion, I think it's much clearer which file we're checking for.

Best Wishes

Phillip
Thread (47 messages) 47 messages, 6 authors, last reply 2021-09-24
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help