From: Elijah Newren Date: Sat, 28 Feb 2009 21:39:51 GMT Subject: Re: [PATCH] Ensure proper setup of git_dir for git-hash-object Message-ID: <51419b2c0902281339k35f21b72v83310000b60a1416@mail.gmail.com> In-Reply-To: <7v3adyffax.fsf@gitster.siamese.dyndns.org> On Sat, Feb 28, 2009 at 1:59 PM, Junio C Hamano wrote: > newren@gmail.com writes: > >> 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 > > Does the patched version work without -w option?  Should it? Sorry, I think I partially missed what you were asking earlier. When -w is not passed there is no dependence on git_dir, so it does not matter if it is set up or not. Some evidence that this is true (in addition to my basic testing): The call to git_config was added to hash-object.c in revision ff350ccf49a800c4c90f817d346fb1bcb96e02e7; prior to that revision, when -w was not passed, there would be no setup of git_dir by either git_config or git_setup_directory.