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

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

 



Gisle Aas <gisle.aas@xxxxxxxxx> wrote:
> I found this useful when import multiple external repositories to be merged
> into a single git repo.  Not having the files be renamed during the merge
> made it easier to follow the history of the individual files.
> 
> Signed-off-by: Gisle Aas <gisle@xxxxxx>
> ---
>  Documentation/git-fast-import.txt |    6 ++++++
>  fast-import.c                     |   24 ++++++++++++++++++++++++
>  2 files changed, 30 insertions(+), 0 deletions(-)

Interesting.  Test cases?
 
> +static const char *path_prefix_prepend(struct strbuf *sb, const char *p)
> +{
> +	if (p != sb->buf) {
> +	    strbuf_reset(sb);
> +	    strbuf_addstr(sb, p);
> +	}

I'd be a bit happier about the change if you could check not only
that p != sb->buf, but that p is not within sb->buf + sb->alloc.

I can't remember if all of the cases below are safe such that
any time you call the function with a p that p isn't pointing to
something within the strbuf you are handing in.

-- 
Shawn.
--
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]