Re: [PATCH] Ensure proper setup of git_dir for git-hash-object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 28, 2009 at 1:59 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> newren@xxxxxxxxx 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?

Yes, the patched version works with or without the -w option (at least
in my testing -- maybe you know of a case I'm missing?)  I would
certainly expect it to work in both cases.

I basically arrived at the patch by realizing that git_config was
setting git_dir incorrectly as a side-effect, causing
setup_git_directory to notice it was already set and not try any of
it's more detailed logic to figure out the correct value.  Then I did
some grepping and noticed that other source files (archive.c,
builtin-apply.c, builtin-diff, etc., etc.) call
setup_git_directory[_gently] before git_config, and that hash-object.c
seemed to be the only one that didn't follow that trend.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux