git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Junio C Hamano <junkio@cox.net>
Cc: Jeff Garzik <jeff@garzik.org>,
	Git Mailing List <git@vger.kernel.org>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH] Revert "builtin-archive: use RUN_SETUP"
Date: Thu, 05 Apr 2007 22:55:43 +0200	[thread overview]
Message-ID: <4615624F.50504@lsrfire.ath.cx> (raw)
In-Reply-To: <4614DD0C.50600@garzik.org>

Commit 64edf4b2 cleaned up the initialization of git-archive,
at the cost of 'git-archive --list' now requiring a git repo.
This patch reverts the cleanup and documents the requirement
for this particular dirtyness in a test.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---

Jeff Garzik schrieb:
> "git-archive --list" requires a git repository.  Certainly listing the
> archive formats doesn't /really/ require such things.

 builtin-archive.c   |    2 ++
 git.c               |    2 +-
 t/t5000-tar-tree.sh |    4 ++++
 3 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/builtin-archive.c b/builtin-archive.c
index 2fae885..8ea6cb1 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -252,6 +252,8 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
 
 	memset(&ar, 0, sizeof(ar));
 	tree_idx = parse_archive_args(argc, argv, &ar);
+	if (prefix == NULL)
+		prefix = setup_git_directory();
 
 	argv += tree_idx;
 	parse_treeish_arg(argv, &ar.args, prefix);
diff --git a/git.c b/git.c
index 5b1bc2a..33dd4d3 100644
--- a/git.c
+++ b/git.c
@@ -226,7 +226,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
 		{ "add", cmd_add, RUN_SETUP | NOT_BARE },
 		{ "annotate", cmd_annotate, USE_PAGER },
 		{ "apply", cmd_apply },
-		{ "archive", cmd_archive, RUN_SETUP },
+		{ "archive", cmd_archive },
 		{ "blame", cmd_blame, RUN_SETUP },
 		{ "branch", cmd_branch, RUN_SETUP },
 		{ "bundle", cmd_bundle },
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index ac835fe..b4359df 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -130,4 +130,8 @@ test_expect_success \
     'validate file contents with prefix' \
     'diff -r a e/prefix/a'
 
+test_expect_success \
+    'git-archive --list outside of a git repo' \
+    'GIT_DIR=some/non-existing/directory git-archive --list'
+
 test_done

  reply	other threads:[~2007-04-05 20:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-05 11:27 Minor git-archive bug Jeff Garzik
2007-04-05 20:55 ` René Scharfe [this message]
2007-04-05 21:37   ` [PATCH] Revert "builtin-archive: use RUN_SETUP" 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=4615624F.50504@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=git@vger.kernel.org \
    --cc=jeff@garzik.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=junkio@cox.net \
    /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).