git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Gisle Aas <gisle.aas@it.uib.no>
Cc: git@vger.kernel.org, gitster@pobox.com, Gisle Aas <gisle@aas.no>
Subject: Re: [PATCH] Add --path-prefix option to git-fast-import
Date: Tue, 29 Dec 2009 07:08:44 -0800	[thread overview]
Message-ID: <20091229150844.GC6152@spearce.org> (raw)
In-Reply-To: <1262091083-25401-1-git-send-email-gisle.aas@it.uib.no>

Gisle Aas <gisle.aas@it.uib.no> 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@aas.no>
> ---
>  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.

      parent reply	other threads:[~2009-12-29 15:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-29 12:51 [PATCH] Add --path-prefix option to git-fast-import Gisle Aas
2009-12-29 14:06 ` Sverre Rabbelier
2009-12-30  8:17   ` Gisle Aas
2009-12-29 15:08 ` Shawn O. Pearce [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091229150844.GC6152@spearce.org \
    --to=spearce@spearce.org \
    --cc=gisle.aas@it.uib.no \
    --cc=gisle@aas.no \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).