git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [MinGW PATCH] 'git clone git://...' was failing inside git-read-tree with 'fatal: Not a valid object name HEAD'
@ 2007-08-04 11:38 Dmitry Kakurin
  2007-08-04 14:16 ` Johannes Schindelin
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Kakurin @ 2007-08-04 11:38 UTC (permalink / raw)
  To: git; +Cc: johannes.sixt, Johannes Schindelin

NOTE: This fix uses is_absolute_path from msysGit-0.3.exe that is not in mingw.git yet.

Correctly test for absolute path

This fix (while correct) actually avoids another nasty bug that must be fixed later:
environment.c caches results of many getenv calls.
Under MinGW setenv(X) invalidates all previous values returned by getenv(X) 
so cached values become dangling pointers.

Signed-off-by: Dmitry Kakurin <Dmitry.Kakurin@gmail.com>
---
 setup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/setup.c b/setup.c
index e921013..47cd790 100644
--- a/setup.c
+++ b/setup.c
@@ -332,7 +332,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
   * In case there is a work tree we may change the directory,
   * therefore make GIT_DIR an absolute path.
   */
- if (gitdirenv[0] != '/') {
+ if ( !is_absolute_path( gitdirenv ) ) {
   setenv(GIT_DIR_ENVIRONMENT, gitdir, 1);
   gitdirenv = getenv(GIT_DIR_ENVIRONMENT);
   if (!gitdirenv)
-- 
mingw.v1.5.2.4.884.gad85-dirty

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [MinGW PATCH] 'git clone git://...' was failing inside git-read-tree with 'fatal: Not a valid object name HEAD'
  2007-08-04 11:38 [MinGW PATCH] 'git clone git://...' was failing inside git-read-tree with 'fatal: Not a valid object name HEAD' Dmitry Kakurin
@ 2007-08-04 14:16 ` Johannes Schindelin
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Schindelin @ 2007-08-04 14:16 UTC (permalink / raw)
  To: Dmitry Kakurin; +Cc: git, johannes.sixt

Hi,

On Sat, 4 Aug 2007, Dmitry Kakurin wrote:

> NOTE: This fix uses is_absolute_path from msysGit-0.3.exe that is not in
> mingw.git yet.

Ooops.  I think I did not even check that into msysgit.git.  Thanks.

> - if (gitdirenv[0] != '/') {
> + if ( !is_absolute_path( gitdirenv ) ) {

Our coding style does not want them extra spaces...

+ if (!is_absolute_path(gitdirenv)) {

is the way we prefer it.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-04 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-04 11:38 [MinGW PATCH] 'git clone git://...' was failing inside git-read-tree with 'fatal: Not a valid object name HEAD' Dmitry Kakurin
2007-08-04 14:16 ` Johannes Schindelin

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).