Re: [PATCH 2/2] git-tar-tree: Move code for git-archive --format=tar to archive-tar.c
- From
Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
- Date
- Sep 24, 2006, 22:19 UTC
- Message-ID
- <4517048F.9040007@lsrfire.ath.cx>
- In-Reply-To
- <7vr6y16iyk.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano schrieb:
Show 11 quoted lines
> Rene Scharfe <rene.scharfe@lsrfire.ath.cx> writes: > >> This patch doesn't change any functionality, it only moves code around. It >> makes seeing the few remaining lines of git-tar-tree code easier. ;-) >> >> Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> > > Thanks. And here is an obvious follow-up to it. > > -- >8 -- > [PATCH] Remove upload-tar and make git-tar-tree a thin wrapper to git-archive
OK.
Show 8 quoted lines
> diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c > index aa370e3..5d2bec0 100644 > --- a/builtin-tar-tree.c > +++ b/builtin-tar-tree.c > @@ -8,94 +8,66 @@ #include "tar.h" > #include "builtin.h" > #include "pkt-line.h" > #include "archive.h"
At least the last two header references aren't needed any more.
Show 6 quoted lines
> - if (argc == 3) {
> - int baselen = strlen(argv[2]);
> - base = xmalloc(baselen + 2);
> - memcpy(base, argv[2], baselen);
> - base[baselen] = '/';
> - base[baselen + 1] = '\0';[...]
Show 5 quoted lines
> + case 3: > + /* base-path */ > + basedir_arg = xmalloc(strlen(argv[2]) + 10); > + sprintf(basedir_arg, "--prefix=%s", argv[2]); > + nargv[nargc++] = basedir_arg;
Traditionally we always added a slash to the git-tar-tree base parameter, forcing it to always be a base _directory_. git-archive in contrast to that simply adds the prefix to the paths; users have to provide their own slash. This is consistent with how we handle --prefix parameters elsewhere. It also means that the sprintf format string here should be "--prefix=%s/" (and allocate one more byte the line before).
Show 8 quoted lines
> + fprintf(stderr,
> + "*** git-tar-tree is now deprecated.\n"
> + "*** Running git-archive instead.\n***");
> + for (i = 0; i < nargc; i++) {
> + fputc(' ', stderr);
> + sq_quote_print(stderr, nargv[i]);
> + }
> + fputc('\n', stderr);Hey, scary message. ;-) It certainly will aid the re-education of our users, so I think it's OK.
Thanks, René