diff options
author | Jeff King <peff@peff.net> | 2013-03-10 21:32:32 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-03-10 22:25:22 -0700 |
commit | bd54cf17a4acfb9555b8a83b7e74fb0274c38bb4 (patch) | |
tree | d6e40cd0431e51757c4615d7ab3ef811f2058684 /t/t5004 | |
parent | test-lib: factor out $GIT_UNZIP setup (diff) | |
download | tgif-bd54cf17a4acfb9555b8a83b7e74fb0274c38bb4.tar.xz |
archive: handle commits with an empty tree
git-archive relies on get_pathspec to convert its argv into
a list of pathspecs. When get_pathspec is given an empty
argv list, it returns a single pathspec, the empty string,
to indicate that everything matches. When we feed this to
our path_exists function, we typically see that the pathspec
turns up at least one item in the tree, and we are happy.
But when our tree is empty, we erroneously think it is
because the pathspec is too limited, when in fact it is
simply that there is nothing to be found in the tree. This
is a weird corner case, but the correct behavior is almost
certainly to produce an empty archive, not to exit with an
error.
This patch teaches git-archive to create empty archives when
there is no pathspec given (we continue to complain if a
pathspec is given, since it obviously is not matched). It
also confirms that the tar and zip writers produce sane
output in this instance.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5004')
-rw-r--r-- | t/t5004/empty.zip | bin | 0 -> 62 bytes |
1 files changed, 0 insertions, 0 deletions
diff --git a/t/t5004/empty.zip b/t/t5004/empty.zip Binary files differnew file mode 100644 index 0000000000..1a76bb6005 --- /dev/null +++ b/t/t5004/empty.zip |