threads / discuss / 11472

libgit: git_setup_directory() is not reentrant

Subject: libgit: git_setup_directory() is not reentrant

## tl;dr

2 messages between Jan 4, 2008 and Jan 4, 2008.

replies: 1people: 2as markdown or json

Christian Thaeter· Jan 4, 2008, 17:07 UTC · lore

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· Jan 4, 2008, 20:40 UTC · re: Christian Thaeter · lore

Re: libgit: git_setup_directory() is not reentrant

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.

← back to recent threads