git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: 1.5.0.rc1.g4494: Can't use a bare GIT_DIR to add

From
Horst H. von Brand <vonbrand@inf.utfsm.cl>
Date
Jan 12, 2007, 20:15 UTC
Message-ID
<200701122015.l0CKFB8j022355@laptop13.inf.utfsm.cl>
In-Reply-To
<junkio@cox.net>
Junio C Hamano <junkio@cox.net> wrote:
Show 14 quoted lines
> "Horst H. von Brand" <vonbrand@inf.utfsm.cl> writes:
> 
> > I tried this:
> >   
> >   mkdir xyz
> >   cd xyz
> >   git --git-dir=../xyz.git   
> >      # Initialized empty Git repository in ../xyz.git/
> >   echo Junk > file-a
> >   git --git-dir=../xyz.git add .
> >      # fatal: add cannot be used in a bare git directory
> >
> > I expected that "GIT_DIR is bare, over there, stuff is here" works the same
> > as "GIT_DIR is .git, right here among stuff".
> Sheesh, why didn't you speak out earlier while the discussion
> was on (I am not serious, git mailing list is still moving too
> fast for people to be always on top of)?
Because I just noticed :-(
> Now, seriously.
[...]
> You said "I tried".  Is this something you do in real life?

There was a discussion going on about importing several tarballs (one version after the other) into git. If you want to just export the result, not futz around in it, it leads naturally to doing something like:

  mkdir /base/test.git
  cd /base/test.git; git --bare init
  for v in 0.8.0.99 0.99a 0.99b 1.0 1.1 1.2.0 1.2.1 1.2.2; do
    cd /work
    tar zxf test-$v.tar.gz
    cd test-$v
    git --git-dir=/base/test.git add .
    git --git-dir=/base/test.git commit -a "Version $v"
    git --git-dir=/base/test.git tag v$v
    cd /work
    rm -rf test-$v
  done
Show 5 quoted lines
> This _is_ a regression, as we are checking something we did not
> check before and refusing to work in cases where we did.  But I
> am not sure if reverting to lift the safety (for that matter,
> introducing the third "depends" alternative) is better than the
> latest behaviour.

It grates me somewhat that there isn't a clean way of saying "My .git stuff is over there". No big deal, really.

And it is not a "depends", AFAICS: GIT_DIR says where to stash stuff, users had better know what they are doing in that case... so perhaps allow anything if GIT_DIR is set?

Show 11 quoted lines
> For one thing, you could (sometime before the "git add ." and do
> this only once) do:
> 
> 	$ ln -s ../xyz.git .git
> 
> and that would make all the future git operation work without
> the --git-dir parameter (or GIT_DIR environment) in xyz
> directory.  An added benefit is that it would even allow git
> command to work from a subdirectory of xyz (specifying GIT_DIR
> or --git-dir means you are bypassing the discovery for the top
> of the working tree, so you have to always be at the top).
For this particular case this is no real help.
But no big deal to me. Still trying to wrap my brain aound git, that's all.
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239
Casilla 110-V, Valparaiso, Chile               Fax:  +56 32 2797513
Previous: Horst H. von BrandNext: Junio C Hamano
Message 95 of 96 in “Re: Status of git.git repository”
  1. Horst von BrandAug 1, 2005
  2. Horst von BrandAug 8, 2005
  3. Horst von BrandAug 10, 2005
  4. Johannes SchindelinAug 10, 2005
  5. Horst von BrandAug 16, 2005
  6. Johannes SchindelinAug 16, 2005
  7. Matthias UrlichsAug 18, 2005
  8. Horst von BrandSep 2, 2005
  9. Tim OttingerSep 6, 2005
  10. Horst von BrandSep 4, 2005
  11. Junio C HamanoSep 5, 2005
  12. Peter WilliamsSep 5, 2005
  13. Junio C HamanoSep 5, 2005
  14. Peter WilliamsSep 5, 2005
  15. Horst von BrandSep 5, 2005
  16. Junio C HamanoSep 5, 2005
  17. Linus TorvaldsSep 5, 2005
  18. David KågedalSep 5, 2005
  19. Linus TorvaldsSep 5, 2005
  20. David KågedalSep 5, 2005
  21. Junio C HamanoSep 5, 2005
  22. Junio C HamanoSep 5, 2005
  23. Martin LanghoffSep 6, 2005
  24. Linus TorvaldsSep 6, 2005
  25. Junio C HamanoSep 6, 2005
  26. Linus TorvaldsSep 6, 2005
  27. Junio C HamanoSep 6, 2005
  28. David KågedalSep 6, 2005
  29. Junio C HamanoSep 6, 2005
  30. Tool renames.Junio C Hamano, Sep 8, 2005
  31. H. Peter AnvinSep 15, 2005
  32. Junio C HamanoSep 15, 2005
  33. Junio C HamanoSep 15, 2005
  34. H. Peter AnvinSep 16, 2005
  35. Junio C HamanoSep 16, 2005
  36. Martin LanghoffSep 6, 2005
  37. Horst von BrandSep 13, 2005
  38. Linus TorvaldsSep 13, 2005
  39. Junio C HamanoSep 13, 2005
  40. Linus TorvaldsSep 13, 2005
  41. Horst von BrandSep 13, 2005
  42. Junio C HamanoSep 13, 2005
  43. Horst von BrandSep 17, 2005
  44. Horst von BrandSep 20, 2005
  45. Horst von BrandOct 3, 2005
  46. Horst von BrandOct 4, 2005
  47. Horst von BrandOct 27, 2005
  48. Archaeology [Was: Re: GIT 0.99.9]Horst von Brand, Oct 31, 2005
  49. Horst von BrandNov 1, 2005
  50. Junio C HamanoNov 2, 2005
  51. Horst von BrandNov 6, 2005
  52. Kay SieversNov 6, 2005
  53. Junio C HamanoNov 6, 2005
  54. Petr BaudisNov 6, 2005
  55. Junio C HamanoNov 6, 2005
  56. Petr BaudisNov 6, 2005
  57. Horst von BrandDec 4, 2005
  58. H. Peter AnvinDec 4, 2005
  59. Horst von BrandDec 22, 2005
  60. Horst von BrandJan 28, 2006
  61. Junio C HamanoJan 28, 2006
  62. Horst von BrandJun 4, 2006
  63. Horst von BrandJun 6, 2006
  64. Junio C HamanoJun 6, 2006
  65. Horst von BrandJun 6, 2006
  66. Junio C HamanoJun 6, 2006
  67. Horst von BrandJun 6, 2006
  68. Junio C HamanoJun 6, 2006
  69. Horst von BrandJun 6, 2006
  70. Horst H. von BrandOct 10, 2006
  71. Junio's wishes [Was: Re: Approxidate licensing]Horst H. von Brand, Oct 10, 2006
  72. Linus TorvaldsOct 10, 2006
  73. Horst H. von BrandOct 13, 2006
  74. Nicolas PitreOct 13, 2006
  75. Horst H. von BrandOct 15, 2006
  76. Horst H. von BrandOct 20, 2006
  77. Horst H. von BrandOct 26, 2006
  78. Junio C HamanoOct 26, 2006
  79. Horst H. von BrandOct 29, 2006
  80. Horst H. von BrandNov 6, 2006
  81. Junio C HamanoNov 6, 2006
  82. Horst H. von BrandNov 15, 2006
  83. Horst H. von BrandNov 20, 2006
  84. Junio C HamanoNov 20, 2006
  85. Horst H. von BrandNov 26, 2006
  86. Horst H. von BrandDec 14, 2006
  87. Jakub NarebskiDec 15, 2006
  88. Horst H. von BrandDec 27, 2006
  89. Junio C HamanoDec 28, 2006
  90. Jakub NarebskiDec 28, 2006
  91. Horst H. von BrandDec 28, 2006
  92. Shawn PearceDec 28, 2006
  93. Horst H. von BrandDec 29, 2006
  94. Horst H. von BrandJan 8, 2007
  95. Horst H. von BrandJan 12, 2007
  96. Junio C HamanoJan 12, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.