# libgit: git_setup_directory() is not reentrant

2 messages from 2008-01-04 to 2008-01-04. Participants: Christian Thaeter, Junio C Hamano.
Thread: https://gitlist.dev/t/11472

## Christian Thaeter, 2008-01-04 17:07

Subject: libgit: git_setup_directory() is not reentrant
Message-ID: <477E67C5.5020301@pipapo.org>
URL: https://gitlist.dev/e/477E67C5.5020301%40pipapo.org

```
While working on a git-browser, I noticed that git_setup_directory() is
not reentrant. Once called it initializes (by calling other functions in
turn) several static/hidden variables which can't be altered afterwards.
This is ugly when one wants  to iterate over different repositories
(generating a list of available repos).

How could we fix this?
I would propose that subsequent 'git_setup_directory()' calls will
reinit the setup completely.

Another way would be to provide a 'git_setup_reset()' function which
lets one cleanup all setup things before calling 'git_setup_directory()'
again.

Comments?

	Christian

```

## Junio C Hamano, 2008-01-04 20:40

Subject: Re: libgit: git_setup_directory() is not reentrant
Message-ID: <7vd4shjpdi.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd4shjpdi.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <477E67C5.5020301@pipapo.org>

```
Christian Thaeter <ct@pipapo.org> writes:

> While working on a git-browser, I noticed that git_setup_directory() is
> not reentrant.

Yup, that comes from a longstanding design of git that "a
command runs once and exits".  Do not call that twice, or help
the libification effort.

```
