Issue #8: Can reinit a repository, but some dangling resources.

2 views
Skip to first unread message

Eoin Coffey

unread,
Jan 24, 2010, 5:38:43 PM1/24/10
to gits...@googlegroups.com
So I pushed a fix for this to my master on github, but now playing
with the current cli I'm getting this debug message after running
git.exe init:

ObjectDirectory has not been properly disposed
{/home/ecoffey/code/blah/.git/objects}
ObjectDirectory has not been properly disposed.


I was digging around in GitSharp.Core.Repository and it looks like
it's _objectDirectory is getting Dispose called on it. Any ideas on
how I messed this up? :-)

Emeric Fermas

unread,
Jan 25, 2010, 1:48:04 AM1/25/10
to gits...@googlegroups.com
>'m getting this debug message after running git.exe init
Are you able to reproduce this each time ? On both Mono and Windows ?

>Any ideas on how I messed this up?  :-)
Dunno :-) Will take a look tonight provided I'm able to successfully make it fail on my box.

Em.



--
For infos about GitSharp visit http://www.eqqon.com/index.php/GitSharp
To join this group visit http://groups.google.com/group/gitsharp

Eoin Coffey

unread,
Jan 25, 2010, 1:59:58 AM1/25/10
to gits...@googlegroups.com
On Sun, Jan 24, 2010 at 11:48 PM, Emeric Fermas <emeric...@gmail.com> wrote:
>>'m getting this debug message after running git.exe init
> Are you able to reproduce this each time ? On both Mono and Windows ?

Only attempted on linux.

>>Any ideas on how I messed this up?  :-)
> Dunno :-) Will take a look tonight provided I'm able to successfully make it
> fail on my box.

The steps I used were:

mkdir /some/temp/location/test
cd /some/temp/location/test
/path/to/gitsharp/git.exe init

/path/to/gitsharp/git.exe init

Thanks man :-)

-Eoin

Emeric Fermas

unread,
Jan 25, 2010, 3:07:52 PM1/25/10
to gits...@googlegroups.com
@eoin,

I've reproduced the issue against commit c8eae4dd96cf327461860d168ce93de4ce7ab47b.

This has nothing to do with your contribution. The bug was previously existing

I may have spotted the origin of the problem. It may lie in InitCommand.Execute().

As you've already identified it, the "repo" variable is being disposed through usage of the using(){} keyword.
However, a new instance of a Repository is being stored in a base AbstractCommand.Repository property holder. I do not think it is disposed.



Em.

Emeric Fermas

unread,
Jan 25, 2010, 3:23:17 PM1/25/10
to gits...@googlegroups.com
@eoin,

>However, a new instance of a Repository is being stored in a base AbstractCommand.Repository property holder. I do not think it is disposed.
Sorry, I was a bit unclear. A Repository has to be disposed. The instance being stored in the AbstractCommand.Repository property is not disposed. This triggers the Console.Error call in the destructors.

Em.

Eoin Coffey

unread,
Jan 25, 2010, 4:00:36 PM1/25/10
to gits...@googlegroups.com
On Mon, Jan 25, 2010 at 1:23 PM, Emeric Fermas <emeric...@gmail.com> wrote:
> @eoin,
>>However, a new instance of a Repository is being stored in a base
>> AbstractCommand.Repository property holder. I do not think it is disposed.
> Sorry, I was a bit unclear. A Repository has to be disposed. The instance
> being stored in the AbstractCommand.Repository property is not disposed.
> This triggers the Console.Error call in the destructors.
>
> Em.
>
>
> On Mon, Jan 25, 2010 at 9:07 PM, Emeric Fermas <emeric...@gmail.com>
> wrote:
>>
>> @eoin,
>> I've reproduced the issue against commit
>> c8eae4dd96cf327461860d168ce93de4ce7ab47b.
>> This has nothing to do with your contribution. The bug was previously
>> existing
>> I may have spotted the origin of the problem. It may lie in
>> InitCommand.Execute().
>> As you've already identified it, the "repo" variable is being disposed
>> through usage of the using(){} keyword.
>> However, a new instance of a Repository is being stored in a base
>> AbstractCommand.Repository property holder. I do not think it is disposed.
>>

Ahh ok, thanks for the help there.

When I glanced at that code it looked we never instantiated a
Repository into that AC property but just used it to hold a reference
to a repo from the command internals.

I'll investigate that tonight.

Also it seems kind of odd that GitSharp is relying on a layer "above"
it for that functionality (i.e. calling GitSharp.Repository.Init
builds an InitCommand object and uses that).

-Eoin

Reply all
Reply to author
Forward
0 new messages