Thread (8 messages) flat view 8 messages, 2 authors, 2016-06-15

Re: [PATCH v2 2/4] use strbuf_getcwd() to get the current working directory without fixed-sized buffers

From: Jeff King <hidden>
Date: 2016-06-15 23:02:00

On Mon, Jul 21, 2014 at 07:10:13PM +0200, René Scharfe wrote:
Probably.  And I was so glad to have found an example case for getcwd
without dying and without touching the get-there-and-back cases. :) Guess
I'll have to look closer at setup.c and perhaps unix-socket.c for a
replacement.
I think just:

  const char *x = xgetcwd();
  setenv(GIT_DIR_ENVIRONMENT, x, 0);
  free(x);

would be enough?
By the way: Simply setting $GIT_DIR to "." probably won't work in the two
cases, I guess?
It might, but I'd be a little wary. For example, for the call in
init_db, would we later then chdir to the working tree in order to do a
checkout (since init_db is part of a clone)? Even if it works now, it
seems like a bit of an accident waiting to happen.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help