All of lore.kernel.org
 help / color / mirror / Atom feed
From: newren@gmail.com
To: git@vger.kernel.org
Cc: gitster@pobox.com, Elijah Newren <newren@gmail.com>
Subject: [PATCH] Ensure proper setup of git_dir for git-hash-object
Date: Sat, 28 Feb 2009 12:56:49 -0700	[thread overview]
Message-ID: <1235851009-16739-1-git-send-email-newren@gmail.com> (raw)

From: Elijah Newren <newren@gmail.com>

Call setup_git_directory() before git_config() to make sure git_dir is set
to the proper value.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
Without this patch:
$ mkdir tmp
$ cd tmp/
$ git init --bare
Initialized empty Git repository in /home/newren/floss-development/git/tmp/
$ echo hi | git hash-object -w --stdin
error: unable to create temporary sha1 filename .git/objects/45: No such file or directory

fatal: Unable to add stdin to database
$ echo hi | git --git-dir=. hash-object -w --stdin
45b983be36b73c0788dc9cbcb76cbb80fc7bb057

 hash-object.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hash-object.c b/hash-object.c
index 37e6677..ebb3bed 100644
--- a/hash-object.c
+++ b/hash-object.c
@@ -84,8 +84,6 @@ int main(int argc, const char **argv)
 
 	git_extract_argv0_path(argv[0]);
 
-	git_config(git_default_config, NULL);
-
 	argc = parse_options(argc, argv, hash_object_options, hash_object_usage, 0);
 
 	if (write_object) {
@@ -95,6 +93,8 @@ int main(int argc, const char **argv)
 			vpath = prefix_filename(prefix, prefix_length, vpath);
 	}
 
+	git_config(git_default_config, NULL);
+
 	if (stdin_paths) {
 		if (hashstdin)
 			errstr = "Can't use --stdin-paths with --stdin";
-- 
1.6.0.6

             reply	other threads:[~2009-02-28 19:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-28 19:56 newren [this message]
2009-02-28 20:59 ` [PATCH] Ensure proper setup of git_dir for git-hash-object Junio C Hamano
2009-02-28 21:20   ` Elijah Newren
2009-02-28 21:39   ` Elijah Newren

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=1235851009-16739-1-git-send-email-newren@gmail.com \
    --to=newren@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.