Re: [PATCH] git-status: Show empty directories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jun 9, 2012 at 4:13 PM,  <konglu@xxxxxxxxxxxxxxx> wrote:
>
> Leila Muhtasib <muhtasib@xxxxxxxxx> a écrit :
>
>
>>  wt-status.c |   24 +++++++++++++++++++-----
>>  1 files changed, 19 insertions(+), 5 deletions(-)
>
>
> Do not forget to also update the test that need 'git
> status'. For example, most of the tests in t7508 are
> broken with your patch (the change is not huge, just
> adding "and directories" at the end of "untracked files:"
> here and there and maybe some other minor details).
> Otherwise, the idea seems good to me :).
>

Thanks! I didn't update the tests. I will do so now.

>
>>        for (i = 0; i < dir.nr; i++) {
>>                struct dir_entry *ent = dir.entries[i];
>>                if (cache_name_is_other(ent->name, ent->len) &&
>> -                   match_pathspec(s->pathspec, ent->name, ent->len, 0,
>> NULL))
>> -                       string_list_insert(&s->untracked, ent->name);
>> +                   match_pathspec(s->pathspec, ent->name, ent->len, 0,
>> NULL)) {
>> +                       if (is_empty_dir(ent->name)) {
>> +                               struct strbuf buf_name = STRBUF_INIT;
>> +                               strbuf_addstr(&buf_name, ent->name);
>> +                               strbuf_addstr(&buf_name, " (empty
>> directories cannot be added)");
>> +                               string_list_insert(&s->untracked,
>> buf_name.buf);
>> +                               strbuf_release(&buf_name);
>> +                       }
>> +                       else
>> +                               string_list_insert(&s->untracked,
>> ent->name);
>
>
> The structure is
>      if (...) {
>             /*code*/
>      } else {
>             /*code*/
>      }
>
> Do not forget braces in the "else" part as the firt block needs it.

I was under the impression that one liners didn't require parenthesis
according to the style guidelines. I didn't realize that if the 'if'
required it, then the else required it. I will make that change and
remember it for the future. Thanks!

>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]