From: "Shawn O. Pearce" <spearce@spearce.org>
To: Julian Phillips <julian@quantumfyre.co.uk>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] fast-import: Add ability to copy a path from an arbitrary commit
Date: Fri, 26 Oct 2007 03:01:57 -0400 [thread overview]
Message-ID: <20071026070157.GM14735@spearce.org> (raw)
In-Reply-To: <20071020155749.29528.9258.julian@quantumfyre.co.uk>
Julian Phillips <julian@quantumfyre.co.uk> wrote:
> This adds the ability to copy a path from an arbitrary commit instead
> of just from the current commit. This is done using the 'K' version
> of the filecopy sub-command.
So the reason I didn't apply this earlier when I was playing the role
of "interim maintainer" was four fold:
- There's no test cases for this new 'K' command. Everything else
in fast-import has at least one test case for it, this should
as well.
- There's a huge memory leak every time you use the 'K' command.
See below in the code for where.
- The documentation doesn't talk about the special "/" source path.
- I was really busy and just forgot to reply to this email.
Other than that I think this is good. I've just been too busy
to do it myself, and I'm glad that you took it upon yourself to
remedy that.
> diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
> index d511967..89aefea 100644
> --- a/Documentation/git-fast-import.txt
> +++ b/Documentation/git-fast-import.txt
> @@ -534,6 +534,17 @@ location has been copied to the destination any future commands
> applied to the source location will not impact the destination of
> the copy.
>
> +It is also possible to copy a file or directory from a commit other
> +than the current one.
> +
> +....
> + 'K' <dataref> SP <path> SP <path> LF
> +....
> +
> +where `<dataref>` is a reference (see `filemodify` above) to the
> +commit that the first (source) `<path>` is located in, the second
> +`<path>` is the destination.
> +
This should talk about the special case of the first (src) <path>
being able to be "/" to copy the entire tree. If I follow your
implementation right a src_path of "/" also causes the destination
path to be ignored entirely. Which means you cannot copy another
branch into a subdirectory of this branch (aka one direction of
the subtree merge strategy).
> diff --git a/fast-import.c b/fast-import.c
> index e9c80be..9537c63 100644
> --- a/fast-import.c
> +++ b/fast-import.c
...
> +static void copy_from_commit(
> + unsigned char *src_commit, const char *src_path,
> + struct branch *dest_br, const char *dest_path)
...
> + load_tree(&src_br.branch_tree);
This is a huge memory leak. You never unload this tree and return
its data onto the freelists so we'll leak everything that wasn't
moved into the destination tree.
--
Shawn.
parent reply other threads:[~2007-10-26 7:03 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20071020155749.29528.9258.julian@quantumfyre.co.uk>]
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=20071026070157.GM14735@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=julian@quantumfyre.co.uk \
/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).