From: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
To: Franck <vagabon.xyz@gmail.com>
Cc: Junio C Hamano <junkio@cox.net>, git@vger.kernel.org
Subject: Re: [PATCH 1/2] Add git-archive
Date: Wed, 06 Sep 2006 22:14:47 +0200 [thread overview]
Message-ID: <44FF2C37.2010400@lsrfire.ath.cx> (raw)
In-Reply-To: <44FED12E.7010409@innova-card.com>
Franck Bui-Huu schrieb:
> Junio C Hamano wrote:
>> "Franck Bui-Huu" <vagabon.xyz@gmail.com> writes:
>>
>>> git-archive is a command to make TAR and ZIP archives of a git tree.
>>> It helps prevent a proliferation of git-{format}-tree commands.
>> Thanks. I like the overall structure, at least mostly.
>> Also dropping -tree suffix from the command name is nice, short
>> and sweet.
>>
>
> great !
>
>> Obviously I cannot apply this patch because it is totally
>> whitespace damaged, but here are some comments.
>
> (sigh), sorry for that.
>
>>> diff --git a/archive.h b/archive.h
>>> new file mode 100644
>>> index 0000000..6c69953
>>> --- /dev/null
>>> +++ b/archive.h
>>> @@ -0,0 +1,43 @@
>>> +#ifndef ARCHIVE_H
>>> +#define ARCHIVE_H
>>> +
>>> +typedef int (*write_archive_fn_t)(struct tree *tree,
>>> + const unsigned char *commit_sha1,
>>> + const char *prefix,
>>> + time_t time,
>>> + const char **pathspec);
>> The type of the first argument might have to be different,
>> depending on performance analysis by Rene on struct tree vs
>> struct tree_desc.
>>
>
> OK. We'll wait for Rene.
The performance difference I noticed was caused by a memleak; the speed
advantage of a struct tree_desc based traverser is significant if you
look only at the traversers' performance, but it is lost in the noise
of the "real" work that the payload function is doing (see my other
mail).
>>> +static int run_remote_archiver(struct archiver_struct *ar, int argc,
>>> + const char **argv)
>>> +{
>>> + char *url, buf[1024];
>>> + pid_t pid;
>>> + int fd[2];
>>> + int len, rv;
>>> +
>>> + sprintf(buf, "git-upload-%s", ar->name);
>> Are you calling git-upload-{tar,zip,rar,...} here?
>>
>
> yes. Actually git-upload-{tar,zip,...} commands are going to be
> removed, but git-daemon know them as a daemon service. It will
> map these services to the generic "git-upload-archive" command.
> One benefit is that we could still disable TAR format and enable
> TGZ one. Please take a look to the second patch that adds
> git-upload-archive command.
I don't think git-daemon should need to care about specific
archivers. Policy decisions, like disallowing certain archive types
or compression levels, should be made in git-upload-archive. This
way all code regarding archive uploading is found in one place:
git-upload-archive. We can keep git-upload-tar as a legacy
interface, but please use only git-upload-archive for the new stuff
(and not git-upload-zip etc.).
>>> +int parse_treeish_arg(const char **argv, struct tree **tree,
>>> + const unsigned char **commit_sha1,
>>> + time_t *archive_time, const char *prefix,
>>> + const char **reason)
>>> +{
>>> ...
>>> + if (prefix) {
>>> + unsigned char tree_sha1[20];
>>> + unsigned int mode;
>>> + int err;
>>> +
>>> + err = get_tree_entry((*tree)->object.sha1, prefix,
>>> + tree_sha1, &mode);
>>> + if (err || !S_ISDIR(mode)) {
>>> + *reason = "current working directory is untracked";
>>> + goto out;
>>> + }
>>> + free(*tree);
>>> + *tree = parse_tree_indirect(tree_sha1);
>>> + }
>> I like the simplicity of just optionally sending one subtree (or
>> the whole thing), but I think this part would be made more
>> efficient if we go with "struct tree_desc" based interface.
>>
>> Also I wonder how this interacts with the pathspec you take from
>> the command line. Personally I think this single subtree
>> support is good enough and limiting with pathspec is not needed.
[Note: There's potential for confusion here because we have two
types of prefixes. One is the present working directory inside the
git archive, the other is the one specified with --prefix=. Here
we have the working directory kind of prefix.]
IMHO should work like in the following example, and the code above
cuts off the Documentation part:
$ cd Documentation
$ git-archive --format=tar --prefix=v1.0/ HEAD howto | tar tf -
v1.0/howto/
v1.0/howto/isolate-bugs-with-bisect.txt
...
I agree that simple subtree matching would be enough, at least for
now.
René
next prev parent reply other threads:[~2006-09-06 20:15 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-05 12:16 [PATCH 1/2] Add git-archive Franck Bui-Huu
2006-09-05 19:23 ` Junio C Hamano
2006-09-06 13:46 ` Franck Bui-Huu
2006-09-06 20:14 ` Rene Scharfe [this message]
2006-09-06 20:29 ` Jakub Narebski
2006-09-08 20:21 ` Rene Scharfe
2006-09-06 21:42 ` Junio C Hamano
2006-09-07 6:32 ` Franck Bui-Huu
2006-09-07 7:19 ` Junio C Hamano
2006-09-07 7:53 ` Franck Bui-Huu
2006-09-07 8:16 ` Junio C Hamano
2006-09-07 13:08 ` Add git-archive [take #2] Franck Bui-Huu
2006-09-07 13:12 ` [PATCH 1/4] Add git-archive Franck Bui-Huu
2006-09-08 2:35 ` Junio C Hamano
2006-09-08 9:00 ` Franck Bui-Huu
2006-09-08 20:21 ` Rene Scharfe
2006-09-09 14:31 ` Franck Bui-Huu
2006-09-09 15:02 ` Rene Scharfe
2006-09-09 15:25 ` Franck Bui-Huu
2006-09-07 13:12 ` [PATCH 2/4] git-archive: wire up TAR format Franck Bui-Huu
2006-09-08 20:21 ` Rene Scharfe
2006-09-08 21:42 ` Junio C Hamano
2006-09-09 1:53 ` Junio C Hamano
2006-09-09 15:02 ` Rene Scharfe
2006-09-09 15:10 ` Franck Bui-Huu
2006-09-09 19:42 ` Junio C Hamano
2006-09-10 16:10 ` [PATCH] Use xstrdup instead of strdup in builtin-{tar,zip}-tree.c Rene Scharfe
2006-09-09 14:38 ` [PATCH 2/4] git-archive: wire up TAR format Franck Bui-Huu
2006-09-07 13:12 ` [PATCH 3/4] git-archive: wire up ZIP format Franck Bui-Huu
2006-09-07 13:12 ` [PATCH 4/4] Add git-upload-archive Franck Bui-Huu
2006-09-07 17:26 ` Add git-archive [take #2] Franck Bui-Huu
2006-09-08 0:37 ` Junio C Hamano
2006-09-08 8:18 ` Franck Bui-Huu
2006-09-08 8:47 ` Jakub Narebski
2006-09-08 8:58 ` Junio C Hamano
2006-09-08 9:43 ` Franck Bui-Huu
2006-09-08 21:42 ` Junio C Hamano
2006-09-08 20:21 ` Rene Scharfe
2006-09-08 21:42 ` Junio C Hamano
2006-09-06 20:17 ` [PATCH 1/2] Add git-archive Rene Scharfe
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=44FF2C37.2010400@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=vagabon.xyz@gmail.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).