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

Re: [PATCH 2/4] git-archive: wire up TAR format.

From
FBFranck Bui-Huu <vagabon.xyz@gmail.com>
Date
Sep 9, 2006, 15:10 UTC
Message-ID
<cda58cb80609090810t6fdab535r761636e65205a0f@mail.gmail.com>
In-Reply-To
<7vk64derfd.fsf@assigned-by-dhcp.cox.net>
2006/9/9, Junio C Hamano <junkio@cox.net>:
Show 20 quoted lines
> Junio C Hamano <junkio@cox.net> writes:
>
> > Rene Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
> >
> >> I did not sign off this exact patch.  I wrote and submitted the
> >> builtin-tar-tree.c part, with memory leak and all, then sent a note
> >> on where the leak needs to be plugged.  You put it together and
> >> converted it to struct archiver_args.  I'd very much have liked to
> >> see a comment stating this.  Or simply just say "based on code by
> >> Rene" or something.  The same is true for patch 3/4.
> >>...
> >> Especially I would not have signed off this invisible comment. ;)
> >
> > I take your response is a mild NAK.
>
> Just to reduce everybody's pain, why don't I fix them up and
> push out the 4 series in "pu" with attribution clarification and
> review comments from Rene in mind, so that you two can Ack them?
> After that they will be placed on "next".
>

Almost Acked by me, except you've missed some Rene's comments. And more important I fixed an "uninitialized variable" bug. See patch below.

Show 5 quoted lines
> I needed to apply small tweaks on 1/4 (ANSI-C pedantic did not
> like empty struct initializers) and 4/4 (the updated 1/1 needed
> the way struct archiver is initialized and used be different
> from the original one) as well.
>
thanks for that.
-- >8 --
diff --git a/builtin-archive.c b/builtin-archive.c
index 0a02519..9b90d87 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -28,7 +28,7 @@ static int run_remote_archiver(struct ar

 	sprintf(buf, "git-upload-archive");

-	url = strdup(ar->remote);
+	url = xstrdup(ar->remote);
 	pid = git_connect(fd, url, buf);
 	if (pid < 0)
 		return pid;
@@ -101,6 +101,7 @@ void parse_treeish_arg(const char **argv
 		commit_sha1 = commit->object.sha1;
 		archive_time = commit->date;
 	} else {
+		commit_sha1 = NULL;
 		archive_time = time(NULL);
 	}

@@ -141,7 +142,7 @@ int parse_archive_args(int argc, const c
 {
 	const char *extra_argv[MAX_EXTRA_ARGS];
 	int extra_argc = 0;
-	const char *format = NULL; /* some default values */
+	const char *format = NULL;
 	const char *remote = NULL;
 	const char *base = "";
 	int list = 0;
@@ -171,6 +172,8 @@ int parse_archive_args(int argc, const c
 			break;
 		}
 		if (arg[0] == '-') {
+			if (extra_argc > MAX_EXTRA_ARGS - 1)
+				die("Too many extra options");
 			extra_argv[extra_argc++] = arg;
 			continue;
 		}
@@ -185,7 +188,7 @@ int parse_archive_args(int argc, const c
 		die("--list and --remote are mutually exclusive");
 	}
 	if (argc - i < 1) {
-		die("%s", archive_usage);
+		usage(archive_usage);
 	}
 	if (!format){
 		die("You must specify an archive format");
Previous: Rene ScharfeNext: Junio C Hamano
Message 25 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.