Skip to content

Commit 77d9c8b

Browse files
committed
moved Git\Index test case to GitIndexTest.php and some memory free fix.
1 parent b7a79e6 commit 77d9c8b

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

src/rawobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ ZEND_END_ARG_INFO()
4242

4343
static void php_git_rawobject_free_storage(php_git_rawobject_t *obj TSRMLS_DC)
4444
{
45+
/*
4546
if(obj->object->data){
4647
efree(obj->object->data);
4748
obj->object->data = NULL;
@@ -51,7 +52,7 @@ static void php_git_rawobject_free_storage(php_git_rawobject_t *obj TSRMLS_DC)
5152
efree(obj->object);
5253
obj->object= NULL;
5354
}
54-
55+
*/
5556
zend_object_std_dtor(&obj->zo TSRMLS_CC);
5657
efree(obj);
5758
}

tests/GitIndexTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ public static function teardownAfterClass()
2626
self::rmdir(__DIR__ . self::REPOSITORY_NAME);
2727
}
2828

29+
public function testGetIndex()
30+
{
31+
$repository = new Repository(__DIR__ . self::REPOSITORY_NAME . "/.git");
32+
$index = $repository->getIndex();
33+
$this->assertInstanceOf("Git\\Index",$index);
34+
}
35+
36+
2937
public function testAddIndex()
3038
{
3139
file_put_contents(__DIR__ . self::REPOSITORY_NAME . "/example","Hello World");
@@ -79,7 +87,7 @@ public function testGetIterator()
7987

8088
$this->assertInstanceOf("Iterator",$it);
8189
}
82-
90+
8391
public static function rmdir($dir)
8492
{
8593
if (is_dir($dir)) {

tests/GitTest.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,6 @@ public function testConstruct()
105105
}
106106
}
107107

108-
public function testGetIndex()
109-
{
110-
111-
$git = new Git\Repository(dirname(__DIR__) . "/.git/");
112-
$index = $git->getIndex();
113-
if($index instanceof Git\Index){
114-
foreach($index->getIterator() as $entry){
115-
$this->assertInstanceof("Git\\Index\\Entry",$entry);
116-
}
117-
return true;
118-
}else{
119-
return false;
120-
}
121-
}
122-
123108
public function testInitRepository()
124109
{
125110
require_once __DIR__ . "/lib/MemoryBackend.php";

0 commit comments

Comments
 (0)