git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] Add git-archive

From
Junio C Hamano <junkio@cox.net>
Date
Sep 6, 2006, 21:42 UTC
Message-ID
<7vac5c7jty.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<44FED12E.7010409@innova-card.com>
Franck Bui-Huu <vagabon.xyz@gmail.com> writes:
Show 11 quoted lines
>>> +typedef int (*parse_extra_args_fn_t)(int argc,
>>> +				     const char **argv,
>>> +				     const char **reason);
>>> +
>> 
>> I do not see a way for parse_extra to record the parameter it
>> successfully parsed, other than in a source-file-global, static
>> variable.  Not a very nice design for a library, if we are
>> building one from scratch.
>
> Interesting, could you explain why static variables are not nice ?
Mostly taste and a little bit of re-entrancy worries.
Show 7 quoted lines
> You might have missed my second patch:
>
> 		"[PATCH 2/2] Add git-upload-archive"
>
> Basically the server can also use 'reason' to report a failure
> description during NACK. I find it more useful than the simple
> "server sent EOF" error message.

That's a good intention, but we would also need to convey the "server side found problem and died with these error() output" anyway, so it would be covered either way (see how error()/die() messages from git-upload-pack are given to git-fetch-pack over the wire).

Show 5 quoted lines
> 'remote' case is not a generic argument that can be passed to
> archiver backends. Remember, the archiver backends only do local
> operation. They do not know about remote protocol which is part
> of git-archive command. That's the reason why I think we shouldn't
> make this field part of arguments structure.
Ok.  Passing that as a separate paramter would make sense.
Show 6 quoted lines
>> After parse_archive_args finds the archiver specified with
>> --format=*, it can call its parse_extra to retrieve a suitable
>> struct that has struct archive_args embedded at the beginning,
>> and then set remote and prefix on the returned structure.
>
> One bad side is that we need to malloc this embedded structure.

Not at all, if you read the example I did you would notice that I changed parse_extra for each backend to return this structure allocated for that particular backend.

Show 14 quoted lines
>>> +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.

That would break "git-archive --remove=ssh://site/repo treeish" wouldn't it?

Previous: Rene ScharfeNext: Franck Bui-Huu
Message 7 of 40 in “Add git-archive”
  1. 1/2 Add git-archiveFranck Bui-Huu, Sep 5, 2006
  2. Junio C HamanoSep 5, 2006
  3. Franck Bui-HuuSep 6, 2006
  4. Rene ScharfeSep 6, 2006
  5. Jakub NarebskiSep 6, 2006
  6. Rene ScharfeSep 8, 2006
  7. Junio C HamanoSep 6, 2006
  8. Franck Bui-HuuSep 7, 2006
  9. Junio C HamanoSep 7, 2006
  10. Franck Bui-HuuSep 7, 2006
  11. Junio C HamanoSep 7, 2006
  12. Add git-archive [take #2]Franck Bui-Huu, Sep 7, 2006
  13. 1/4 Add git-archiveFranck Bui-Huu, Sep 7, 2006
  14. Junio C HamanoSep 8, 2006
  15. Franck Bui-HuuSep 8, 2006
  16. Rene ScharfeSep 8, 2006
  17. Franck Bui-HuuSep 9, 2006
  18. Rene ScharfeSep 9, 2006
  19. Franck Bui-HuuSep 9, 2006
  20. 2/4 git-archive: wire up TAR format.Franck Bui-Huu, Sep 7, 2006
  21. Rene ScharfeSep 8, 2006
  22. Junio C HamanoSep 8, 2006
  23. Junio C HamanoSep 9, 2006
  24. Rene ScharfeSep 9, 2006
  25. Franck Bui-HuuSep 9, 2006
  26. Junio C HamanoSep 9, 2006
  27. Use xstrdup instead of strdup in builtin-{tar,zip}-tree.cRene Scharfe, Sep 10, 2006
  28. Franck Bui-HuuSep 9, 2006
  29. 3/4 git-archive: wire up ZIP format.Franck Bui-Huu, Sep 7, 2006
  30. 4/4 Add git-upload-archiveFranck Bui-Huu, Sep 7, 2006
  31. Franck Bui-HuuSep 7, 2006
  32. Junio C HamanoSep 8, 2006
  33. Franck Bui-HuuSep 8, 2006
  34. Jakub NarebskiSep 8, 2006
  35. Junio C HamanoSep 8, 2006
  36. Franck Bui-HuuSep 8, 2006
  37. Junio C HamanoSep 8, 2006
  38. Rene ScharfeSep 8, 2006
  39. Junio C HamanoSep 8, 2006
  40. Rene ScharfeSep 6, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.