@@ -246,7 +246,7 @@ int main (int argc, char** argv)
246
246
printf ("\n*Tree Parsing*\n" );
247
247
248
248
git_tree * tree ;
249
- git_tree_entry * entry ;
249
+ const git_tree_entry * entry ;
250
250
git_object * objt ;
251
251
252
252
// Create the oid and lookup the tree object just like the other objects.
@@ -356,7 +356,7 @@ int main (int argc, char** argv)
356
356
// You can either open the index from the standard location in an open repository, as we're doing
357
357
// here, or you can open and manipulate any index file with `git_index_open_bare()`. The index
358
358
// for the repository will be located and loaded from disk.
359
- git_index_open_inrepo (& index , repo );
359
+ git_repository_index (& index , repo );
360
360
361
361
// For each entry in the index, you can get a bunch of information including the SHA (oid), path
362
362
// and mode which map to the tree objects that are written out. It also has filesystem properties
@@ -410,6 +410,29 @@ int main (int argc, char** argv)
410
410
411
411
git_strarray_free (& ref_list );
412
412
413
+ // ### Config Files
414
+ //
415
+ // The [config API][config] allows you to list and updatee config values in
416
+ // any of the accessible config file locations (system, global, local).
417
+ //
418
+ // [config]: http://libgit2.github.com/libgit2/#HEAD/group/config
419
+
420
+ printf ("\n*Config Listing*\n" );
421
+
422
+ const char * email ;
423
+ int j ;
424
+
425
+ git_config * cfg ;
426
+
427
+ // Open a config object so we can read global values from it.
428
+ git_config_open_global (& cfg );
429
+
430
+ git_config_get_int (cfg , "help.autocorrect" , & j );
431
+ printf ("Autocorrect: %d\n" , j );
432
+
433
+ git_config_get_string (cfg , "user.email" , & email );
434
+ printf ("Email: %s\n" , email );
435
+
413
436
// Finally, when you're done with the repository, you can free it as well.
414
437
git_repository_free (repo );
415
438
}
0 commit comments