git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Cc: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Subject: [PATCH 0/2] fix git-archive with empty trees
Date: Sun, 10 Mar 2013 21:31:24 -0400	[thread overview]
Message-ID: <20130311013123.GA11692@sigill.intra.peff.net> (raw)

I noticed that "git archive" will barf when the root tree is empty.
Instead, it should probably return an empty archive. I doubt many people
really care about this corner case in practice, but it seems like we
should handle it more gracefully (and it's an easy fix).

It came to my attention because we track failed git-archive invocations
at GitHub, and a particular repo had a two commits: adding some content,
then reverting the original commit. You can also get there with "commit
--allow-empty" on a new branch (which is what the tests do).

I didn't bother even looking at empty subtrees. AFAIK, git should never
produce them (it omits the tree entirely if there is no content in it).
You would have to fake it using hash-object manually. I suspect it would
work just fine, as we already exercise the empty-dir code paths in the
tests I did add.

  [1/2]: test-lib: factor out $GIT_UNZIP setup
  [2/2]: archive: handle commits with an empty tree

-Peff

             reply	other threads:[~2013-03-11  1:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11  1:31 Jeff King [this message]
2013-03-11  1:31 ` [PATCH 1/2] test-lib: factor out $GIT_UNZIP setup Jeff King
2013-03-11  1:32 ` [PATCH 2/2] archive: handle commits with an empty tree Jeff King
2013-03-11  4:58 ` [PATCH 0/2] fix git-archive with empty trees Jeff King
2013-03-11  5:25   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130311013123.GA11692@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=rene.scharfe@lsrfire.ath.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).