Re: [PATCH] Add --path-prefix option to git-fast-import

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

 



On Dec 29, 2009, at 15:06, Sverre Rabbelier wrote:

> Heya,
> 
> On Tue, Dec 29, 2009 at 06:51, Gisle Aas <gisle.aas@xxxxxxxxx> wrote:
>> +static const char *path_prefix_prepend(struct strbuf *sb, const char *p)
>> +{
>> +       if (p != sb->buf) {
>> +           strbuf_reset(sb);
>> +           strbuf_addstr(sb, p);
>> +       }
>> +       strbuf_insert(sb, 0, path_prefix, path_prefix_len);
>> +       return sb->buf;
>> +}
>> +
>>  static void file_change_m(struct branch *b)
>>  {
>>        const char *p = command_buf.buf + 2;
>> @@ -1909,6 +1921,8 @@ static void file_change_m(struct branch *b)
>>                        die("Garbage after path in: %s", command_buf.buf);
>>                p = uq.buf;
>>        }
>> +       if (path_prefix)
>> +           p = path_prefix_prepend(&uq, p);
> 
> You could reduce the size of this change by having path_prefix_prepend
> check for path_prefix and just do nothing if it is not set.

I felt the explict test was better style -- more obvious that nothing happens to p
when there is no path_prefix.

--Gisle--
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]