All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Sixt <J.Sixt@eudaptics.com>
To: git@vger.kernel.org
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] git-init: set core.worktree if GIT_WORK_TREE is specified
Date: Wed, 04 Jul 2007 12:41:01 +0200	[thread overview]
Message-ID: <468B793D.53661D60@eudaptics.com> (raw)
In-Reply-To: 20070704092915.GA18597@moooo.ath.cx

Matthias Lederhofer wrote:
> 
> > +     if (!getcwd(cwd, sizeof(cwd)) || cwd[0] != '/')
> > +             die("Unable to read current working directory");
> 
> Dscho just pointed out that this causes problems on windows.  The same
> is also in setup_git_directory_gently and was there before I touched
> it, introduced by Linus in d288a700.  What was the original reason to
> do this?  Are there implementations of getcwd which return a relative
> path?
> 
> Additionally there are other places which need to check if some user
> supplied path is absolute.  Should we have a macro/function for that
> which depends on the os and checks for path[0] = '/' on unix and
> perhaps path[1] = ':' on windows?

I've modified some places (that check for an absolute path) in the MinGW
port to read (path[0] == '/' || path[1] == ':'). I don't think that it's
necessary that you cater for this case in your code - I'll take care of
it in the MinGW port. Of course, a hint that there is another place to
watch out for, or even better a test case in t/, is most appreciated.

I still hope to find some time to rework the MinGW port. Then such
details will be hidden behind a is_path_absolute() function. Or maybe
getcwd_or_die() ;)

-- Hannes

  reply	other threads:[~2007-07-04 10:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-03 22:49 [PATCH] git-init: set core.worktree if GIT_WORK_TREE is specified Matthias Lederhofer
2007-07-04  9:29 ` Matthias Lederhofer
2007-07-04 10:41   ` Johannes Sixt [this message]
2007-07-04 11:57     ` Johannes Schindelin
2007-07-04 16:23   ` Linus Torvalds
2007-07-04 17:07     ` Junio C Hamano
2007-07-04 17:31       ` Linus Torvalds

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=468B793D.53661D60@eudaptics.com \
    --to=j.sixt@eudaptics.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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.