git-tar-tree: Move code for git-archive --format=tar to archive-tar.c
Subsystems (2)
PATCH 2/2 git-tar-tree: Move code for git-archive --format=tar to archive-tar.c
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. ;-)
---
Makefile | 2 archive-tar.c | 325 ++++++++++++++++++++++++++++++++++++++++++++++++++++ builtin-tar-tree.c | 313 -------------------------------------------------- 3 files changed, 326 insertions(+), 314 deletions(-)
Makefile +1 -1
@@ -254,7 +254,7 @@ LIB_OBJS = \ fetch-clone.o revision.o pager.o tree-walk.o xdiff-interface.o \ write_or_die.o trace.o list-objects.o \ alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \ - color.o wt-status.o archive-zip.o + color.o wt-status.o archive-zip.o archive-tar.o BUILTIN_OBJS = \ builtin-add.o \
archive-tar.c new file +325 -0
325 lines not on this page · raw message
builtin-tar-tree.c +0 -313
331 lines not on this page · raw message
Quoted 4 lines · Rene Scharfe
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 <[email protected]>
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
---
.gitignore +0 -1
@@ -122,7 +122,6 @@ git-update-ref git-update-server-info git-upload-archive git-upload-pack -git-upload-tar git-var git-verify-pack git-verify-tag
Documentation/git-tar-tree.txt +3 -0
@@ -12,6 +12,9 @@ SYNOPSIS DESCRIPTION ----------- +THIS COMMAND IS DEPRECATED. Use `git-archive` with `--format=tar` +option instead. + Creates a tar archive containing the tree structure for the named tree. When <base> is specified it is added as a leading path to the files in the generated tar archive.
Documentation/git-upload-tar.txt deleted +0 -39
@@ -1,39 +0,0 @@ -git-upload-tar(1) -================= - -NAME ----- -git-upload-tar - Send tar archive - - -SYNOPSIS --------- -'git-upload-tar' <directory> - -DESCRIPTION ------------ -Invoked by 'git-tar-tree --remote' and sends a generated tar archive -to the other end over the git protocol. - -This command is usually not invoked directly by the end user. -The UI for the protocol is on the 'git-tar-tree' side, and the -program pair is meant to be used to get a tar archive from a -remote repository. - - -OPTIONS -------- -<directory>:: - The repository to get a tar archive from. - -Author ------- -Written by Junio C Hamano <[email protected]> - -Documentation --------------- -Documentation by Junio C Hamano. - -GIT ---- -Part of the gitlink:git[7] suite
Documentation/git.txt +0 -4
@@ -247,10 +247,6 @@ gitlink:git-upload-pack[1]:: Invoked by 'git-fetch-pack' to push what are asked for. -gitlink:git-upload-tar[1]:: - Invoked by 'git-tar-tree --remote' to return the tar - archive the other end asked for. - High-level commands (porcelain) -------------------------------
Makefile +0 -1
@@ -298,7 +298,6 @@ BUILTIN_OBJS = \ builtin-update-index.o \ builtin-update-ref.o \ builtin-upload-archive.o \ - builtin-upload-tar.o \ builtin-verify-pack.o \ builtin-write-tree.o
builtin-tar-tree.c +50 -78
144 lines not on this page · raw message
builtin-upload-tar.c deleted +0 -74
74 lines not on this page · raw message
git.c +0 -1
@@ -263,7 +263,6 @@ static void handle_internal_command(int { "update-index", cmd_update_index, RUN_SETUP }, { "update-ref", cmd_update_ref, RUN_SETUP }, { "upload-archive", cmd_upload_archive }, - { "upload-tar", cmd_upload_tar }, { "version", cmd_version }, { "whatchanged", cmd_whatchanged, RUN_SETUP | USE_PAGER }, { "write-tree", cmd_write_tree, RUN_SETUP },
Quoted 11 lines · Junio C Hamano
Quoted 4 lines · Rene Scharfe
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 <[email protected]>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.
builtin-tar-tree.c #include "tar.h" · line 10
Quoted 8 lines
builtin-tar-tree.c +0
-0@@ -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.
Quoted 6 lines
builtin-tar-tree.c +0
-6-if (argc ==3 ) { -int baselen =strlen (argv[2 ]); - base =xmalloc (baselen +2 ); -memcpy (base, argv[2 ], baselen); - base[baselen] ='/' ; - base[baselen +1 ] ='\0' ;
[...]
builtin-tar-tree.c #include "tar.h" · line 50
Quoted 5 lines
builtin-tar-tree.c +5
-0+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).
builtin-tar-tree.c #include "tar.h" · line 65
Quoted 8 lines
builtin-tar-tree.c +8
-0+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é