Yeah if that is the convention then I have no problem with the change.
-Brandon
On Thu, Sep 15, 2016 at 2:12 PM, Stefan Beller <sbeller@google.com> wrote:
Show 51 quoted lines
> + cc Brandon
>
> On Thu, Sep 15, 2016 at 1:51 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> If we were to follow the convention to leave an optional string
>> variable to NULL, we'd need to do this on top. I am not sure if it
>> is a good change, though.
>
> I think it is a good change.
>
> Thanks,
> Stefan
>
>> ---
>> builtin/ls-files.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/builtin/ls-files.c b/builtin/ls-files.c
>> index 6e78c71..687e475 100644
>> --- a/builtin/ls-files.c
>> +++ b/builtin/ls-files.c
>> @@ -29,7 +29,7 @@ static int show_valid_bit;
>> static int line_terminator = '\n';
>> static int debug_mode;
>> static int show_eol;
>> -static const char *output_path_prefix = "";
>> +static const char *output_path_prefix;
>> static int recurse_submodules;
>>
>> static const char *prefix;
>> @@ -78,7 +78,7 @@ static void write_name(const char *name)
>> * churn.
>> */
>> static struct strbuf full_name = STRBUF_INIT;
>> - if (*output_path_prefix) {
>> + if (output_path_prefix && *output_path_prefix) {
>> strbuf_reset(&full_name);
>> strbuf_addstr(&full_name, output_path_prefix);
>> strbuf_addstr(&full_name, name);
>> @@ -181,7 +181,8 @@ static void show_gitlink(const struct cache_entry *ce)
>> argv_array_push(&cp.args, "ls-files");
>> argv_array_push(&cp.args, "--recurse-submodules");
>> argv_array_pushf(&cp.args, "--output-path-prefix=%s%s/",
>> - output_path_prefix, ce->name);
>> + output_path_prefix ? output_path_prefix : "",
>> + ce->name);
>> cp.git_cmd = 1;
>> cp.dir = ce->name;
>> status = run_command(&cp);
>> --
>> 2.10.0-458-g97b4043
>>