git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 2/2] Revert "rehabilitate 'git index-pack' inside the object store"
Date: Fri, 23 Jul 2010 19:04:11 +0700	[thread overview]
Message-ID: <1279886651-14590-2-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1279886651-14590-1-git-send-email-pclouds@gmail.com>

This reverts code change in commit a672ea6ac5a1b876bc7adfe6534b16fa2a32c94b.

The cwd behavior now fits index-pack well, i.e. NULL prefix means
no cwd changes.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/index-pack.c |   24 +++++-------------------
 1 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index a89ae83..89a1f12 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -880,29 +880,15 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
 	char *index_name_buf = NULL, *keep_name_buf = NULL;
 	struct pack_idx_entry **idx_objects;
 	unsigned char pack_sha1[20];
+	int nongit;
 
 	if (argc == 2 && !strcmp(argv[1], "-h"))
 		usage(index_pack_usage);
 
-	/*
-	 * We wish to read the repository's config file if any, and
-	 * for that it is necessary to call setup_git_directory_gently().
-	 * However if the cwd was inside .git/objects/pack/ then we need
-	 * to go back there or all the pack name arguments will be wrong.
-	 * And in that case we cannot rely on any prefix returned by
-	 * setup_git_directory_gently() either.
-	 */
-	{
-		char cwd[PATH_MAX+1];
-		int nongit;
-
-		if (!getcwd(cwd, sizeof(cwd)-1))
-			die("Unable to get current working directory");
-		setup_git_directory_gently(&nongit);
-		git_config(git_index_pack_config, NULL);
-		if (chdir(cwd))
-			die("Cannot come back to cwd");
-	}
+	prefix = setup_git_directory_gently(&nongit);
+	git_config(git_index_pack_config, NULL);
+	if (prefix && chdir(prefix))
+		die("Cannot come back to cwd");
 
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
-- 
1.7.1.rc1.69.g24c2f7

  reply	other threads:[~2010-07-23 12:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 12:04 [PATCH 1/2] worktree setup: return to original cwd if prefix is set NULL Nguyễn Thái Ngọc Duy
2010-07-23 12:04 ` Nguyễn Thái Ngọc Duy [this message]
2010-07-23 14:38 ` Ævar Arnfjörð Bjarmason
2010-07-24  0:50   ` Nguyen Thai Ngoc Duy
2010-07-24  1:16     ` Ævar Arnfjörð Bjarmason
2010-07-23 19:47       ` Nguyễn Thái Ngọc Duy
2010-07-24 11:15 ` [PATCH 0/9] setup_git_directory(): return to original cwd upon reaching .git Jonathan Nieder
2010-07-24 11:16   ` [PATCH 1/9] t1501 (rev-parse): clarify Jonathan Nieder
2010-07-24 11:18   ` [PATCH 2/9] tests: try git apply from subdir of toplevel Jonathan Nieder
2010-07-24 11:19   ` [PATCH 3/9] setup: split off $GIT_DIR-set case from setup_git_directory_gently Jonathan Nieder
2010-07-24 12:15     ` Nguyen Thai Ngoc Duy
2010-07-24 11:20   ` [PATCH 4/9] setup: split off a function to checks working dir for .git file Jonathan Nieder
2010-07-24 11:56     ` Nguyen Thai Ngoc Duy
2010-07-24 12:11       ` Jonathan Nieder
2010-07-24 11:25   ` [PATCH 5/9] setup: split off code to handle stumbling upon a repository Jonathan Nieder
2010-07-24 11:26   ` [PATCH 6/9] setup: split off a function to handle hitting ceiling in repo search Jonathan Nieder
2010-07-24 11:27   ` [PATCH 7/9] setup: split off get_device_or_die helper Jonathan Nieder
2010-07-24 11:29   ` [PATCH 8/9] setup: do not forget working dir from subdir of gitdir Jonathan Nieder
2010-07-24 11:30   ` [PATCH 9/9] Revert "rehabilitate 'git index-pack' inside the object store" Jonathan Nieder
2010-07-24 11:45   ` [PATCH 0/9] setup_git_directory(): return to original cwd upon reaching .git Nguyen Thai Ngoc Duy

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=1279886651-14590-2-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).