├── .gitignore ├── .gitlab-ci.yml ├── AUTHORS ├── COPYING ├── ChangeLog ├── NEWS ├── README ├── docs └── reference │ ├── .gitignore │ ├── libgit2-glib.toml.in │ ├── meson.build │ └── urlmap.js ├── examples ├── clone.c ├── general.c ├── meson.build └── walk.c ├── libgit2-glib.doap ├── libgit2-glib ├── Ggit.py ├── ggit-annotated-commit.c ├── ggit-annotated-commit.h ├── ggit-blame-options.c ├── ggit-blame-options.h ├── ggit-blame.c ├── ggit-blame.h ├── ggit-blob-output-stream.c ├── ggit-blob-output-stream.h ├── ggit-blob.c ├── ggit-blob.h ├── ggit-branch-enumerator.c ├── ggit-branch-enumerator.h ├── ggit-branch.c ├── ggit-branch.h ├── ggit-checkout-options.c ├── ggit-checkout-options.h ├── ggit-cherry-pick-options.c ├── ggit-cherry-pick-options.h ├── ggit-clone-options.c ├── ggit-clone-options.h ├── ggit-commit-parents.c ├── ggit-commit-parents.h ├── ggit-commit.c ├── ggit-commit.h ├── ggit-config-entry.c ├── ggit-config-entry.h ├── ggit-config.c ├── ggit-config.h ├── ggit-convert.c ├── ggit-convert.h ├── ggit-cred-plaintext.c ├── ggit-cred-plaintext.h ├── ggit-cred-ssh-interactive.c ├── ggit-cred-ssh-interactive.h ├── ggit-cred-ssh-key-from-agent.c ├── ggit-cred-ssh-key-from-agent.h ├── ggit-cred.c ├── ggit-cred.h ├── ggit-diff-binary-file.c ├── ggit-diff-binary-file.h ├── ggit-diff-binary.c ├── ggit-diff-binary.h ├── ggit-diff-delta.c ├── ggit-diff-delta.h ├── ggit-diff-file.c ├── ggit-diff-file.h ├── ggit-diff-find-options.c ├── ggit-diff-find-options.h ├── ggit-diff-format-email-options.c ├── ggit-diff-format-email-options.h ├── ggit-diff-hunk.c ├── ggit-diff-hunk.h ├── ggit-diff-line.c ├── ggit-diff-line.h ├── ggit-diff-options.c ├── ggit-diff-options.h ├── ggit-diff-similarity-metric.c ├── ggit-diff-similarity-metric.h ├── ggit-diff.c ├── ggit-diff.h ├── ggit-error.c ├── ggit-error.h ├── ggit-fetch-options.c ├── ggit-fetch-options.h ├── ggit-index-entry-resolve-undo.c ├── ggit-index-entry-resolve-undo.h ├── ggit-index-entry.c ├── ggit-index-entry.h ├── ggit-index.c ├── ggit-index.h ├── ggit-mailmap.c ├── ggit-mailmap.h ├── ggit-main.c ├── ggit-main.h ├── ggit-merge-options.c ├── ggit-merge-options.h ├── ggit-message.c ├── ggit-message.h ├── ggit-native.c ├── ggit-native.h ├── ggit-note.c ├── ggit-note.h ├── ggit-object-factory-base.c ├── ggit-object-factory-base.h ├── ggit-object-factory.c ├── ggit-object-factory.h ├── ggit-object.c ├── ggit-object.h ├── ggit-oid.c ├── ggit-oid.h ├── ggit-patch.c ├── ggit-patch.h ├── ggit-proxy-options.c ├── ggit-proxy-options.h ├── ggit-push-options.c ├── ggit-push-options.h ├── ggit-rebase-operation.c ├── ggit-rebase-operation.h ├── ggit-rebase-options.c ├── ggit-rebase-options.h ├── ggit-rebase.c ├── ggit-rebase.h ├── ggit-ref-spec.c ├── ggit-ref-spec.h ├── ggit-ref.c ├── ggit-ref.h ├── ggit-reflog-entry.c ├── ggit-reflog-entry.h ├── ggit-reflog.c ├── ggit-reflog.h ├── ggit-remote-callbacks.c ├── ggit-remote-callbacks.h ├── ggit-remote.c ├── ggit-remote.h ├── ggit-repository.c ├── ggit-repository.h ├── ggit-revert-options.c ├── ggit-revert-options.h ├── ggit-revision-walker.c ├── ggit-revision-walker.h ├── ggit-signature.c ├── ggit-signature.h ├── ggit-status-options.c ├── ggit-status-options.h ├── ggit-submodule-update-options.c ├── ggit-submodule-update-options.h ├── ggit-submodule.c ├── ggit-submodule.h ├── ggit-tag.c ├── ggit-tag.h ├── ggit-transfer-progress.c ├── ggit-transfer-progress.h ├── ggit-tree-builder.c ├── ggit-tree-builder.h ├── ggit-tree-entry.c ├── ggit-tree-entry.h ├── ggit-tree.c ├── ggit-tree.h ├── ggit-types-18.h ├── ggit-types-19.h ├── ggit-types-pre18.h ├── ggit-types.c ├── ggit-types.h ├── ggit-utils.c ├── ggit-utils.h ├── ggit-version.h.in ├── ggit.h.in └── meson.build ├── meson.build ├── meson_options.txt ├── meson_python_compile.py ├── tests ├── meson.build └── repository.c └── tools ├── .gitignore ├── clang ├── __init__.py ├── cindex.py └── enumerations.py └── coverage.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.bak 2 | *.lo 3 | *.la 4 | *.o 5 | *.gir 6 | *.typelib 7 | *~ 8 | *.stamp 9 | .*.sw[nop] 10 | *.gcov 11 | .deps 12 | .libs 13 | Makefile 14 | Makefile.in 15 | /ABOUT-NLS 16 | /aclocal.m4 17 | /autom4te.cache 18 | /config.cache 19 | /config.guess 20 | /config.h 21 | /config.h.in 22 | /config.log 23 | /config.lt 24 | /config.rpath 25 | /config.status 26 | /config.status.lineno 27 | /config.sub 28 | /configure 29 | /configure.lineno 30 | /depcomp 31 | /examples/general 32 | /examples/walk 33 | /gnome-doc-utils.make 34 | /gtk-doc.make 35 | /INSTALL 36 | /install-sh 37 | /intltool-extract 38 | /intltool-extract.in 39 | /intltool-merge 40 | /intltool-merge.in 41 | /intltool-update 42 | /intltool-update.in 43 | /libgit2-glib-1.0.pc 44 | /libgit2-glib-*.tar.bz2 45 | /libgit2-glib/ggit-enum-types.c 46 | /libgit2-glib/ggit-enum-types.h 47 | /libtool 48 | /ltmain.sh 49 | /m4 50 | /missing 51 | /mkinstalldirs 52 | /omf.make 53 | /po/*.header 54 | /po/*.gmo 55 | /po/*.mo 56 | /po/*.sed 57 | /po/*.sin 58 | /po/.intltool-merge-cache 59 | /po/Makefile 60 | /po/Makefile.in 61 | /po/Makefile.in.in 62 | /po/Makevars.template 63 | /po/POTFILES 64 | /po/Rules-quot 65 | /po/stamp-it 66 | /py-compile 67 | /so_locations 68 | /stamp-h1 69 | /tests/repository 70 | /xmldocs.make 71 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | include: 2 | - project: "GNOME/citemplates" 3 | file: "templates/default-rules.yml" 4 | - component: "gitlab.gnome.org/GNOME/citemplates/gnomeos-basic-ci@master" 5 | - component: "gitlab.gnome.org/GNOME/citemplates/release-service@master" 6 | inputs: 7 | dist-job-name: "build-gnomeos" 8 | tarball-artifact-path: "_builddir/meson-dist/$CI_PROJECT_NAME-$CI_COMMIT_TAG.tar.xz" 9 | 10 | fedora41: 11 | image: fedora:41 12 | stage: build 13 | before_script: 14 | - dnf update -y 15 | - dnf install -y gcc meson ninja-build gettext gi-docgen glib2-devel libgit2-devel gobject-introspection-devel python3-gobject-devel vala libssh2-devel 16 | script: 17 | - meson build 18 | - meson compile -C build 19 | - meson install -C build 20 | 21 | fedora40: 22 | image: fedora:40 23 | stage: build 24 | before_script: 25 | - dnf update -y 26 | - dnf install -y gcc meson ninja-build gettext gi-docgen glib2-devel libgit2-devel gobject-introspection-devel python3-gobject-devel vala libssh2-devel 27 | script: 28 | - meson build 29 | - meson compile -C build 30 | - meson install -C build 31 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Active authors: 2 | 3 | Ignacio Casal Quinteiro 4 | Jesse van den Kieboom 5 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/libgit2-glib/ca9e9065f4a267e8922da42d9ca9b9170bc9c145/ChangeLog -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | General Information 2 | =================== 3 | 4 | libgit2-glib is a glib wrapper library around the libgit2 git access library. 5 | 6 | libgit2 only implements the core plumbing functions, not really the higher 7 | level porcelain stuff. For a primer on Git Internals that you will need to know 8 | to work with Git at this level, check out [Chapter 9][pg] of the Pro Git book. 9 | 10 | http://progit.org/book/ch9-0.html 11 | 12 | libgit2-glib is released under the GNU Lesser General Public License (LGPL) version 2.1, 13 | see the file 'COPYING' for more information. 14 | 15 | Installation 16 | ============ 17 | 18 | libgit2-glib requires libgit2-0.25.x, glib 2.44.x, gio 2.26.x and 19 | gobject-introspection 0.9.x. 20 | 21 | Simple install procedure: 22 | 23 | % tar Jxf libgit2-glib-1.2.1.tar.xz # unpack the sources 24 | % cd libgit2-glib-1.2.1 # change to the toplevel directory 25 | % meson builddir # run meson 26 | % ninja -C builddir # build libgit2-glib 27 | # [ Become root if necessary ] 28 | % ninja -C builddir install # install libgit2-glib 29 | 30 | See the file 'INSTALL' for more detailed information. 31 | -------------------------------------------------------------------------------- /docs/reference/.gitignore: -------------------------------------------------------------------------------- 1 | /html 2 | /tmpl 3 | /xml 4 | /libgit2-glib-1.0-decl-list.txt 5 | /libgit2-glib-1.0-decl.txt 6 | /libgit2-glib-1.0-overrides.txt 7 | /libgit2-glib-1.0-undeclared.txt 8 | /libgit2-glib-1.0-undocumented.txt 9 | /libgit2-glib-1.0-unused.txt 10 | /libgit2-glib-1.0.args 11 | /libgit2-glib-1.0.hierarchy 12 | /libgit2-glib-1.0.interfaces 13 | /libgit2-glib-1.0.prerequisites 14 | /libgit2-glib-1.0.signals 15 | /version.xml 16 | /*.stamp 17 | -------------------------------------------------------------------------------- /docs/reference/libgit2-glib.toml.in: -------------------------------------------------------------------------------- 1 | [library] 2 | version = "@version@" 3 | browse_url = "https://gitlab.gnome.org/GNOME/libgit2-glib" 4 | repository_url = "https://gitlab.gnome.org/GNOME/libgit2-glib.git" 5 | website_url = "https://wiki.gnome.org/Projects/Libgit2-glib" 6 | # docs_url = "https://www.freedesktop.org/software/libmbim/libmbim-glib/latest/" 7 | authors = "The libgit2-glib authors" 8 | license = "@license@" 9 | description = "libgit2-glib is a glib wrapper library around the libgit2 git access library." 10 | dependencies = [ "Gio-2.0", "GLib-2.0", "GObject-2.0" ] 11 | devhelp = true 12 | search_index = true 13 | 14 | [dependencies."Gio-2.0"] 15 | name = "Gio" 16 | description = "GObject interfaces and objects" 17 | docs_url = "https://docs.gtk.org/gio/" 18 | 19 | [dependencies."GLib-2.0"] 20 | name = "GLib" 21 | description = "The base type system library" 22 | docs_url = "https://docs.gtk.org/glib/" 23 | 24 | [dependencies."GObject-2.0"] 25 | name = "GObject" 26 | description = "The base type system library" 27 | docs_url = "https://docs.gtk.org/gobject/" 28 | 29 | 30 | [theme] 31 | name = "basic" 32 | show_index_summary = true 33 | show_class_hierarchy = true 34 | 35 | [source-location] 36 | base_url = "https://gitlab.gnome.org/GNOME/libgit2-glib/-/blob/master/" 37 | 38 | [extra] 39 | # The same order will be used when generating the index 40 | content_files = [] 41 | content_images = [] 42 | 43 | urlmap_file = "urlmap.js" 44 | -------------------------------------------------------------------------------- /docs/reference/meson.build: -------------------------------------------------------------------------------- 1 | doc_module = meson.project_name() 2 | 3 | toml_conf = { 4 | 'version': libgit2_glib_version, 5 | 'license': ','.join(meson.project_license()), 6 | } 7 | 8 | libgit2_glib_toml = configure_file( 9 | input: doc_module + '.toml.in', 10 | output: '@BASENAME@', 11 | configuration: toml_conf, 12 | ) 13 | 14 | custom_target( 15 | doc_module + '-doc', 16 | input: [ 17 | libgit2_glib_toml, 18 | libgit2_glib_gir, 19 | ], 20 | output: libgit2_glib_api_name, 21 | command: [ 22 | find_program('gi-docgen'), 23 | 'generate', 24 | '--quiet', 25 | '--no-namespace-dir', 26 | '--add-include-path=@0@'.format(source_root / 'libgit2-glib'), 27 | '--config=@INPUT0@', 28 | '--output-dir=@OUTPUT@', 29 | '--content-dir=@0@'.format(meson.current_source_dir()), 30 | '@INPUT1@', 31 | ], 32 | build_by_default: true, 33 | install: true, 34 | install_dir: gnome.gtkdoc_html_dir(''), 35 | ) 36 | -------------------------------------------------------------------------------- /docs/reference/urlmap.js: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 Iñigo Martinez 2 | // SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | // A map between namespaces and base URLs for their online documentation 5 | baseURLs = [ 6 | [ 'Gio', 'https://docs.gtk.org/gio/' ], 7 | [ 'GLib', 'https://docs.gtk.org/glib/' ], 8 | [ 'GObject', 'https://docs.gtk.org/gobject/' ], 9 | [ 'libgit2', 'https://libgit2.org/libgit2/' ], 10 | ] 11 | -------------------------------------------------------------------------------- /examples/general.c: -------------------------------------------------------------------------------- 1 | /* 2 | * general.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #include 23 | #include "libgit2-glib/ggit.h" 24 | 25 | int 26 | main (int argc, char *argv[]) 27 | { 28 | GgitRepository *repository; 29 | GgitOId *oid; 30 | GError *error = NULL; 31 | const gchar hex[] = "82576c09c3fac738a54582c6c04a47684882d1a1"; 32 | gchar *oid_str; 33 | GFile *repo_location; 34 | GFile *f; 35 | gchar *path; 36 | 37 | ggit_init (); 38 | 39 | if (argc < 2) 40 | { 41 | g_message ("Use: ./general path_to_git_repository"); 42 | return 1; 43 | } 44 | 45 | f = g_file_new_for_path (argv[1]); 46 | repo_location = ggit_repository_discover (f, &error); 47 | g_object_unref (f); 48 | 49 | if (error != NULL) 50 | { 51 | g_message ("%s", error->message); 52 | return 1; 53 | } 54 | 55 | path = g_file_get_path (repo_location); 56 | g_message ("Path repository: %s", path); 57 | g_free (path); 58 | 59 | repository = ggit_repository_open (repo_location, &error); 60 | 61 | if (error != NULL) 62 | { 63 | g_message ("%s", error->message); 64 | return 1; 65 | } 66 | 67 | f = ggit_repository_get_workdir (repository); 68 | path = g_file_get_path (f); 69 | 70 | g_message ("Working dir: %s", path); 71 | 72 | g_free (path); 73 | g_object_unref (f); 74 | 75 | oid = ggit_oid_new_from_string (hex); 76 | oid_str = ggit_oid_to_string (oid); 77 | 78 | g_message ("OId str: %s", oid_str); 79 | 80 | g_free (oid_str); 81 | ggit_oid_free (oid); 82 | g_object_unref (repository); 83 | 84 | return 0; 85 | } 86 | 87 | /* ex:set ts=8 noet: */ 88 | -------------------------------------------------------------------------------- /examples/meson.build: -------------------------------------------------------------------------------- 1 | examples = [ 2 | 'general', 3 | 'walk', 4 | ] 5 | 6 | if have_termios 7 | examples += ['clone'] 8 | endif 9 | 10 | foreach example: examples 11 | executable( 12 | example, 13 | example + '.c', 14 | include_directories: top_inc, 15 | dependencies: libgit2_glib_dep, 16 | ) 17 | endforeach 18 | -------------------------------------------------------------------------------- /libgit2-glib.doap: -------------------------------------------------------------------------------- 1 | 2 | 7 | libgit2-glib 8 | GLib wrapper for libgit2 9 | libgit2-glib is a glib library which wraps libgit2 10 | providing making it easier to develop manage git repositories in a 11 | GObject oriented application. 12 | 13 | 14 | 15 | 16 | 17 | 18 | Alberto Fanjul Alonso 19 | 20 | albfan 21 | 22 | 23 | 24 | 25 | Ignacio Casal Quinteiro 26 | 27 | icq 28 | 29 | 30 | 31 | 32 | Jesse van den Kieboom 33 | 34 | jessevdk 35 | 36 | 37 | 38 | 39 | Garrett Regier 40 | 41 | gregier 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /libgit2-glib/Ggit.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; py-indent-offset: 4 -*- 2 | # vim: tabstop=4 shiftwidth=4 expandtab 3 | # 4 | # Copyright (C) 2012 - Jesse van den Kieboom 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | from gi.repository import Gio 21 | from ..overrides import override 22 | from ..module import get_introspection_module 23 | 24 | 25 | Ggit = get_introspection_module('Ggit') 26 | __all__ = [] 27 | 28 | 29 | def _wrap_iter_size(self): 30 | for i in range(0, self.size()): 31 | yield self.get(i) 32 | 33 | def _wrap_iter_get(self): 34 | while self.next(): 35 | yield self.get() 36 | 37 | def _wrap_iter_get_by_index(self): 38 | for i in range(0, self.size()): 39 | yield self.get_by_index(i) 40 | 41 | def _wrap_iter_next(self): 42 | while True: 43 | value = self.next() 44 | if value is None: 45 | break 46 | 47 | yield value 48 | 49 | def _wrap_initable_init(self, *args, **kwargs): 50 | super(self.__class__, self).__init__(*args, **kwargs) 51 | Gio.Initable.init(self, None) 52 | 53 | def _override_dyn(base, **kwargs): 54 | name = base.__name__ 55 | 56 | try: 57 | cls = globals()[name] 58 | 59 | except KeyError: 60 | cls = override(type(name, (base,), {})) 61 | globals()[name] = cls 62 | __all__.append(name) 63 | 64 | for method, wrapper in kwargs.items(): 65 | setattr(cls, method, wrapper) 66 | 67 | 68 | for c in dir(Ggit): 69 | try: 70 | o = getattr(Ggit, c) 71 | 72 | except AttributeError: 73 | continue 74 | 75 | if not hasattr(o, '__gtype__'): 76 | continue 77 | 78 | # Add __str__ mapping using to_string 79 | if hasattr(o, 'to_string'): 80 | _override_dyn(o, __str__=o.to_string) 81 | 82 | # Add iterator pattern 83 | # GgitCommitParents, GgitIndexEntriesResolveUndo, GgitTree 84 | if hasattr(o, 'get') and hasattr(o, 'size'): 85 | _override_dyn(o, __iter__=_wrap_iter_size) 86 | 87 | # GgitBranchEnumerator 88 | elif hasattr(o, 'get') and hasattr(o, 'next'): 89 | _override_dyn(o, __iter__=_wrap_iter_get) 90 | 91 | # GgitIndexEntries 92 | elif hasattr(o, 'get_by_index') and hasattr(o, 'size'): 93 | _override_dyn(o, __iter__=_wrap_iter_get_by_index) 94 | 95 | # GgitRevisionWalker 96 | elif hasattr(o, 'next'): 97 | _override_dyn(o, __iter__=_wrap_iter_next) 98 | 99 | # GgitIndex, GgitRepository, GgitRevisionWalker, ... 100 | if o.__gtype__.is_a(Gio.Initable): 101 | _override_dyn(o, __init__=_wrap_initable_init) 102 | 103 | # vi:ex:ts=4:et 104 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-annotated-commit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-annotated-commit.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2015 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_ANNOTATED_COMMIT_H__ 23 | #define __GGIT_ANNOTATED_COMMIT_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "ggit-types.h" 29 | #include "ggit-repository.h" 30 | #include "ggit-error.h" 31 | 32 | G_BEGIN_DECLS 33 | 34 | #define GGIT_TYPE_ANNOTATED_COMMIT (ggit_annotated_commit_get_type ()) 35 | #define GGIT_ANNOTATED_COMMIT(obj) ((GgitAnnotatedCommit *)obj) 36 | 37 | GType ggit_annotated_commit_get_type (void) G_GNUC_CONST; 38 | 39 | GgitAnnotatedCommit *_ggit_annotated_commit_wrap (git_annotated_commit *annotated_commit); 40 | 41 | git_annotated_commit *_ggit_annotated_commit_get_annotated_commit (GgitAnnotatedCommit *annotated_commit); 42 | 43 | GgitAnnotatedCommit *ggit_annotated_commit_ref (GgitAnnotatedCommit *annotated_commit); 44 | void ggit_annotated_commit_unref (GgitAnnotatedCommit *annotated_commit); 45 | 46 | GgitOId *ggit_annotated_commit_get_id (GgitAnnotatedCommit *annotated_commit); 47 | 48 | GgitAnnotatedCommit *ggit_annotated_commit_new_from_ref (GgitRepository *repository, 49 | GgitRef *ref, 50 | GError **error); 51 | 52 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitAnnotatedCommit, ggit_annotated_commit_unref) 53 | 54 | G_END_DECLS 55 | 56 | #endif /* __GGIT_ANNOTATED_COMMIT_H__ */ 57 | 58 | /* ex:set ts=8 noet: */ 59 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-blame-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-blame-options.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_BLAME_OPTIONS_H__ 22 | #define __GGIT_BLAME_OPTIONS_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_BLAME_OPTIONS (ggit_blame_options_get_type ()) 32 | #define GGIT_BLAME_OPTIONS(obj) ((GgitBlameOptions *)obj) 33 | 34 | GType ggit_blame_options_get_type (void) G_GNUC_CONST; 35 | 36 | git_blame_options * 37 | _ggit_blame_options_get_blame_options (GgitBlameOptions *blame_options); 38 | 39 | GgitBlameOptions *ggit_blame_options_copy (GgitBlameOptions *blame_options); 40 | void ggit_blame_options_free (GgitBlameOptions *blame_options); 41 | 42 | GgitBlameOptions *ggit_blame_options_new (void); 43 | 44 | GgitBlameFlags ggit_blame_get_flags (GgitBlameOptions *blame_options); 45 | void ggit_blame_set_flags (GgitBlameOptions *blame_options, 46 | GgitBlameFlags flags); 47 | 48 | GgitOId *ggit_blame_options_get_newest_commit (GgitBlameOptions *blame_options); 49 | void ggit_blame_options_set_newest_commit (GgitBlameOptions *blame_options, 50 | GgitOId *oid); 51 | 52 | GgitOId *ggit_blame_options_get_oldest_commit (GgitBlameOptions *blame_options); 53 | void ggit_blame_options_set_oldest_commit (GgitBlameOptions *blame_options, 54 | GgitOId *oid); 55 | 56 | guint32 ggit_blame_options_get_minimum_line (GgitBlameOptions *blame_options); 57 | void ggit_blame_options_set_minimum_line (GgitBlameOptions *blame_options, 58 | guint32 line); 59 | 60 | guint32 ggit_blame_options_get_maximum_line (GgitBlameOptions *blame_options); 61 | void ggit_blame_options_set_maximum_line (GgitBlameOptions *blame_options, 62 | guint32 line); 63 | 64 | guint16 ggit_blame_options_get_minimum_match_characters 65 | (GgitBlameOptions *blame_options); 66 | 67 | void ggit_blame_options_set_minimum_match_characters 68 | (GgitBlameOptions *blame_options, 69 | guint16 characters); 70 | 71 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitBlameOptions, ggit_blame_options_free) 72 | 73 | G_END_DECLS 74 | 75 | #endif /* __GGIT_BLAME_OPTIONS_H__ */ 76 | 77 | /* ex:set ts=8 noet: */ 78 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-blame.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-blame.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_BLAME_H__ 22 | #define __GGIT_BLAME_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_BLAME (ggit_blame_get_type ()) 33 | G_DECLARE_FINAL_TYPE (GgitBlame, ggit_blame, GGIT, BLAME, GgitNative) 34 | 35 | GType ggit_blame_hunk_get_type (void) G_GNUC_CONST; 36 | GgitBlameHunk *ggit_blame_hunk_ref (GgitBlameHunk *blame_hunk); 37 | void ggit_blame_hunk_unref (GgitBlameHunk *blame_hunk); 38 | 39 | guint16 ggit_blame_hunk_get_lines_in_hunk (GgitBlameHunk *blame_hunk); 40 | 41 | GgitOId *ggit_blame_hunk_get_final_commit_id (GgitBlameHunk *blame_hunk); 42 | guint16 ggit_blame_hunk_get_final_start_line_number (GgitBlameHunk *blame_hunk); 43 | GgitSignature *ggit_blame_hunk_get_final_signature (GgitBlameHunk *blame_hunk); 44 | 45 | GgitOId *ggit_blame_hunk_get_orig_commit_id (GgitBlameHunk *blame_hunk); 46 | guint16 ggit_blame_hunk_get_orig_start_line_number (GgitBlameHunk *blame_hunk); 47 | GgitSignature *ggit_blame_hunk_get_orig_signature (GgitBlameHunk *blame_hunk); 48 | const gchar *ggit_blame_hunk_get_orig_path (GgitBlameHunk *blame_hunk); 49 | 50 | gboolean ggit_blame_hunk_is_boundary (GgitBlameHunk *blame_hunk); 51 | 52 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitBlameHunk, ggit_blame_hunk_unref) 53 | 54 | GgitBlame *_ggit_blame_wrap (git_blame *blame); 55 | 56 | guint32 ggit_blame_get_hunk_count (GgitBlame *blame); 57 | 58 | GgitBlameHunk *ggit_blame_get_hunk_by_line (GgitBlame *blame, 59 | guint32 line); 60 | 61 | GgitBlameHunk *ggit_blame_get_hunk_by_index (GgitBlame *blame, 62 | guint32 idx); 63 | 64 | GgitBlame *ggit_blame_from_buffer (GgitBlame *blame, 65 | const guint8 *buffer, 66 | gsize buffer_length, 67 | GError **error); 68 | 69 | G_END_DECLS 70 | 71 | #endif /* __GGIT_BLAME_H__ */ 72 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-blob-output-stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-blob-output-stream.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_BLOB_OUTPUT_STREAM_H__ 23 | #define __GGIT_BLOB_OUTPUT_STREAM_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "ggit-types.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_BLOB_OUTPUT_STREAM (ggit_blob_output_stream_get_type ()) 33 | G_DECLARE_DERIVABLE_TYPE (GgitBlobOutputStream, ggit_blob_output_stream, GGIT, BLOB_OUTPUT_STREAM, GOutputStream) 34 | 35 | /** 36 | * GgitBlobOutputStreamClass: 37 | * @parent_class: The parent class. 38 | * 39 | * The class structure for #GgitBlobOutputStreamClass. 40 | */ 41 | struct _GgitBlobOutputStreamClass 42 | { 43 | /*< private >*/ 44 | GOutputStreamClass parent_class; 45 | }; 46 | 47 | GgitBlobOutputStream *_ggit_blob_output_stream_new (GgitRepository *repository); 48 | 49 | GgitOId *ggit_blob_output_stream_get_id (GgitBlobOutputStream *stream, 50 | GError **error); 51 | 52 | G_END_DECLS 53 | 54 | #endif /* __GGIT_BLOB_OUTPUT_STREAM_H__ */ 55 | 56 | /* ex:set ts=8 noet: */ 57 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-blob.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-blob.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #include "ggit-blob.h" 23 | 24 | /** 25 | * GgitBlob: 26 | * 27 | * Represents a blob object. 28 | */ 29 | struct _GgitBlob 30 | { 31 | GgitObject parent_instance; 32 | }; 33 | 34 | G_DEFINE_TYPE (GgitBlob, ggit_blob, GGIT_TYPE_OBJECT) 35 | 36 | static void 37 | ggit_blob_class_init (GgitBlobClass *klass) 38 | { 39 | } 40 | 41 | static void 42 | ggit_blob_init (GgitBlob *self) 43 | { 44 | } 45 | 46 | GgitBlob * 47 | _ggit_blob_wrap (git_blob *blob, 48 | gboolean owned) 49 | { 50 | GgitBlob *gblob; 51 | 52 | gblob = g_object_new (GGIT_TYPE_BLOB, 53 | "native", blob, 54 | NULL); 55 | 56 | if (owned) 57 | { 58 | _ggit_native_set_destroy_func (gblob, 59 | (GDestroyNotify)git_object_free); 60 | } 61 | 62 | return gblob; 63 | } 64 | 65 | /** 66 | * ggit_blob_get_raw_content: 67 | * @blob: a #GgitBlob. 68 | * @length: (out) (allow-none): return value of the length of the data. 69 | * 70 | * Gets a read-only buffer with the raw contents of @blob. 71 | * 72 | * A pointer to the raw contents of @blob is returned. 73 | * This pointer is owned internally by @object and must 74 | * not be free'd. The pointer may be invalidated at a later 75 | * time. 76 | * 77 | * Returns: (array length=length) (element-type guchar) (nullable): the blob content or 78 | * %NULL if the blob does not have any content. 79 | * 80 | **/ 81 | const guchar * 82 | ggit_blob_get_raw_content (GgitBlob *blob, 83 | gsize *length) 84 | { 85 | git_blob *b; 86 | 87 | g_return_val_if_fail (GGIT_IS_BLOB (blob), NULL); 88 | 89 | b = _ggit_native_get (blob); 90 | 91 | if (length != NULL) 92 | { 93 | *length = git_blob_rawsize (b); 94 | } 95 | 96 | return (const guchar *)git_blob_rawcontent (b); 97 | } 98 | 99 | /** 100 | * ggit_blob_is_binary: 101 | * @blob: a #GgitBlob. 102 | * 103 | * Check whether the blob is binary. 104 | * 105 | * Returns: %TRUE if the blob is binary, %FALSE otherwise. 106 | * 107 | **/ 108 | gboolean 109 | ggit_blob_is_binary (GgitBlob *blob) 110 | { 111 | g_return_val_if_fail (GGIT_IS_BLOB (blob), FALSE); 112 | 113 | return git_blob_is_binary (_ggit_native_get (blob)); 114 | } 115 | 116 | /* ex:set ts=8 noet: */ 117 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-blob.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-blob.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_BLOB_H__ 23 | #define __GGIT_BLOB_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "ggit-object.h" 29 | #include "ggit-types.h" 30 | 31 | G_BEGIN_DECLS 32 | 33 | #define GGIT_TYPE_BLOB (ggit_blob_get_type ()) 34 | G_DECLARE_FINAL_TYPE (GgitBlob, ggit_blob, GGIT, BLOB, GgitObject) 35 | 36 | GgitBlob *_ggit_blob_wrap (git_blob *blob, 37 | gboolean owned); 38 | 39 | const guchar *ggit_blob_get_raw_content (GgitBlob *blob, 40 | gsize *length); 41 | 42 | gboolean ggit_blob_is_binary (GgitBlob *blob); 43 | 44 | G_END_DECLS 45 | 46 | #endif /* __GGIT_BLOB_H__ */ 47 | 48 | /* ex:set ts=8 noet: */ 49 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-branch-enumerator.c: -------------------------------------------------------------------------------- 1 | #include "ggit-branch-enumerator.h" 2 | 3 | struct _GgitBranchEnumerator 4 | { 5 | git_branch_iterator *iterator; 6 | GgitRef *ref; 7 | gint ref_count; 8 | }; 9 | 10 | G_DEFINE_BOXED_TYPE (GgitBranchEnumerator, ggit_branch_enumerator, ggit_branch_enumerator_ref, ggit_branch_enumerator_unref) 11 | 12 | GgitBranchEnumerator * 13 | _ggit_branch_enumerator_wrap (git_branch_iterator *iter) 14 | { 15 | GgitBranchEnumerator *ret; 16 | 17 | g_return_val_if_fail (iter != NULL, NULL); 18 | 19 | ret = g_slice_new (GgitBranchEnumerator); 20 | ret->ref_count = 1; 21 | ret->iterator = iter; 22 | ret->ref = NULL; 23 | 24 | return ret; 25 | } 26 | 27 | /** 28 | * ggit_branch_enumerator_ref: 29 | * @enumerator: a #GgitBranchEnumerator. 30 | * 31 | * Returns: (transfer full) (nullable): @enumerator or %NULL 32 | */ 33 | GgitBranchEnumerator * 34 | ggit_branch_enumerator_ref (GgitBranchEnumerator *enumerator) 35 | { 36 | g_return_val_if_fail (enumerator != NULL, NULL); 37 | 38 | g_atomic_int_inc (&enumerator->ref_count); 39 | return enumerator; 40 | } 41 | 42 | /** 43 | * ggit_branch_enumerator_unref: 44 | * @enumerator: a #GgitBranchEnumerator. 45 | */ 46 | void 47 | ggit_branch_enumerator_unref (GgitBranchEnumerator *enumerator) 48 | { 49 | if (g_atomic_int_dec_and_test (&enumerator->ref_count)) 50 | { 51 | g_clear_object (&enumerator->ref); 52 | 53 | git_branch_iterator_free (enumerator->iterator); 54 | g_slice_free (GgitBranchEnumerator, enumerator); 55 | } 56 | } 57 | 58 | /** 59 | * ggit_branch_enumerator_iterator: 60 | * @enumerator: a #GgitBranchEnumerator. 61 | * 62 | * Get an iterator for the enumerator. 63 | * 64 | * Returns: (transfer none) (nullable): a #GgitBranchEnumerator or %NULL. 65 | * 66 | **/ 67 | GgitBranchEnumerator * 68 | ggit_branch_enumerator_iterator (GgitBranchEnumerator *enumerator) 69 | { 70 | g_return_val_if_fail (enumerator != NULL, NULL); 71 | 72 | return enumerator; 73 | } 74 | 75 | /** 76 | * ggit_branch_enumerator_next: 77 | * @enumerator: a #GgitBranchEnumerator. 78 | * 79 | * Move the enumerator to the next branch. 80 | * 81 | * Returns: %TRUE if there is a next branch, %FALSE otherwise. 82 | */ 83 | gboolean 84 | ggit_branch_enumerator_next (GgitBranchEnumerator *enumerator) 85 | { 86 | git_reference *ref; 87 | git_branch_t branch_type; 88 | 89 | g_return_val_if_fail (enumerator != NULL, FALSE); 90 | 91 | g_clear_object (&enumerator->ref); 92 | 93 | if (git_branch_next (&ref, &branch_type, enumerator->iterator) != GIT_OK) 94 | { 95 | return FALSE; 96 | } 97 | 98 | if (branch_type == GIT_BRANCH_LOCAL) 99 | { 100 | enumerator->ref = GGIT_REF (_ggit_branch_wrap (ref)); 101 | } 102 | else 103 | { 104 | enumerator->ref = _ggit_ref_wrap (ref, FALSE); 105 | } 106 | 107 | return TRUE; 108 | } 109 | 110 | /** 111 | * ggit_branch_enumerator_get: 112 | * @enumerator: a #GgitBranchEnumerator. 113 | * 114 | * Returns the currently being enumerated branch, or %NULL. Note that the 115 | * returned GgitRef will be of type GgitBranch if the ref represents a local 116 | * branch. 117 | * 118 | * Returns: (transfer full) (nullable): the branch ref or %NULL. 119 | */ 120 | GgitRef * 121 | ggit_branch_enumerator_get (GgitBranchEnumerator *enumerator) 122 | { 123 | g_return_val_if_fail (enumerator != NULL, NULL); 124 | 125 | if (enumerator->ref != NULL) 126 | { 127 | return g_object_ref (enumerator->ref); 128 | } 129 | 130 | return NULL; 131 | } 132 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-branch-enumerator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-branch-enumerator.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_BRANCH_ENUMERATOR_H__ 22 | #define __GGIT_BRANCH_ENUMERATOR_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_BRANCH_ENUMERATOR (ggit_branch_enumerator_get_type ()) 33 | #define GGIT_BRANCH_ENUMERATOR(obj) ((GgitBranchEnumerator *)obj) 34 | 35 | GType ggit_branch_enumerator_get_type (void) G_GNUC_CONST; 36 | 37 | GgitBranchEnumerator *_ggit_branch_enumerator_wrap (git_branch_iterator *iter); 38 | 39 | GgitBranchEnumerator *ggit_branch_enumerator_ref (GgitBranchEnumerator *enumerator); 40 | void ggit_branch_enumerator_unref (GgitBranchEnumerator *enumerator); 41 | 42 | GgitBranchEnumerator *ggit_branch_enumerator_iterator (GgitBranchEnumerator *enumerator); 43 | 44 | gboolean ggit_branch_enumerator_next (GgitBranchEnumerator *enumerator); 45 | GgitRef *ggit_branch_enumerator_get (GgitBranchEnumerator *enumerator); 46 | 47 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitBranchEnumerator, ggit_branch_enumerator_unref) 48 | 49 | #endif /* __GGIT_BRANCH_ENUMERATOR_H__ */ 50 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-branch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-branch.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_BRANCH_H__ 22 | #define __GGIT_BRANCH_H__ 23 | 24 | #include 25 | 26 | G_BEGIN_DECLS 27 | 28 | #define GGIT_TYPE_BRANCH (ggit_branch_get_type ()) 29 | G_DECLARE_DERIVABLE_TYPE (GgitBranch, ggit_branch, GGIT, BRANCH, GgitRef) 30 | 31 | struct _GgitBranchClass 32 | { 33 | /*< private >*/ 34 | GgitRefClass parent_class; 35 | }; 36 | 37 | GgitBranch *_ggit_branch_wrap (git_reference *ref); 38 | 39 | void ggit_branch_delete (GgitBranch *branch, 40 | GError **error); 41 | 42 | GgitBranch *ggit_branch_move (GgitBranch *branch, 43 | const gchar *new_branch_name, 44 | GgitCreateFlags flags, 45 | GError **error); 46 | 47 | const gchar *ggit_branch_get_name (GgitBranch *branch, 48 | GError **error); 49 | 50 | GgitRef *ggit_branch_get_upstream (GgitBranch *branch, 51 | GError **error); 52 | 53 | void ggit_branch_set_upstream (GgitBranch *branch, 54 | const gchar *upstream_branch_name, 55 | GError **error); 56 | 57 | gboolean ggit_branch_is_head (GgitBranch *branch, 58 | GError **error); 59 | 60 | G_END_DECLS 61 | 62 | #endif /* __GGIT_BRANCH_H__ */ 63 | 64 | /* ex:set ts=8 noet: */ 65 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-cherry-pick-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-cherry-pick-options.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2014 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_CHERRY_PICK_OPTIONS_H__ 22 | #define __GGIT_CHERRY_PICK_OPTIONS_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include "ggit-types.h" 28 | #include "ggit-checkout-options.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_CHERRY_PICK_OPTIONS (ggit_cherry_pick_options_get_type ()) 33 | G_DECLARE_DERIVABLE_TYPE (GgitCherryPickOptions, ggit_cherry_pick_options, GGIT, CHERRY_PICK_OPTIONS, GObject) 34 | 35 | struct _GgitCherryPickOptionsClass 36 | { 37 | GObjectClass parent_class; 38 | }; 39 | 40 | const git_cherrypick_options * 41 | _ggit_cherry_pick_options_get_cherry_pick_options ( 42 | GgitCherryPickOptions *options); 43 | 44 | GgitCherryPickOptions *ggit_cherry_pick_options_new (void); 45 | 46 | guint ggit_cherry_pick_options_get_mainline (GgitCherryPickOptions *options); 47 | void ggit_cherry_pick_options_set_mainline (GgitCherryPickOptions *options, 48 | guint mainline); 49 | 50 | GgitCheckoutOptions *ggit_cherry_pick_options_get_checkout_options (GgitCherryPickOptions *options); 51 | void ggit_cherry_pick_options_set_checkout_options (GgitCherryPickOptions *options, 52 | GgitCheckoutOptions *checkout_options); 53 | 54 | GgitMergeOptions *ggit_cherry_pick_options_get_merge_options (GgitCherryPickOptions *options); 55 | void ggit_cherry_pick_options_set_merge_options (GgitCherryPickOptions *options, 56 | GgitMergeOptions *merge_options); 57 | 58 | G_END_DECLS 59 | 60 | #endif /* __GGIT_CHERRY_PICK_OPTIONS_H__ */ 61 | 62 | /* ex:set ts=8 noet: */ 63 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-clone-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-clone-options.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_CLONE_OPTIONS_H__ 23 | #define __GGIT_CLONE_OPTIONS_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | G_BEGIN_DECLS 32 | 33 | #define GGIT_TYPE_CLONE_OPTIONS (ggit_clone_options_get_type ()) 34 | G_DECLARE_DERIVABLE_TYPE (GgitCloneOptions, ggit_clone_options, GGIT, CLONE_OPTIONS, GObject) 35 | 36 | struct _GgitCloneOptionsClass 37 | { 38 | GObjectClass parent_class; 39 | 40 | /* virtual methods */ 41 | GgitRepository *(*create_repository) (GgitCloneOptions *options, 42 | const gchar *path, 43 | gboolean is_bare, 44 | GError **error); 45 | 46 | GgitRemote *(*create_remote) (GgitCloneOptions *options, 47 | GgitRepository *repository, 48 | const gchar *name, 49 | const gchar *url, 50 | GError **error); 51 | 52 | }; 53 | 54 | const git_clone_options *_ggit_clone_options_get_native (GgitCloneOptions *options); 55 | 56 | GgitCloneOptions *ggit_clone_options_new (void); 57 | 58 | gboolean ggit_clone_options_get_is_bare (GgitCloneOptions *options); 59 | 60 | void ggit_clone_options_set_is_bare (GgitCloneOptions *options, 61 | gboolean bare); 62 | 63 | const gchar *ggit_clone_options_get_checkout_branch (GgitCloneOptions *options); 64 | 65 | void ggit_clone_options_set_checkout_branch (GgitCloneOptions *options, 66 | const gchar *checkout_branch); 67 | 68 | GgitCloneLocal ggit_clone_options_get_local (GgitCloneOptions *options); 69 | void ggit_clone_options_set_local (GgitCloneOptions *options, 70 | GgitCloneLocal local); 71 | 72 | GgitFetchOptions *ggit_clone_options_get_fetch_options (GgitCloneOptions *options); 73 | void ggit_clone_options_set_fetch_options (GgitCloneOptions *options, 74 | GgitFetchOptions *fetch_options); 75 | 76 | G_END_DECLS 77 | 78 | #endif /* __GGIT_CLONE_OPTIONS_H__ */ 79 | 80 | /* ex:set ts=8 noet: */ 81 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-commit-parents.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-commit-parents.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2014 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_COMMIT_PARENTS_H__ 23 | #define __GGIT_COMMIT_PARENTS_H__ 24 | 25 | #include 26 | 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | typedef struct _GgitCommit GgitCommit; 32 | 33 | #define GGIT_TYPE_COMMIT_PARENTS (ggit_commit_parents_get_type ()) 34 | G_DECLARE_FINAL_TYPE (GgitCommitParents, ggit_commit_parents, GGIT, COMMIT_PARENTS, GObject) 35 | 36 | GgitCommitParents *ggit_commit_parents_new (GgitCommit *commit); 37 | 38 | guint ggit_commit_parents_get_size (GgitCommitParents *parents); 39 | 40 | GgitCommit *ggit_commit_parents_get (GgitCommitParents *parents, 41 | guint idx); 42 | 43 | GgitOId *ggit_commit_parents_get_id (GgitCommitParents *parents, 44 | guint idx); 45 | 46 | G_END_DECLS 47 | 48 | #endif /* __GGIT_COMMIT_PARENTS_H__ */ 49 | 50 | /* ex:set ts=8 noet: */ 51 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-commit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-commit.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_COMMIT_H__ 23 | #define __GGIT_COMMIT_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | G_BEGIN_DECLS 35 | 36 | #define GGIT_TYPE_COMMIT (ggit_commit_get_type ()) 37 | G_DECLARE_DERIVABLE_TYPE (GgitCommit, ggit_commit, GGIT, COMMIT, GgitObject) 38 | 39 | /** 40 | * GgitCommitClass: 41 | * @parent_class: The parent class. 42 | * 43 | * The class structure for #GgitCommitClass. 44 | */ 45 | struct _GgitCommitClass 46 | { 47 | /*< private >*/ 48 | GgitObjectClass parent_class; 49 | }; 50 | 51 | GgitCommit *_ggit_commit_wrap (git_commit *commit, 52 | gboolean owned); 53 | 54 | const git_commit *_ggit_commit_get_commit (GgitCommit *commit); 55 | 56 | const gchar *ggit_commit_get_message_encoding (GgitCommit *commit); 57 | 58 | const gchar *ggit_commit_get_message (GgitCommit *commit); 59 | 60 | const gchar *ggit_commit_get_subject (GgitCommit *commit); 61 | 62 | GgitSignature *ggit_commit_get_committer (GgitCommit *commit); 63 | 64 | GgitSignature *ggit_commit_get_author (GgitCommit *commit); 65 | 66 | GgitCommitParents *ggit_commit_get_parents (GgitCommit *commit); 67 | 68 | GgitTree *ggit_commit_get_tree (GgitCommit *commit); 69 | 70 | GgitOId *ggit_commit_get_tree_id (GgitCommit *commit); 71 | 72 | GgitCommit *ggit_commit_get_nth_ancestor (GgitCommit *commit, 73 | guint n, 74 | GError **error); 75 | 76 | GgitOId *ggit_commit_amend (GgitCommit *commit, 77 | const gchar *update_ref, 78 | GgitSignature *author, 79 | GgitSignature *committer, 80 | const gchar *message_encoding, 81 | const gchar *message, 82 | GgitTree *tree, 83 | GError **error); 84 | 85 | G_END_DECLS 86 | 87 | #endif /* __GGIT_COMMIT_H__ */ 88 | 89 | /* ex:set ts=8 noet: */ 90 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-config-entry.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-config-entry.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #include "ggit-config-entry.h" 22 | 23 | struct _GgitConfigEntry 24 | { 25 | const git_config_entry *entry; 26 | gint ref_count; 27 | }; 28 | 29 | G_DEFINE_BOXED_TYPE (GgitConfigEntry, 30 | ggit_config_entry, 31 | ggit_config_entry_ref, 32 | ggit_config_entry_unref) 33 | 34 | GgitConfigEntry * 35 | _ggit_config_entry_wrap (const git_config_entry *entry) 36 | { 37 | GgitConfigEntry *ret; 38 | 39 | ret = g_slice_new (GgitConfigEntry); 40 | ret->entry = entry; 41 | ret->ref_count = 1; 42 | 43 | return ret; 44 | } 45 | 46 | /** 47 | * ggit_config_entry_ref: 48 | * @entry: a #GgitConfigEntry. 49 | * 50 | * Atomically increments the reference count of @entry by one. 51 | * This function is MT-safe and may be called from any thread. 52 | * 53 | * Returns: (transfer none) (nullable): a #GgitConfigEntry or %NULL. 54 | **/ 55 | GgitConfigEntry * 56 | ggit_config_entry_ref (GgitConfigEntry *entry) 57 | { 58 | g_return_val_if_fail (entry != NULL, NULL); 59 | 60 | g_atomic_int_inc (&entry->ref_count); 61 | 62 | return entry; 63 | } 64 | 65 | /** 66 | * ggit_config_entry_unref: 67 | * @entry: a #GgitConfigEntry. 68 | * 69 | * Atomically decrements the reference count of @entry by one. 70 | * If the reference count drops to 0, @entry is freed. 71 | **/ 72 | void 73 | ggit_config_entry_unref (GgitConfigEntry *entry) 74 | { 75 | g_return_if_fail (entry != NULL); 76 | 77 | if (g_atomic_int_dec_and_test (&entry->ref_count)) 78 | { 79 | g_slice_free (GgitConfigEntry, entry); 80 | } 81 | } 82 | 83 | /** 84 | * ggit_config_entry_get_name: 85 | * @entry: a #GgitConfigEntry. 86 | * 87 | * Gets the name of @entry. 88 | * 89 | * Returns: (transfer none) (nullable): the name of @entry or %NULL. 90 | */ 91 | const gchar * 92 | ggit_config_entry_get_name (GgitConfigEntry *entry) 93 | { 94 | g_return_val_if_fail (entry != NULL, NULL); 95 | 96 | return entry->entry->name; 97 | } 98 | 99 | /** 100 | * ggit_config_entry_get_value: 101 | * @entry: a #GgitConfigEntry. 102 | * 103 | * Gets the value of @entry. 104 | * 105 | * Returns: (transfer none) (nullable): the value of @entry or %NULL. 106 | */ 107 | const gchar * 108 | ggit_config_entry_get_value (GgitConfigEntry *entry) 109 | { 110 | g_return_val_if_fail (entry != NULL, NULL); 111 | 112 | return entry->entry->value; 113 | } 114 | 115 | /** 116 | * ggit_config_entry_get_level: 117 | * @entry: a #GgitConfigEntry. 118 | * 119 | * Gets the #GgitConfigLevel of @entry. 120 | * 121 | * Returns: the #GgitConfigLevel of @entry. 122 | */ 123 | GgitConfigLevel 124 | ggit_config_entry_get_level (GgitConfigEntry *entry) 125 | { 126 | g_return_val_if_fail (entry != NULL, 0); 127 | 128 | return (GgitConfigLevel)entry->entry->level; 129 | } 130 | 131 | /* ex:set ts=8 noet: */ 132 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-config-entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-config-entry.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_CONFIG_ENTRY_H__ 22 | #define __GGIT_CONFIG_ENTRY_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include "ggit-types.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_CONFIG_ENTRY (ggit_config_entry_get_type ()) 32 | #define GGIT_CONFIG_ENTRY(obj) ((GgitConfigEntry *)obj) 33 | 34 | GType ggit_config_entry_get_type (void) G_GNUC_CONST; 35 | 36 | GgitConfigEntry *_ggit_config_entry_wrap (const git_config_entry *entry); 37 | 38 | GgitConfigEntry *ggit_config_entry_ref (GgitConfigEntry *entry); 39 | void ggit_config_entry_unref (GgitConfigEntry *entry); 40 | 41 | const gchar *ggit_config_entry_get_name (GgitConfigEntry *entry); 42 | 43 | const gchar *ggit_config_entry_get_value (GgitConfigEntry *entry); 44 | 45 | GgitConfigLevel ggit_config_entry_get_level (GgitConfigEntry *entry); 46 | 47 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitConfigEntry, ggit_config_entry_unref) 48 | 49 | G_END_DECLS 50 | 51 | #endif /* __GGIT_CONFIG_ENTRY_H__ */ 52 | 53 | /* ex:set ts=8 noet: */ 54 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-convert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-convert.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_CONVERT_H__ 22 | #define __GGIT_CONVERT_H__ 23 | 24 | #include 25 | 26 | G_BEGIN_DECLS 27 | 28 | gchar *ggit_convert_utf8 (const gchar *str, 29 | gssize size, 30 | const gchar *from_charset); 31 | 32 | G_END_DECLS 33 | 34 | #endif /* __GGIT_CONVERT_H__ */ 35 | 36 | /* ex:set ts=8 noet: */ 37 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-cred-plaintext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-cred-plaintext.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_CRED_PLAINTEXT_H__ 23 | #define __GGIT_CRED_PLAINTEXT_H__ 24 | 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GGIT_TYPE_CRED_PLAINTEXT (ggit_cred_plaintext_get_type ()) 31 | G_DECLARE_DERIVABLE_TYPE (GgitCredPlaintext, ggit_cred_plaintext, GGIT, CRED_PLAINTEXT, GgitCred) 32 | 33 | struct _GgitCredPlaintextClass 34 | { 35 | /*< private >*/ 36 | GgitCredClass parent_class; 37 | }; 38 | 39 | GgitCredPlaintext *ggit_cred_plaintext_new (const gchar *username, 40 | const gchar *password, 41 | GError **error); 42 | 43 | const gchar *ggit_cred_plaintext_get_username (GgitCredPlaintext *cred); 44 | 45 | const gchar *ggit_cred_plaintext_get_password (GgitCredPlaintext *cred); 46 | 47 | G_END_DECLS 48 | 49 | #endif /* __GGIT_CRED_PLAINTEXT_H__ */ 50 | 51 | /* ex:set ts=8 noet: */ 52 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-cred-ssh-key-from-agent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-cred-ssh-key-from-agent.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_CRED_SSH_KEY_FROM_AGENT_H__ 23 | #define __GGIT_CRED_SSH_KEY_FROM_AGENT_H__ 24 | 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GGIT_TYPE_CRED_SSH_KEY_FROM_AGENT (ggit_cred_ssh_key_from_agent_get_type ()) 31 | G_DECLARE_FINAL_TYPE (GgitCredSshKeyFromAgent, ggit_cred_ssh_key_from_agent, GGIT, CRED_SSH_KEY_FROM_AGENT, GgitCred) 32 | 33 | GgitCredSshKeyFromAgent * 34 | ggit_cred_ssh_key_from_agent_new (const gchar *username, 35 | GError **error); 36 | 37 | const gchar *ggit_cred_ssh_key_from_agent_get_username (GgitCredSshKeyFromAgent *cred); 38 | 39 | G_END_DECLS 40 | 41 | #endif /* __GGIT_CRED_SSH_KEY_FROM_AGENT_H__ */ 42 | 43 | /* ex:set ts=8 noet: */ 44 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-cred.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-cred.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #include "ggit-cred.h" 23 | 24 | // NOTE: this is a simple wrap around GgitNative to have a common point for git_cred types 25 | 26 | /** 27 | * GgitCred: 28 | * 29 | * Represents a git credential. 30 | */ 31 | 32 | G_DEFINE_TYPE (GgitCred, ggit_cred, GGIT_TYPE_NATIVE) 33 | 34 | static void 35 | ggit_cred_class_init (GgitCredClass *klass) 36 | { 37 | } 38 | 39 | static void 40 | ggit_cred_init (GgitCred *cred) 41 | { 42 | } 43 | 44 | /* ex:set ts=8 noet: */ 45 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-cred.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-cred.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_CRED_H__ 23 | #define __GGIT_CRED_H__ 24 | 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GGIT_TYPE_CRED (ggit_cred_get_type ()) 31 | G_DECLARE_DERIVABLE_TYPE (GgitCred, ggit_cred, GGIT, CRED, GgitNative) 32 | 33 | struct _GgitCredClass 34 | { 35 | /*< private >*/ 36 | GgitNativeClass parent_class; 37 | }; 38 | 39 | /** 40 | * GgitCredAcquireCallback: 41 | * @url: the resource for which we are demanding a credential. 42 | * @username_from_url: (allow-none): The username that was embedded in a "user@host" 43 | * remote url, or NULL if not included. 44 | * @allowed_types: a bitmask stating which cred types are OK to return. 45 | * @cred: (transfer full): newly created credential object. 46 | * @user_data: (closure): user-supplied data. 47 | * 48 | * Signature of a function which acquires a credential object. 49 | */ 50 | typedef gint (* GgitCredAcquireCallback) (const gchar *url, 51 | const gchar *username_from_url, 52 | guint allowed_types, 53 | GgitCred **cred, 54 | gpointer user_data); 55 | 56 | G_END_DECLS 57 | 58 | #endif /* __GGIT_CRED_H__ */ 59 | 60 | /* ex:set ts=8 noet: */ 61 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-diff-binary-file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-diff-binary-file.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2015 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_DIFF_BINARY_FILE_H__ 22 | #define __GGIT_DIFF_BINARY_FILE_H__ 23 | 24 | #include 25 | 26 | #include "ggit-types.h" 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GGIT_TYPE_DIFF_BINARY_FILE (ggit_diff_binary_file_get_type ()) 31 | #define GGIT_DIFF_BINARY_FILE(obj) ((GgitDiffBinaryFile *)obj) 32 | 33 | GType ggit_diff_binary_file_get_type (void) G_GNUC_CONST; 34 | 35 | GgitDiffBinaryFile *_ggit_diff_binary_file_wrap (const git_diff_binary_file *file); 36 | 37 | GgitDiffBinaryFile *ggit_diff_binary_file_ref (GgitDiffBinaryFile *file); 38 | void ggit_diff_binary_file_unref (GgitDiffBinaryFile *file); 39 | 40 | GgitDiffBinaryType ggit_diff_binary_file_get_binary_type (GgitDiffBinaryFile *file); 41 | 42 | const guint8 *ggit_diff_binary_file_get_data (GgitDiffBinaryFile *file, 43 | gsize *size); 44 | 45 | gsize ggit_diff_binary_file_get_inflated_size (GgitDiffBinaryFile *file); 46 | 47 | G_END_DECLS 48 | 49 | #endif /* __GGIT_DIFF_BINARY_FILE_H__ */ 50 | 51 | /* ex:set ts=8 noet: */ 52 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-diff-binary.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-diff-binary.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2015 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #include 22 | 23 | #include "ggit-diff-binary.h" 24 | #include "ggit-diff-binary-file.h" 25 | 26 | struct _GgitDiffBinary { 27 | gint ref_count; 28 | 29 | GgitDiffBinaryFile *old_file; 30 | GgitDiffBinaryFile *new_file; 31 | }; 32 | 33 | G_DEFINE_BOXED_TYPE (GgitDiffBinary, ggit_diff_binary, 34 | ggit_diff_binary_ref, ggit_diff_binary_unref) 35 | 36 | GgitDiffBinary * 37 | _ggit_diff_binary_wrap (const git_diff_binary *binary) 38 | { 39 | GgitDiffBinary *gbinary; 40 | 41 | g_return_val_if_fail (binary != NULL, NULL); 42 | 43 | gbinary = g_slice_new (GgitDiffBinary); 44 | gbinary->ref_count = 1; 45 | gbinary->old_file = _ggit_diff_binary_file_wrap (&binary->old_file); 46 | gbinary->new_file = _ggit_diff_binary_file_wrap (&binary->new_file); 47 | 48 | return gbinary; 49 | } 50 | 51 | /** 52 | * ggit_diff_binary_ref: 53 | * @binary: a #GgitDiffBinary. 54 | * 55 | * Atomically increments the reference count of @binary by one. 56 | * This function is MT-safe and may be called from any thread. 57 | * 58 | * Returns: (transfer none) (nullable): a #GgitDiffBinary or %NULL. 59 | **/ 60 | GgitDiffBinary * 61 | ggit_diff_binary_ref (GgitDiffBinary *binary) 62 | { 63 | g_return_val_if_fail (binary != NULL, NULL); 64 | 65 | g_atomic_int_inc (&binary->ref_count); 66 | 67 | return binary; 68 | } 69 | 70 | /** 71 | * ggit_diff_binary_unref: 72 | * @binary: a #GgitDiffBinary. 73 | * 74 | * Atomically decrements the reference count of @binary by one. 75 | * If the reference count drops to 0, @binary is freed. 76 | **/ 77 | void 78 | ggit_diff_binary_unref (GgitDiffBinary *binary) 79 | { 80 | g_return_if_fail (binary != NULL); 81 | 82 | if (g_atomic_int_dec_and_test (&binary->ref_count)) 83 | { 84 | ggit_diff_binary_file_unref (binary->old_file); 85 | ggit_diff_binary_file_unref (binary->new_file); 86 | g_slice_free (GgitDiffBinary, binary); 87 | } 88 | } 89 | 90 | /** 91 | * ggit_diff_binary_get_old_file: 92 | * @binary: a #GgitDiffBinary. 93 | * 94 | * Gets the #GgitDiffBinaryFile old file for @binary. 95 | * 96 | * Returns: (transfer none) (nullable): the contents of the old file or %NULL. 97 | */ 98 | GgitDiffBinaryFile * 99 | ggit_diff_binary_get_old_file (GgitDiffBinary *binary) 100 | { 101 | g_return_val_if_fail (binary != NULL, NULL); 102 | 103 | return binary->old_file; 104 | } 105 | 106 | /** 107 | * ggit_diff_binary_get_new_file: 108 | * @binary: a #GgitDiffBinary. 109 | * 110 | * Gets the #GgitDiffBinaryFile new file for @binary. 111 | * 112 | * Returns: (transfer none) (nullable): the contents of the new file or %NULL. 113 | */ 114 | GgitDiffBinaryFile * 115 | ggit_diff_binary_get_new_file (GgitDiffBinary *binary) 116 | { 117 | g_return_val_if_fail (binary != NULL, NULL); 118 | 119 | return binary->new_file; 120 | } 121 | 122 | /* ex:set ts=8 noet: */ 123 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-diff-binary.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-diff-binary.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2015 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_DIFF_BINARY_H__ 22 | #define __GGIT_DIFF_BINARY_H__ 23 | 24 | #include 25 | 26 | #include "ggit-types.h" 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GGIT_TYPE_DIFF_BINARY (ggit_diff_binary_get_type ()) 31 | #define GGIT_DIFF_BINARY(obj) ((GgitDiffBinary *)obj) 32 | 33 | GType ggit_diff_binary_get_type (void) G_GNUC_CONST; 34 | 35 | GgitDiffBinary *_ggit_diff_binary_wrap (const git_diff_binary *binary); 36 | 37 | GgitDiffBinary *ggit_diff_binary_ref (GgitDiffBinary *binary); 38 | void ggit_diff_binary_unref (GgitDiffBinary *binary); 39 | 40 | GgitDiffBinaryFile *ggit_diff_binary_get_old_file (GgitDiffBinary *binary); 41 | 42 | GgitDiffBinaryFile *ggit_diff_binary_get_new_file (GgitDiffBinary *binary); 43 | 44 | G_END_DECLS 45 | 46 | #endif /* __GGIT_DIFF_BINARY_H__ */ 47 | 48 | /* ex:set ts=8 noet: */ 49 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-diff-delta.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-diff-delta.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Garrett Regier 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_DIFF_DELTA_H__ 22 | #define __GGIT_DIFF_DELTA_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include "ggit-types.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_DIFF_DELTA (ggit_diff_delta_get_type ()) 32 | #define GGIT_DIFF_DELTA(obj) ((GgitDiffDelta *)obj) 33 | 34 | GType ggit_diff_delta_get_type (void) G_GNUC_CONST; 35 | 36 | GgitDiffDelta *_ggit_diff_delta_wrap (const git_diff_delta *delta); 37 | 38 | GgitDiffDelta *ggit_diff_delta_ref (GgitDiffDelta *delta); 39 | void ggit_diff_delta_unref (GgitDiffDelta *delta); 40 | 41 | GgitDiffFile *ggit_diff_delta_get_old_file (GgitDiffDelta *delta); 42 | GgitDiffFile *ggit_diff_delta_get_new_file (GgitDiffDelta *delta); 43 | GgitDeltaType ggit_diff_delta_get_status (GgitDiffDelta *delta); 44 | guint ggit_diff_delta_get_similarity (GgitDiffDelta *delta); 45 | GgitDiffFlag ggit_diff_delta_get_flags (GgitDiffDelta *delta); 46 | 47 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitDiffDelta, ggit_diff_delta_unref) 48 | 49 | G_END_DECLS 50 | 51 | #endif /* __GGIT_DIFF_DELTA_H__ */ 52 | 53 | /* ex:set ts=8 noet: */ 54 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-diff-file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-diff-file.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Garrett Regier 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_DIFF_FILE_H__ 22 | #define __GGIT_DIFF_FILE_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include "ggit-types.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_DIFF_FILE (ggit_diff_file_get_type ()) 32 | #define GGIT_DIFF_FILE(obj) ((GgitDiffFile *)obj) 33 | 34 | GType ggit_diff_file_get_type (void) G_GNUC_CONST; 35 | 36 | GgitDiffFile *_ggit_diff_file_wrap (const git_diff_file *file); 37 | 38 | GgitDiffFile *ggit_diff_file_ref (GgitDiffFile *file); 39 | void ggit_diff_file_unref (GgitDiffFile *file); 40 | 41 | GgitOId *ggit_diff_file_get_oid (GgitDiffFile *file); 42 | const gchar *ggit_diff_file_get_path (GgitDiffFile *file); 43 | guint16 ggit_diff_file_get_mode (GgitDiffFile *file); 44 | gint64 ggit_diff_file_get_size (GgitDiffFile *file); 45 | GgitDiffFlag ggit_diff_file_get_flags (GgitDiffFile *file); 46 | 47 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitDiffFile, ggit_diff_file_unref) 48 | 49 | G_END_DECLS 50 | 51 | #endif /* __GGIT_DIFF_FILE_H__ */ 52 | 53 | /* ex:set ts=8 noet: */ 54 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-diff-find-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-diff-find-options.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2014 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_DIFF_FIND_OPTIONS_H__ 22 | #define __GGIT_DIFF_FIND_OPTIONS_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include "ggit-types.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_DIFF_FIND_OPTIONS (ggit_diff_find_options_get_type ()) 32 | G_DECLARE_DERIVABLE_TYPE (GgitDiffFindOptions, ggit_diff_find_options, GGIT, DIFF_FIND_OPTIONS, GObject) 33 | 34 | struct _GgitDiffFindOptionsClass 35 | { 36 | GObjectClass parent_class; 37 | }; 38 | 39 | const git_diff_find_options * 40 | _ggit_diff_find_options_get_diff_find_options ( 41 | GgitDiffFindOptions *options); 42 | 43 | GgitDiffFindOptions *ggit_diff_find_options_new (void); 44 | 45 | GgitDiffFindFlags ggit_diff_find_options_get_flags (GgitDiffFindOptions *options); 46 | void ggit_diff_find_options_set_flags (GgitDiffFindOptions *options, 47 | GgitDiffFindFlags flags); 48 | 49 | guint ggit_diff_find_options_get_rename_threshold ( 50 | GgitDiffFindOptions *options); 51 | 52 | void ggit_diff_find_options_set_rename_threshold ( 53 | GgitDiffFindOptions *options, 54 | guint threshold); 55 | 56 | guint ggit_diff_find_options_get_rename_from_rewrite_threshold ( 57 | GgitDiffFindOptions *options); 58 | 59 | void ggit_diff_find_options_set_rename_from_rewrite_threshold ( 60 | GgitDiffFindOptions *options, 61 | guint threshold); 62 | 63 | guint ggit_diff_find_options_get_copy_threshold ( 64 | GgitDiffFindOptions *options); 65 | 66 | void ggit_diff_find_options_set_copy_threshold ( 67 | GgitDiffFindOptions *options, 68 | guint threshold); 69 | 70 | gsize ggit_diff_find_options_get_rename_limit ( 71 | GgitDiffFindOptions *options); 72 | 73 | void ggit_diff_find_options_set_rename_limit ( 74 | GgitDiffFindOptions *options, 75 | gsize limit); 76 | 77 | GgitDiffSimilarityMetric * 78 | ggit_diff_find_options_get_metric ( 79 | GgitDiffFindOptions *options); 80 | 81 | void ggit_diff_find_options_set_metric ( 82 | GgitDiffFindOptions *options, 83 | GgitDiffSimilarityMetric *metric); 84 | 85 | G_END_DECLS 86 | 87 | #endif /* __GGIT_DIFF_FIND_OPTIONS_H__ */ 88 | 89 | /* ex:set ts=8 noet: */ 90 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-diff-hunk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-diff-hunk.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Garrett Regier 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_DIFF_HUNK_H__ 22 | #define __GGIT_DIFF_HUNK_H__ 23 | 24 | #include 25 | #include 26 | #include "ggit-types.h" 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GGIT_TYPE_DIFF_HUNK (ggit_diff_hunk_get_type ()) 31 | #define GGIT_DIFF_HUNK(obj) ((GgitDiffHunk *)obj) 32 | 33 | GType ggit_diff_hunk_get_type (void) G_GNUC_CONST; 34 | 35 | GgitDiffHunk *_ggit_diff_hunk_wrap (const git_diff_hunk *hunk); 36 | 37 | GgitDiffHunk *ggit_diff_hunk_ref (GgitDiffHunk *hunk); 38 | void ggit_diff_hunk_unref (GgitDiffHunk *hunk); 39 | 40 | gint ggit_diff_hunk_get_old_start (GgitDiffHunk *hunk); 41 | gint ggit_diff_hunk_get_old_lines (GgitDiffHunk *hunk); 42 | gint ggit_diff_hunk_get_new_start (GgitDiffHunk *hunk); 43 | gint ggit_diff_hunk_get_new_lines (GgitDiffHunk *hunk); 44 | const gchar *ggit_diff_hunk_get_header (GgitDiffHunk *hunk); 45 | 46 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitDiffHunk, ggit_diff_hunk_unref) 47 | 48 | G_END_DECLS 49 | 50 | #endif /* __GGIT_DIFF_HUNK_H__ */ 51 | 52 | /* ex:set ts=8 noet: */ 53 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-diff-line.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-diff-line.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Garrett Regier 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_DIFF_LINE_H__ 22 | #define __GGIT_DIFF_LINE_H__ 23 | 24 | #include 25 | #include 26 | #include "ggit-types.h" 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GGIT_TYPE_DIFF_LINE (ggit_diff_line_get_type ()) 31 | #define GGIT_DIFF_LINE(obj) ((GgitDiffLine *)obj) 32 | 33 | GType ggit_diff_line_get_type (void) G_GNUC_CONST; 34 | 35 | GgitDiffLine *_ggit_diff_line_wrap (const git_diff_line *line, 36 | const gchar *encoding); 37 | 38 | GgitDiffLine *ggit_diff_line_ref (GgitDiffLine *line); 39 | void ggit_diff_line_unref (GgitDiffLine *line); 40 | 41 | GgitDiffLineType ggit_diff_line_get_origin (GgitDiffLine *line); 42 | gint ggit_diff_line_get_old_lineno (GgitDiffLine *line); 43 | gint ggit_diff_line_get_new_lineno (GgitDiffLine *line); 44 | gint64 ggit_diff_line_get_content_offset (GgitDiffLine *line); 45 | 46 | const guint8 *ggit_diff_line_get_content (GgitDiffLine *line, 47 | gsize *length); 48 | 49 | const gchar *ggit_diff_line_get_text (GgitDiffLine *line); 50 | 51 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitDiffLine, ggit_diff_line_unref) 52 | 53 | G_END_DECLS 54 | 55 | #endif /* __GGIT_DIFF_LINE_H__ */ 56 | 57 | /* ex:set ts=8 noet: */ 58 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-diff-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-diff-options.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Garrett Regier 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_DIFF_OPTIONS_H__ 22 | #define __GGIT_DIFF_OPTIONS_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include "ggit-types.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_DIFF_OPTIONS (ggit_diff_options_get_type ()) 32 | G_DECLARE_DERIVABLE_TYPE (GgitDiffOptions, ggit_diff_options, GGIT, DIFF_OPTIONS, GObject) 33 | 34 | struct _GgitDiffOptionsClass 35 | { 36 | GObjectClass parent_class; 37 | }; 38 | 39 | const git_diff_options * 40 | _ggit_diff_options_get_diff_options (GgitDiffOptions *options); 41 | 42 | GgitDiffOptions *ggit_diff_options_new (void); 43 | 44 | GgitDiffOption ggit_diff_options_get_flags (GgitDiffOptions *options); 45 | void ggit_diff_options_set_flags (GgitDiffOptions *options, 46 | GgitDiffOption flags); 47 | 48 | gint ggit_diff_options_get_n_context_lines (GgitDiffOptions *options); 49 | void ggit_diff_options_set_n_context_lines (GgitDiffOptions *options, 50 | gint n); 51 | 52 | gint ggit_diff_options_get_n_interhunk_lines (GgitDiffOptions *options); 53 | void ggit_diff_options_set_n_interhunk_lines (GgitDiffOptions *options, 54 | gint n); 55 | 56 | const gchar *ggit_diff_options_get_old_prefix (GgitDiffOptions *options); 57 | void ggit_diff_options_set_old_prefix (GgitDiffOptions *options, 58 | const gchar *prefix); 59 | 60 | const gchar *ggit_diff_options_get_new_prefix (GgitDiffOptions *options); 61 | void ggit_diff_options_set_new_prefix (GgitDiffOptions *options, 62 | const gchar *prefix); 63 | 64 | const gchar **ggit_diff_options_get_pathspec (GgitDiffOptions *options); 65 | void ggit_diff_options_set_pathspec (GgitDiffOptions *options, 66 | const gchar **pathspec); 67 | 68 | G_END_DECLS 69 | 70 | #endif /* __GGIT_DIFF_OPTIONS_H__ */ 71 | 72 | /* ex:set ts=8 noet: */ 73 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-diff-similarity-metric.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-diff-similarity-metric.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_DIFF_SIMILARITY_METRIC_H__ 23 | #define __GGIT_DIFF_SIMILARITY_METRIC_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "ggit-types.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_DIFF_SIMILARITY_METRIC (ggit_diff_similarity_metric_get_type ()) 33 | #define GGIT_DIFF_SIMILARITY_METRIC(obj) ((GgitDiffSimilarityMetric *)obj) 34 | 35 | GType ggit_diff_similarity_metric_get_type (void) G_GNUC_CONST; 36 | 37 | git_diff_similarity_metric * 38 | _ggit_diff_similarity_metric_get_similarity_metric (GgitDiffSimilarityMetric *metric); 39 | 40 | GgitDiffSimilarityMetric *ggit_diff_similarity_metric_copy (GgitDiffSimilarityMetric *metric); 41 | void ggit_diff_similarity_metric_free (GgitDiffSimilarityMetric *metric); 42 | 43 | GgitDiffSimilarityMetric *ggit_diff_similarity_metric_new (GgitDiffSimilarityMetricFileSignatureCallback file_signature, 44 | GgitDiffSimilarityMetricBufferSignatureCallback buffer_signature, 45 | GgitDiffSimilarityMetricFreeSignatureCallback free_signature, 46 | GgitDiffSimilarityMetricSimilarityCallback similarity, 47 | gpointer user_data); 48 | 49 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitDiffSimilarityMetric, ggit_diff_similarity_metric_free) 50 | 51 | G_END_DECLS 52 | 53 | #endif /* __GGIT_DIFF_SIMILARITY_METRIC_H__ */ 54 | 55 | /* ex:set ts=8 noet: */ 56 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-error.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-error.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #include 23 | #include 24 | 25 | #include "ggit-error.h" 26 | 27 | /** 28 | * ggit_error_quark: 29 | * 30 | * Error domain for Ggit functions. 31 | * Errors in this domain will be from the GgitError enumeration. 32 | * See #GError for information on error domains. 33 | */ 34 | GQuark 35 | ggit_error_quark (void) 36 | { 37 | static GQuark quark = 0; 38 | 39 | if (G_UNLIKELY (quark == 0)) 40 | quark = g_quark_from_static_string ("ggit-error"); 41 | 42 | return quark; 43 | } 44 | 45 | void 46 | _ggit_error_set (GError **error, 47 | gint err) 48 | { 49 | const git_error *git2_err; 50 | 51 | g_return_if_fail (err < 0); 52 | 53 | /* TODO: add more kind of errors, see git_error_t */ 54 | #if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28) 55 | git2_err = git_error_last (); 56 | #else 57 | git2_err = giterr_last (); 58 | #endif 59 | g_set_error_literal (error, GGIT_ERROR, 60 | err, 61 | git2_err == NULL ? "" : git2_err->message); 62 | } 63 | 64 | /* ex:set ts=8 noet: */ 65 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-error.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_ERROR_H__ 22 | #define __GGIT_ERROR_H__ 23 | 24 | #include 25 | 26 | #include "ggit-types.h" 27 | 28 | G_BEGIN_DECLS 29 | 30 | /** 31 | * GGIT_ERROR: 32 | * 33 | * Error domain for Ggit. Errors in this domain will 34 | * be from the GgitError enumeration. See #GError for 35 | * more information on error domains. 36 | */ 37 | #define GGIT_ERROR ggit_error_quark () 38 | 39 | GQuark ggit_error_quark (void); 40 | 41 | void _ggit_error_set (GError **error, 42 | gint err); 43 | 44 | G_END_DECLS 45 | 46 | #endif /* __GGIT_ERROR_H__ */ 47 | 48 | /* ex:set ts=8 noet: */ 49 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-fetch-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-fetch-options.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2015 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_FETCH_OPTIONS_H__ 23 | #define __GGIT_FETCH_OPTIONS_H__ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_FETCH_OPTIONS (ggit_fetch_options_get_type ()) 32 | #define GGIT_FETCH_OPTIONS(obj) ((GgitFetchOptions *)obj) 33 | 34 | GType ggit_fetch_options_get_type (void) G_GNUC_CONST; 35 | 36 | const git_fetch_options *_ggit_fetch_options_get_fetch_options (GgitFetchOptions *fetch_options); 37 | 38 | GgitFetchOptions *ggit_fetch_options_copy (GgitFetchOptions *fetch_options); 39 | void ggit_fetch_options_free (GgitFetchOptions *fetch_options); 40 | 41 | GgitFetchOptions *ggit_fetch_options_new (void); 42 | 43 | GgitRemoteCallbacks *ggit_fetch_options_get_remote_callbacks (GgitFetchOptions *options); 44 | void ggit_fetch_options_set_remote_callbacks (GgitFetchOptions *options, 45 | GgitRemoteCallbacks *callbacks); 46 | 47 | GgitRemoteDownloadTagsType ggit_fetch_options_get_download_tags (GgitFetchOptions *options); 48 | void ggit_fetch_options_set_download_tags (GgitFetchOptions *options, 49 | GgitRemoteDownloadTagsType download_tags); 50 | 51 | G_END_DECLS 52 | 53 | #endif /* __GGIT_FETCH_OPTIONS_H__ */ 54 | 55 | /* ex:set ts=8 noet: */ 56 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-index-entry-resolve-undo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-index-entry-resolve-undo.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_INDEX_ENTRY_RESOLVE_UNDO_H__ 22 | #define __GGIT_INDEX_ENTRY_RESOLVE_UNDO_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_INDEX_ENTRY_RESOLVE_UNDO (ggit_index_entry_resolve_undo_get_type ()) 33 | #define GGIT_INDEX_ENTRY_RESOLVE_UNDO(obj) ((GgitIndexEntryResolveUndo *)obj) 34 | 35 | #define GGIT_TYPE_INDEX_ENTRIES_RESOLVE_UNDO (ggit_index_entries_resolve_undo_get_type ()) 36 | #define GGIT_INDEX_ENTRIES_RESOLVE_UNDO(obj) ((GgitIndexEntriesResolveUndo *)obj) 37 | 38 | GgitIndexEntriesResolveUndo * 39 | _ggit_index_entries_resolve_undo_wrap (GgitIndex *owner); 40 | 41 | GgitIndexEntryResolveUndo * 42 | ggit_index_entries_resolve_undo_get (GgitIndexEntriesResolveUndo *entries, 43 | guint idx); 44 | 45 | GgitIndexEntryResolveUndo * 46 | ggit_index_entries_resolve_undo_get_by_file (GgitIndexEntriesResolveUndo *entries, 47 | GFile *file); 48 | 49 | GType ggit_index_entries_resolve_undo_get_type (void) G_GNUC_CONST; 50 | 51 | GgitIndexEntriesResolveUndo * 52 | ggit_index_entries_resolve_undo_ref (GgitIndexEntriesResolveUndo *entries); 53 | void ggit_index_entries_resolve_undo_unref (GgitIndexEntriesResolveUndo *entries); 54 | guint ggit_index_entries_resolve_undo_size (GgitIndexEntriesResolveUndo *entries); 55 | 56 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitIndexEntriesResolveUndo, ggit_index_entries_resolve_undo_unref) 57 | 58 | GType ggit_index_entry_resolve_undo_get_type (void) G_GNUC_CONST; 59 | 60 | GgitIndexEntryResolveUndo * 61 | ggit_index_entry_resolve_undo_ref (GgitIndexEntryResolveUndo *entry); 62 | void ggit_index_entry_resolve_undo_unref (GgitIndexEntryResolveUndo *entry); 63 | 64 | guint ggit_index_entry_resolve_undo_get_mode (GgitIndexEntryResolveUndo *entry, 65 | gint stage); 66 | 67 | GgitOId *ggit_index_entry_resolve_undo_get_id (GgitIndexEntryResolveUndo *entry, 68 | gint stage); 69 | 70 | GFile *ggit_index_entry_resolve_undo_get_file (GgitIndexEntryResolveUndo *entry); 71 | 72 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitIndexEntryResolveUndo, ggit_index_entry_resolve_undo_unref) 73 | 74 | G_END_DECLS 75 | 76 | #endif /* __GGIT_INDEX_ENTRY_RESOLVE_UNDO_H__ */ 77 | 78 | /* ex:set ts=8 noet: */ 79 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-index.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-index.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_INDEX_H__ 22 | #define __GGIT_INDEX_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include "ggit-native.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_INDEX (ggit_index_get_type ()) 33 | G_DECLARE_FINAL_TYPE (GgitIndex, ggit_index, GGIT, INDEX, GgitNative) 34 | 35 | git_index *_ggit_index_get_index (GgitIndex *idx); 36 | GgitIndex *_ggit_index_wrap (git_index *idx); 37 | 38 | GgitIndex *ggit_index_open (GFile *file, 39 | GError **error); 40 | 41 | gboolean ggit_index_read (GgitIndex *idx, 42 | gboolean force, 43 | GError **error); 44 | 45 | gboolean ggit_index_write (GgitIndex *idx, 46 | GError **error); 47 | 48 | GgitOId *ggit_index_write_tree (GgitIndex *idx, 49 | GError **error); 50 | 51 | GgitOId *ggit_index_write_tree_to (GgitIndex *idx, 52 | GgitRepository *repository, 53 | GError **error); 54 | 55 | gboolean ggit_index_remove (GgitIndex *idx, 56 | GFile *file, 57 | gint stage, 58 | GError **error); 59 | 60 | gboolean ggit_index_add (GgitIndex *idx, 61 | GgitIndexEntry *entry, 62 | GError **error); 63 | 64 | gboolean ggit_index_add_file (GgitIndex *idx, 65 | GFile *file, 66 | GError **error); 67 | 68 | gboolean ggit_index_add_path (GgitIndex *idx, 69 | const gchar *path, 70 | GError **error); 71 | 72 | GgitRepository *ggit_index_get_owner (GgitIndex *idx); 73 | 74 | gboolean ggit_index_has_conflicts (GgitIndex *idx); 75 | 76 | GgitIndexEntries *ggit_index_get_entries (GgitIndex *idx); 77 | GgitIndexEntriesResolveUndo * 78 | ggit_index_get_entries_resolve_undo (GgitIndex *idx); 79 | 80 | G_END_DECLS 81 | 82 | #endif /* __GGIT_INDEX_H__ */ 83 | 84 | /* ex:set ts=8 noet: */ 85 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-mailmap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-mailmap.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2021 - Liliana Marie Prikler 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_MAILMAP_H__ 22 | #define __GGIT_MAILMAP_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_MAILMAP (ggit_mailmap_get_type ()) 33 | G_DECLARE_FINAL_TYPE (GgitMailmap, ggit_mailmap, GGIT, MAILMAP, GgitNative) 34 | 35 | GgitMailmap *_ggit_mailmap_wrap (const git_mailmap *mailmap, 36 | gboolean owned); 37 | 38 | GgitMailmap *ggit_mailmap_new (GError **error); 39 | GgitMailmap *ggit_mailmap_new_from_repository (GgitRepository *repository, 40 | GError **error); 41 | 42 | void ggit_mailmap_add_entry (GgitMailmap *mailmap, 43 | const gchar *real_name, 44 | const gchar *real_email, 45 | const gchar *replace_name, 46 | const gchar *replace_email, 47 | GError **error); 48 | 49 | void ggit_mailmap_resolve (GgitMailmap *mailmap, 50 | const gchar **real_name, 51 | const gchar **real_email, 52 | const gchar *replace_name, 53 | const gchar *replace_email, 54 | GError **error); 55 | 56 | 57 | GgitSignature *ggit_mailmap_resolve_signature (GgitMailmap *mailmap, 58 | GgitSignature *signature, 59 | GError **error); 60 | 61 | G_END_DECLS 62 | 63 | #endif /* __GGIT_MAILMAP_H__ */ 64 | 65 | /* ex:set ts=8 noet: */ 66 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-main.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Garrett Regier 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #include 22 | 23 | #include "ggit-main.h" 24 | 25 | /** 26 | * ggit_get_features: 27 | * 28 | * Gets the features of the library. 29 | * 30 | * Returns: a #GgitFeatureFlags. 31 | */ 32 | GgitFeatureFlags 33 | ggit_get_features (void) 34 | { 35 | return git_libgit2_features (); 36 | } 37 | 38 | /** 39 | * ggit_init: 40 | * 41 | * Call this function before using any other libgit2-glib function. 42 | */ 43 | void 44 | ggit_init (void) 45 | { 46 | git_libgit2_init (); 47 | } 48 | 49 | /* ex:set ts=8 noet: */ 50 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-main.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-main.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Garrett Regier 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_MAIN_H__ 22 | #define __GGIT_MAIN_H__ 23 | 24 | #include 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | GgitFeatureFlags ggit_get_features (void); 30 | 31 | void ggit_init (void); 32 | 33 | G_END_DECLS 34 | 35 | #endif /* __GGIT_MAIN_H__ */ 36 | 37 | /* ex:set ts=8 noet: */ 38 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-merge-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-merge-options.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_MERGE_OPTIONS_H__ 23 | #define __GGIT_MERGE_OPTIONS_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "ggit-types.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_MERGE_OPTIONS (ggit_merge_options_get_type ()) 33 | #define GGIT_MERGE_OPTIONS(obj) ((GgitMergeOptions *)obj) 34 | 35 | GType ggit_merge_options_get_type (void) G_GNUC_CONST; 36 | 37 | const git_merge_options * 38 | _ggit_merge_options_get_merge_options (GgitMergeOptions *merge_options); 39 | 40 | GgitMergeOptions *ggit_merge_options_copy (GgitMergeOptions *merge_options); 41 | void ggit_merge_options_free (GgitMergeOptions *merge_options); 42 | 43 | GgitMergeOptions *ggit_merge_options_new (void); 44 | 45 | void ggit_merge_options_set_flags (GgitMergeOptions *merge_options, 46 | GgitMergeFlags flags); 47 | 48 | GgitMergeFlags ggit_merge_options_get_flags (GgitMergeOptions *merge_options); 49 | 50 | void ggit_merge_options_set_rename_threshold (GgitMergeOptions *merge_options, 51 | guint rename_threshold); 52 | 53 | guint ggit_merge_options_get_rename_threshold (GgitMergeOptions *merge_options); 54 | 55 | void ggit_merge_options_set_target_limit (GgitMergeOptions *merge_options, 56 | guint target_limit); 57 | 58 | guint ggit_merge_options_get_target_limit (GgitMergeOptions *merge_options); 59 | 60 | void ggit_merge_options_set_similarity_metric (GgitMergeOptions *merge_options, 61 | GgitDiffSimilarityMetric *metric); 62 | 63 | GgitDiffSimilarityMetric * 64 | ggit_merge_options_get_similarity_metric (GgitMergeOptions *merge_options); 65 | 66 | void ggit_merge_options_set_file_favor (GgitMergeOptions *merge_options, 67 | GgitMergeFileFavor file_favor); 68 | 69 | GgitMergeFileFavor ggit_merge_options_get_file_favor (GgitMergeOptions *merge_options); 70 | 71 | void ggit_merge_options_set_file_flags (GgitMergeOptions *merge_options, 72 | GgitMergeFileFlags file_flags); 73 | 74 | GgitMergeFileFlags ggit_merge_options_get_file_flags (GgitMergeOptions *merge_options); 75 | 76 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitMergeOptions, ggit_merge_options_free) 77 | 78 | G_END_DECLS 79 | 80 | #endif /* __GGIT_MERGE_OPTIONS_H__ */ 81 | 82 | /* ex:set ts=8 noet: */ 83 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-message.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-message.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #include "ggit-message.h" 22 | #include 23 | #include 24 | 25 | /** 26 | * ggit_message_prettify: 27 | * @message: the message. 28 | * @strip_comments: whether to strip comments. 29 | * @comment_char: comment character. 30 | * 31 | * Prettify a commit message by removing excess whitespace and making sure the 32 | * last line ends with a newline. If @strip_comments is %TRUE, then lines 33 | * starting with a @comment_char will be removed. 34 | * 35 | * Returns: the prettified message. 36 | * 37 | */ 38 | gchar * 39 | ggit_message_prettify (const gchar *message, 40 | gboolean strip_comments, 41 | gchar comment_char) 42 | { 43 | git_buf buf = {0,}; 44 | gchar *d; 45 | 46 | git_message_prettify (&buf, message, strip_comments, comment_char); 47 | 48 | d = g_strdup (buf.ptr); 49 | #if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28) 50 | git_buf_dispose (&buf); 51 | #else 52 | git_buf_free (&buf); 53 | #endif 54 | 55 | return d; 56 | } 57 | 58 | /* ex:set ts=8 noet: */ 59 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-message.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-message.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_MESSAGE_H__ 22 | #define __GGIT_MESSAGE_H__ 23 | 24 | #include 25 | 26 | G_BEGIN_DECLS 27 | 28 | gchar *ggit_message_prettify (const gchar *message, 29 | gboolean strip_comments, 30 | gchar comment_char); 31 | 32 | G_END_DECLS 33 | 34 | #endif /* __GGIT_MESSAGE_H__ */ 35 | 36 | /* ex:set ts=8 noet: */ 37 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-native.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-native.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_NATIVE_H__ 22 | #define __GGIT_NATIVE_H__ 23 | 24 | #include 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define GGIT_TYPE_NATIVE (ggit_native_get_type ()) 30 | G_DECLARE_DERIVABLE_TYPE (GgitNative, ggit_native, GGIT, NATIVE, GgitObjectFactoryBase) 31 | 32 | /** 33 | * GgitNativeClass: 34 | * @parent_class: The parent class. 35 | * 36 | * The class structure for #GgitNativeClass. 37 | */ 38 | struct _GgitNativeClass 39 | { 40 | /*< private >*/ 41 | GgitObjectFactoryBaseClass parent_class; 42 | }; 43 | 44 | gpointer _ggit_native_get (gpointer self); 45 | 46 | void _ggit_native_set (gpointer self, 47 | gpointer native, 48 | GDestroyNotify destroy_notify); 49 | 50 | gpointer _ggit_native_release (gpointer self); 51 | 52 | void _ggit_native_set_destroy_func (gpointer self, 53 | GDestroyNotify destroy_notify); 54 | 55 | G_END_DECLS 56 | 57 | #endif /* __GGIT_NATIVE_H__ */ 58 | 59 | /* ex:set ts=8 noet: */ 60 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-note.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-note.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2014 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #include "ggit-note.h" 22 | #include "ggit-oid.h" 23 | 24 | struct _GgitNote 25 | { 26 | gint ref_count; 27 | 28 | git_note *note; 29 | GgitOId *id; 30 | }; 31 | 32 | G_DEFINE_BOXED_TYPE (GgitNote, ggit_note, 33 | ggit_note_ref, ggit_note_unref) 34 | 35 | GgitNote * 36 | _ggit_note_wrap (git_note *note) 37 | { 38 | GgitNote *gnote; 39 | 40 | g_return_val_if_fail (note != NULL, NULL); 41 | 42 | gnote = g_slice_new (GgitNote); 43 | gnote->ref_count = 1; 44 | gnote->note = note; 45 | gnote->id = _ggit_oid_wrap (git_note_id (note)); 46 | 47 | return gnote; 48 | } 49 | 50 | /** 51 | * ggit_note_ref: 52 | * @note: a #GgitNote. 53 | * 54 | * Atomically increments the reference count of @note by one. 55 | * This function is MT-safe and may be called from any thread. 56 | * 57 | * Returns: (transfer none) (nullable): a #GgitNote or %NULL. 58 | **/ 59 | GgitNote * 60 | ggit_note_ref (GgitNote *note) 61 | { 62 | g_return_val_if_fail (note != NULL, NULL); 63 | 64 | g_atomic_int_inc (¬e->ref_count); 65 | 66 | return note; 67 | } 68 | 69 | /** 70 | * ggit_note_unref: 71 | * @note: a #GgitNote. 72 | * 73 | * Atomically decrements the reference count of @note by one. 74 | * If the reference count drops to 0, @note is freed. 75 | **/ 76 | void 77 | ggit_note_unref (GgitNote *note) 78 | { 79 | g_return_if_fail (note != NULL); 80 | 81 | if (g_atomic_int_dec_and_test (¬e->ref_count)) 82 | { 83 | git_note_free (note->note); 84 | ggit_oid_free (note->id); 85 | g_slice_free (GgitNote, note); 86 | } 87 | } 88 | 89 | /** 90 | * ggit_note_get_message: 91 | * @note: a #GgitNote. 92 | * 93 | * Gets the note message. 94 | * 95 | * Returns: (transfer none) (nullable): the note message or %NULL. 96 | */ 97 | const gchar * 98 | ggit_note_get_message (GgitNote *note) 99 | { 100 | g_return_val_if_fail (note != NULL, NULL); 101 | 102 | return git_note_message (note->note); 103 | } 104 | 105 | /** 106 | * ggit_note_get_id: 107 | * @note: a #GgitNote. 108 | * 109 | * Gets the note object's id. 110 | * 111 | * Returns: (transfer none) (nullable): the object's id or %NULL. 112 | */ 113 | GgitOId * 114 | ggit_note_get_id (GgitNote *note) 115 | { 116 | g_return_val_if_fail (note != NULL, NULL); 117 | 118 | return note->id; 119 | } 120 | 121 | /* ex:set ts=8 noet: */ 122 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-note.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-note.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2014 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_NOTE_H__ 22 | #define __GGIT_NOTE_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include "ggit-types.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_NOTE (ggit_note_get_type ()) 32 | #define GGIT_NOTE(obj) ((GgitNote *)obj) 33 | 34 | GType ggit_note_get_type (void) G_GNUC_CONST; 35 | 36 | GgitNote *_ggit_note_wrap (git_note *note); 37 | 38 | GgitNote *ggit_note_ref (GgitNote *note); 39 | void ggit_note_unref (GgitNote *note); 40 | 41 | const gchar *ggit_note_get_message (GgitNote *note); 42 | 43 | GgitOId *ggit_note_get_id (GgitNote *note); 44 | 45 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitNote, ggit_note_unref) 46 | 47 | G_END_DECLS 48 | 49 | #endif /* __GGIT_NOTE_H__ */ 50 | 51 | /* ex:set ts=8 noet: */ 52 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-object-factory-base.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-object-factory-base.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #include "ggit-object-factory-base.h" 22 | #include "ggit-object-factory.h" 23 | 24 | /** 25 | * GgitObjectFactoryBase: 26 | * 27 | * Represents the base type for objects created by an object factory. 28 | */ 29 | 30 | G_DEFINE_ABSTRACT_TYPE (GgitObjectFactoryBase, ggit_object_factory_base, G_TYPE_OBJECT) 31 | 32 | static GObject * 33 | ggit_object_factory_base_constructor (GType type, 34 | guint n_construct_properties, 35 | GObjectConstructParam *construct_properties) 36 | { 37 | return ggit_object_factory_construct (ggit_object_factory_get_default (), 38 | ggit_object_factory_base_parent_class, 39 | type, 40 | n_construct_properties, 41 | construct_properties); 42 | } 43 | 44 | static void 45 | ggit_object_factory_base_class_init (GgitObjectFactoryBaseClass *klass) 46 | { 47 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 48 | 49 | object_class->constructor = ggit_object_factory_base_constructor; 50 | } 51 | 52 | static void 53 | ggit_object_factory_base_init (GgitObjectFactoryBase *self) 54 | { 55 | } 56 | 57 | /* ex:set ts=8 noet: */ 58 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-object-factory-base.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-object-factory-base.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_OBJECT_FACTORY_BASE_H__ 22 | #define __GGIT_OBJECT_FACTORY_BASE_H__ 23 | 24 | #include 25 | 26 | #include "ggit-types.h" 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GGIT_TYPE_OBJECT_FACTORY_BASE (ggit_object_factory_base_get_type ()) 31 | G_DECLARE_DERIVABLE_TYPE (GgitObjectFactoryBase, ggit_object_factory_base, GGIT, OBJECT_FACTORY_BASE, GObject) 32 | 33 | /** 34 | * GgitObjectFactoryBaseClass: 35 | * @parent_class: The parent class. 36 | * 37 | * The class structure for #GgitObjectFactoryBaseClass. 38 | */ 39 | struct _GgitObjectFactoryBaseClass 40 | { 41 | /*< private >*/ 42 | GObjectClass parent_class; 43 | }; 44 | 45 | G_END_DECLS 46 | 47 | #endif /* __GGIT_OBJECT_FACTORY_BASE_H__ */ 48 | 49 | /* ex:set ts=8 noet: */ 50 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-object-factory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-object-factory.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_OBJECT_FACTORY_H__ 22 | #define __GGIT_OBJECT_FACTORY_H__ 23 | 24 | #include 25 | 26 | #include "ggit-types.h" 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GGIT_TYPE_OBJECT_FACTORY (ggit_object_factory_get_type ()) 31 | G_DECLARE_FINAL_TYPE (GgitObjectFactory, ggit_object_factory, GGIT, OBJECT_FACTORY, GObject) 32 | 33 | GgitObjectFactory *ggit_object_factory_get_default (void); 34 | 35 | void ggit_object_factory_register (GgitObjectFactory *factory, 36 | GType basetype, 37 | GType subtype); 38 | 39 | void ggit_object_factory_unregister (GgitObjectFactory *factory, 40 | GType basetype, 41 | GType subtype); 42 | 43 | GObject *ggit_object_factory_construct (GgitObjectFactory *factory, 44 | GObjectClass *parent_class, 45 | GType basetype, 46 | guint n_construct_properties, 47 | GObjectConstructParam *construct_properties); 48 | 49 | 50 | G_END_DECLS 51 | 52 | #endif /* __GGIT_OBJECT_FACTORY_H__ */ 53 | 54 | /* ex:set ts=8 noet: */ 55 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-object.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-object.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #include "ggit-object.h" 23 | #include "ggit-oid.h" 24 | #include "ggit-repository.h" 25 | 26 | /** 27 | * GgitObject: 28 | * 29 | * Represents a generic object in a repository. 30 | */ 31 | 32 | G_DEFINE_ABSTRACT_TYPE (GgitObject, ggit_object, GGIT_TYPE_NATIVE) 33 | 34 | static void 35 | ggit_object_class_init (GgitObjectClass *klass) 36 | { 37 | } 38 | 39 | static void 40 | ggit_object_init (GgitObject *object) 41 | { 42 | } 43 | 44 | /** 45 | * ggit_object_get_id: 46 | * @object: a #GgitObject. 47 | * 48 | * Gets the #GgitOId of @object. 49 | * 50 | * Returns: (transfer full) (nullable): the #GgitOId of the object or %NULL. 51 | */ 52 | GgitOId * 53 | ggit_object_get_id (GgitObject *object) 54 | { 55 | const git_oid *oid; 56 | 57 | g_return_val_if_fail (GGIT_IS_OBJECT (object), NULL); 58 | 59 | oid = git_object_id (_ggit_native_get (object)); 60 | 61 | return _ggit_oid_wrap ((git_oid *)oid); 62 | } 63 | 64 | /** 65 | * ggit_object_get_owner: 66 | * @object: a #GgitObject. 67 | * 68 | * Gets the #GgitRepository that owns @object. 69 | * 70 | * Returns: (transfer full) (nullable): the #GgitRepository that owns this object or %NULL. 71 | * The returned value must be free'd calling g_object_unref(). 72 | */ 73 | GgitRepository * 74 | ggit_object_get_owner (GgitObject *object) 75 | { 76 | git_repository *repository; 77 | 78 | g_return_val_if_fail (GGIT_IS_OBJECT (object), NULL); 79 | 80 | repository = git_object_owner (_ggit_native_get (object)); 81 | 82 | return _ggit_repository_wrap (repository, FALSE); 83 | } 84 | 85 | /* ex:set ts=8 noet: */ 86 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-object.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-object.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_OBJECT_H__ 23 | #define __GGIT_OBJECT_H__ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "ggit-types.h" 30 | 31 | G_BEGIN_DECLS 32 | 33 | #define GGIT_TYPE_OBJECT (ggit_object_get_type ()) 34 | G_DECLARE_DERIVABLE_TYPE (GgitObject, ggit_object, GGIT, OBJECT, GgitNative) 35 | 36 | /** 37 | * GgitObjectClass: 38 | * @parent_class: The parent class. 39 | * 40 | * The class structure for #GgitObjectClass. 41 | */ 42 | struct _GgitObjectClass 43 | { 44 | /*< private >*/ 45 | GgitNativeClass parent_class; 46 | }; 47 | 48 | GgitOId *ggit_object_get_id (GgitObject *object); 49 | 50 | GgitRepository *ggit_object_get_owner (GgitObject *object); 51 | 52 | G_END_DECLS 53 | 54 | #endif /* __GGIT_OBJECT_H__ */ 55 | 56 | /* ex:set ts=8 noet: */ 57 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-oid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-oid.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_OID_H__ 23 | #define __GGIT_OID_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "ggit-types.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_OID (ggit_oid_get_type ()) 33 | #define GGIT_OID(obj) ((GgitOId *)obj) 34 | 35 | GType ggit_oid_get_type (void) G_GNUC_CONST; 36 | 37 | GgitOId *_ggit_oid_wrap (const git_oid *oid); 38 | 39 | const git_oid *_ggit_oid_get_oid (GgitOId *oid); 40 | 41 | GgitOId *ggit_oid_copy (GgitOId *oid); 42 | void ggit_oid_free (GgitOId *oid); 43 | 44 | GgitOId *ggit_oid_new_from_string (const gchar *str); 45 | 46 | GgitOId *ggit_oid_new_from_raw (const guchar *raw); 47 | 48 | gint ggit_oid_compare (GgitOId *a, 49 | GgitOId *b); 50 | 51 | gchar *ggit_oid_to_string (GgitOId *oid); 52 | 53 | guint ggit_oid_hash (GgitOId const *oid); 54 | gboolean ggit_oid_equal (GgitOId const *a, 55 | GgitOId const *b); 56 | 57 | gboolean ggit_oid_is_zero (GgitOId const *oid); 58 | 59 | gboolean ggit_oid_has_prefix (GgitOId *oid, 60 | const gchar *prefix); 61 | 62 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitOId, ggit_oid_free) 63 | 64 | G_END_DECLS 65 | 66 | #endif /* __GGIT_OID_H__ */ 67 | 68 | /* ex:set ts=8 noet: */ 69 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-patch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-patch.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Sindhu S 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_PATCH_H__ 22 | #define __GGIT_PATCH_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "ggit-types.h" 28 | #include "ggit-blob.h" 29 | #include "ggit-diff.h" 30 | 31 | G_BEGIN_DECLS 32 | 33 | #define GGIT_TYPE_PATCH (ggit_patch_get_type ()) 34 | #define GGIT_PATCH(obj) ((GgitPatch *)obj) 35 | 36 | GType ggit_patch_get_type (void) G_GNUC_CONST; 37 | 38 | GgitPatch *_ggit_patch_wrap (git_patch *patch); 39 | 40 | GgitPatch *ggit_patch_ref (GgitPatch *patch); 41 | 42 | void ggit_patch_unref (GgitPatch *patch); 43 | 44 | GgitPatch *ggit_patch_new_from_diff (GgitDiff *diff, 45 | gsize idx, 46 | GError **error); 47 | 48 | GgitPatch *ggit_patch_new_from_blobs (GgitBlob *old_blob, 49 | const gchar *old_as_path, 50 | GgitBlob *new_blob, 51 | const gchar *new_as_path, 52 | GgitDiffOptions *diff_options, 53 | GError **error); 54 | 55 | gchar *ggit_patch_to_string (GgitPatch *patch, 56 | GError **error); 57 | 58 | gboolean ggit_patch_to_stream (GgitPatch *patch, 59 | GOutputStream *stream, 60 | GError **error); 61 | 62 | gboolean ggit_patch_get_line_stats (GgitPatch *patch, 63 | gsize *total_context, 64 | gsize *total_additions, 65 | gsize *total_deletions, 66 | GError **error); 67 | 68 | gsize ggit_patch_get_num_hunks (GgitPatch *patch); 69 | 70 | gint ggit_patch_get_num_lines_in_hunk ( 71 | GgitPatch *patch, 72 | gsize hunk); 73 | 74 | GgitDiffDelta *ggit_patch_get_delta (GgitPatch *patch); 75 | 76 | GgitDiffHunk *ggit_patch_get_hunk (GgitPatch *patch, 77 | gsize idx, 78 | GError **error); 79 | 80 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitPatch, ggit_patch_unref) 81 | 82 | G_END_DECLS 83 | 84 | #endif /* __GGIT_PATCH_H__ */ 85 | 86 | /* ex:set ts=8 noet: */ 87 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-proxy-options.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-proxy-options.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2017 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #include "ggit-proxy-options.h" 22 | 23 | /** 24 | * GgitProxyOptions: 25 | * 26 | * Represents a git proxy options. 27 | */ 28 | 29 | typedef struct _GgitProxyOptionsPrivate 30 | { 31 | git_proxy_options options; 32 | } GgitProxyOptionsPrivate; 33 | 34 | G_DEFINE_TYPE_WITH_PRIVATE (GgitProxyOptions, ggit_proxy_options, G_TYPE_OBJECT) 35 | 36 | enum 37 | { 38 | PROP_0, 39 | }; 40 | 41 | static void 42 | ggit_proxy_options_set_property (GObject *object, 43 | guint prop_id, 44 | const GValue *value, 45 | GParamSpec *pspec) 46 | { 47 | switch (prop_id) 48 | { 49 | default: 50 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 51 | break; 52 | } 53 | } 54 | 55 | static void 56 | ggit_proxy_options_get_property (GObject *object, 57 | guint prop_id, 58 | GValue *value, 59 | GParamSpec *pspec) 60 | { 61 | switch (prop_id) 62 | { 63 | default: 64 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 65 | break; 66 | } 67 | } 68 | 69 | static void 70 | ggit_proxy_options_class_init (GgitProxyOptionsClass *klass) 71 | { 72 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 73 | 74 | object_class->get_property = ggit_proxy_options_get_property; 75 | object_class->set_property = ggit_proxy_options_set_property; 76 | } 77 | 78 | static void 79 | ggit_proxy_options_init (GgitProxyOptions *options) 80 | { 81 | GgitProxyOptionsPrivate *priv; 82 | 83 | priv = ggit_proxy_options_get_instance_private (options); 84 | 85 | git_proxy_init_options (&priv->options, GIT_PROXY_OPTIONS_VERSION); 86 | } 87 | 88 | /** 89 | * ggit_proxy_options_new: 90 | * 91 | * Create a new proxy options object. 92 | * 93 | * Returns: (transfer full) (nullable): a #GgitProxyOptions. 94 | * 95 | **/ 96 | GgitProxyOptions * 97 | ggit_proxy_options_new (void) 98 | { 99 | return g_object_new (GGIT_TYPE_PROXY_OPTIONS, NULL); 100 | } 101 | 102 | const git_proxy_options * 103 | _ggit_proxy_options_get_proxy_options (GgitProxyOptions *options) 104 | { 105 | if (options != NULL) 106 | { 107 | GgitProxyOptionsPrivate *priv; 108 | 109 | priv = ggit_proxy_options_get_instance_private (options); 110 | 111 | return &priv->options; 112 | } 113 | 114 | return NULL; 115 | } 116 | 117 | /* ex:set ts=8 noet: */ 118 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-proxy-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-push-options.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2017 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_PROXY_OPTIONS_H__ 22 | #define __GGIT_PROXY_OPTIONS_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include "ggit-types.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_PROXY_OPTIONS (ggit_proxy_options_get_type ()) 32 | G_DECLARE_DERIVABLE_TYPE (GgitProxyOptions, ggit_proxy_options, GGIT, PROXY_OPTIONS, GObject) 33 | 34 | struct _GgitProxyOptionsClass 35 | { 36 | GObjectClass parent_class; 37 | }; 38 | 39 | const git_proxy_options * 40 | _ggit_proxy_options_get_proxy_options (GgitProxyOptions *options); 41 | 42 | GgitProxyOptions *ggit_proxy_options_new (void); 43 | 44 | G_END_DECLS 45 | 46 | #endif /* __GGIT_PROXY_OPTIONS_H__ */ 47 | 48 | /* ex:set ts=8 noet: */ 49 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-push-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-push-options.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2014 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_PUSH_OPTIONS_H__ 22 | #define __GGIT_PUSH_OPTIONS_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include "ggit-types.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_PUSH_OPTIONS (ggit_push_options_get_type ()) 33 | G_DECLARE_DERIVABLE_TYPE (GgitPushOptions, ggit_push_options, GGIT, PUSH_OPTIONS, GObject) 34 | 35 | struct _GgitPushOptionsClass 36 | { 37 | GObjectClass parent_class; 38 | }; 39 | 40 | const git_push_options * 41 | _ggit_push_options_get_push_options (GgitPushOptions *options); 42 | 43 | GgitPushOptions *ggit_push_options_new (void); 44 | 45 | gint ggit_push_options_get_parallelism (GgitPushOptions *options); 46 | void ggit_push_options_set_parallelism (GgitPushOptions *options, 47 | gint parallelism); 48 | 49 | GgitRemoteCallbacks * ggit_push_options_get_remote_callbacks (GgitPushOptions *options); 50 | void ggit_push_options_set_remote_callbacks (GgitPushOptions *options, 51 | GgitRemoteCallbacks *callbacks); 52 | 53 | G_END_DECLS 54 | 55 | #endif /* __GGIT_PUSH_OPTIONS_H__ */ 56 | 57 | /* ex:set ts=8 noet: */ 58 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-rebase-operation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-rebase-operation.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2015 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_REBASE_OPERATION_H__ 23 | #define __GGIT_REBASE_OPERATION_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "ggit-types.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_REBASE_OPERATION (ggit_rebase_operation_get_type ()) 33 | #define GGIT_REBASE_OPERATION(obj) ((GgitRebaseOperation *)obj) 34 | 35 | GType ggit_rebase_operation_get_type (void) G_GNUC_CONST; 36 | 37 | GgitRebaseOperation *_ggit_rebase_operation_wrap (git_rebase_operation *rebase_operation); 38 | 39 | git_rebase_operation *_ggit_rebase_operation_get_rebase_operation (GgitRebaseOperation *rebase_operation); 40 | 41 | GgitRebaseOperation *ggit_rebase_operation_ref (GgitRebaseOperation *rebase_operation); 42 | void ggit_rebase_operation_unref (GgitRebaseOperation *rebase_operation); 43 | 44 | GgitRebaseOperationType ggit_rebase_operation_get_operation_type (GgitRebaseOperation *rebase_operation); 45 | 46 | GgitOId *ggit_rebase_operation_get_id (GgitRebaseOperation *rebase_operation); 47 | 48 | const gchar *ggit_rebase_operation_get_exec (GgitRebaseOperation *rebase_operation); 49 | 50 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitRebaseOperation, ggit_rebase_operation_unref) 51 | 52 | G_END_DECLS 53 | 54 | #endif /* __GGIT_REBASE_OPERATION_H__ */ 55 | 56 | /* ex:set ts=8 noet: */ 57 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-rebase-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-rebase-options.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2015 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_REBASE_OPTIONS_H__ 23 | #define __GGIT_REBASE_OPTIONS_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "ggit-types.h" 29 | #include "ggit-checkout-options.h" 30 | 31 | G_BEGIN_DECLS 32 | 33 | #define GGIT_TYPE_REBASE_OPTIONS (ggit_rebase_options_get_type ()) 34 | #define GGIT_REBASE_OPTIONS(obj) ((GgitRebaseOptions *)obj) 35 | 36 | GType ggit_rebase_options_get_type (void) G_GNUC_CONST; 37 | 38 | const git_rebase_options * 39 | _ggit_rebase_options_get_rebase_options (GgitRebaseOptions *rebase_options); 40 | 41 | GgitRebaseOptions *ggit_rebase_options_copy (GgitRebaseOptions *rebase_options); 42 | void ggit_rebase_options_free (GgitRebaseOptions *rebase_options); 43 | 44 | GgitRebaseOptions *ggit_rebase_options_new (void); 45 | 46 | gboolean ggit_rebase_options_get_quiet (GgitRebaseOptions *rebase_options); 47 | void ggit_rebase_options_set_quiet (GgitRebaseOptions *rebase_options, 48 | gboolean quiet); 49 | 50 | const gchar *ggit_rebase_options_get_rewrite_notes_ref (GgitRebaseOptions *rebase_options); 51 | void ggit_rebase_options_set_rewrite_notes_ref (GgitRebaseOptions *rebase_options, 52 | const gchar *rewrite_notes_ref); 53 | 54 | GgitCheckoutOptions *ggit_rebase_options_get_checkout_options (GgitRebaseOptions *rebase_options); 55 | void ggit_rebase_options_set_checkout_options (GgitRebaseOptions *rebase_options, 56 | GgitCheckoutOptions *checkout_options); 57 | 58 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitRebaseOptions, ggit_rebase_options_free) 59 | 60 | G_END_DECLS 61 | 62 | #endif /* __GGIT_REBASE_OPTIONS_H__ */ 63 | 64 | /* ex:set ts=8 noet: */ 65 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-rebase.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-rebase.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2015 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_REBASE_H__ 23 | #define __GGIT_REBASE_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "ggit-native.h" 29 | #include "ggit-types.h" 30 | #include "ggit-signature.h" 31 | 32 | G_BEGIN_DECLS 33 | 34 | #define GGIT_TYPE_REBASE (ggit_rebase_get_type ()) 35 | G_DECLARE_FINAL_TYPE (GgitRebase, ggit_rebase, GGIT, REBASE, GgitNative) 36 | 37 | /* Indicates that a rebase operation is not (yet) in progress. */ 38 | #define GGIT_REBASE_NO_OPERATION SIZE_MAX 39 | 40 | GgitRebase *_ggit_rebase_wrap (git_rebase *rebase); 41 | 42 | gsize ggit_rebase_get_operation_entry_count (GgitRebase *rebase); 43 | 44 | gsize ggit_rebase_get_operation_index (GgitRebase *rebase); 45 | 46 | GgitRebaseOperation *ggit_rebase_get_operation_by_index (GgitRebase *rebase, 47 | gsize idx); 48 | 49 | GgitRebaseOperation *ggit_rebase_next (GgitRebase *rebase, 50 | GError **error); 51 | 52 | GgitOId *ggit_rebase_commit (GgitRebase *rebase, 53 | GgitSignature *author, 54 | GgitSignature *committer, 55 | const gchar *message, 56 | GError **error); 57 | 58 | void ggit_rebase_abort (GgitRebase *rebase, 59 | GError **error); 60 | 61 | void ggit_rebase_finish (GgitRebase *rebase, 62 | GgitSignature *signature, 63 | GError **error); 64 | 65 | G_END_DECLS 66 | 67 | #endif /* __GGIT_REBASE_H__ */ 68 | 69 | /* ex:set ts=8 noet: */ 70 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-ref-spec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-ref-spec.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Garrett Regier 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | #include "ggit-ref-spec.h" 25 | 26 | struct _GgitRefSpec { 27 | gint ref_count; 28 | 29 | const git_refspec *refspec; 30 | }; 31 | 32 | G_DEFINE_BOXED_TYPE (GgitRefSpec, ggit_ref_spec, 33 | ggit_ref_spec_ref, ggit_ref_spec_unref) 34 | 35 | 36 | GgitRefSpec * 37 | _ggit_ref_spec_wrap (const git_refspec *refspec) 38 | { 39 | GgitRefSpec *grefspec; 40 | 41 | g_return_val_if_fail (refspec != NULL, NULL); 42 | 43 | grefspec = g_slice_new (GgitRefSpec); 44 | grefspec->ref_count = 1; 45 | grefspec->refspec = refspec; 46 | 47 | return grefspec; 48 | } 49 | 50 | /** 51 | * ggit_ref_spec_ref: 52 | * @refspec: a #GgitRefSpec. 53 | * 54 | * Atomically increments the reference count of @refspec by one. 55 | * This function is MT-safe and may be called from any thread. 56 | * 57 | * Returns: (transfer none) (nullable): a #GgitRefSpec or %NULL. 58 | **/ 59 | GgitRefSpec * 60 | ggit_ref_spec_ref (GgitRefSpec *refspec) 61 | { 62 | g_return_val_if_fail (refspec != NULL, NULL); 63 | 64 | g_atomic_int_inc (&refspec->ref_count); 65 | 66 | return refspec; 67 | } 68 | 69 | /** 70 | * ggit_ref_spec_unref: 71 | * @refspec: a #GgitRefSpec. 72 | * 73 | * Atomically decrements the reference count of @refspec by one. 74 | * If the reference count drops to 0, @refspec is freed. 75 | **/ 76 | void 77 | ggit_ref_spec_unref (GgitRefSpec *refspec) 78 | { 79 | g_return_if_fail (refspec != NULL); 80 | 81 | if (g_atomic_int_dec_and_test (&refspec->ref_count)) 82 | { 83 | g_slice_free (GgitRefSpec, refspec); 84 | } 85 | } 86 | 87 | /** 88 | * ggit_ref_spec_get_source: 89 | * @refspec: a #GgitRefSpec. 90 | * 91 | * Gets the @refspec's source. 92 | * 93 | * Returns: (transfer none) (nullable): the refspec's source or %NULL. 94 | */ 95 | const gchar * 96 | ggit_ref_spec_get_source (GgitRefSpec *refspec) 97 | { 98 | g_return_val_if_fail (refspec != NULL, 0); 99 | 100 | return git_refspec_src (refspec->refspec); 101 | } 102 | 103 | /** 104 | * ggit_ref_spec_get_destination: 105 | * @refspec: a #GgitRefSpec. 106 | * 107 | * Gets the @refspec's destination. 108 | * 109 | * Returns: (transfer none) (nullable): the refspec's destination or %NULL. 110 | */ 111 | const gchar * 112 | ggit_ref_spec_get_destination (GgitRefSpec *refspec) 113 | { 114 | g_return_val_if_fail (refspec != NULL, 0); 115 | 116 | return git_refspec_dst (refspec->refspec); 117 | } 118 | 119 | /** 120 | * ggit_ref_spec_is_forced: 121 | * @refspec: a #GgitRefSpec. 122 | * 123 | * Whether updating is done forcefully. 124 | * 125 | * Returns: if updating is done forcefully. 126 | */ 127 | gboolean 128 | ggit_ref_spec_is_forced (GgitRefSpec *refspec) 129 | { 130 | g_return_val_if_fail (refspec != NULL, 0); 131 | 132 | return git_refspec_force (refspec->refspec); 133 | } 134 | 135 | /* ex:set ts=8 noet: */ 136 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-ref-spec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-ref-spec.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Garrett Regier 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_REF_SPEC_H__ 22 | #define __GGIT_REF_SPEC_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include "ggit-types.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_REF_SPEC (ggit_ref_spec_get_type ()) 32 | #define GGIT_REF_SPEC(obj) ((GgitRefSpec *)obj) 33 | 34 | GType ggit_ref_spec_get_type (void) G_GNUC_CONST; 35 | 36 | GgitRefSpec *_ggit_ref_spec_wrap (const git_refspec *refspec); 37 | 38 | GgitRefSpec *ggit_ref_spec_ref (GgitRefSpec *refspec); 39 | void ggit_ref_spec_unref (GgitRefSpec *refspec); 40 | 41 | const gchar *ggit_ref_spec_get_source (GgitRefSpec *refspec); 42 | const gchar *ggit_ref_spec_get_destination (GgitRefSpec *refspec); 43 | gboolean ggit_ref_spec_is_forced (GgitRefSpec *refspec); 44 | 45 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitRefSpec, ggit_ref_spec_unref) 46 | 47 | G_END_DECLS 48 | 49 | #endif /* __GGIT_REF_SPEC_H__ */ 50 | 51 | /* ex:set ts=8 noet: */ 52 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-reflog-entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-reflog-entry.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Garrett Regier 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_REFLOG_ENTRY_H__ 22 | #define __GGIT_REFLOG_ENTRY_H__ 23 | 24 | #include 25 | #include 26 | #include "ggit-types.h" 27 | #include "ggit-signature.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_REFLOG_ENTRY (ggit_reflog_entry_get_type ()) 32 | #define GGIT_REFLOG_ENTRY(obj) ((GgitReflogEntry *)obj) 33 | 34 | GType ggit_reflog_entry_get_type (void) G_GNUC_CONST; 35 | 36 | GgitReflogEntry *_ggit_reflog_entry_wrap (const git_reflog_entry *reflog_entry); 37 | 38 | GgitReflogEntry *ggit_reflog_entry_ref (GgitReflogEntry *reflog_entry); 39 | void ggit_reflog_entry_unref (GgitReflogEntry *reflog_entry); 40 | 41 | GgitOId *ggit_reflog_entry_get_old_id (GgitReflogEntry *reflog_entry); 42 | GgitOId *ggit_reflog_entry_get_new_id (GgitReflogEntry *reflog_entry); 43 | GgitSignature *ggit_reflog_entry_get_committer (GgitReflogEntry *reflog_entry); 44 | const gchar *ggit_reflog_entry_get_message (GgitReflogEntry *reflog_entry); 45 | 46 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitReflogEntry, ggit_reflog_entry_unref) 47 | 48 | G_END_DECLS 49 | 50 | #endif /* __GGIT_REFLOG_ENTRY_H__ */ 51 | 52 | /* ex:set ts=8 noet: */ 53 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-reflog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-reflog.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Garrett Regier 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_REFLOG_H__ 22 | #define __GGIT_REFLOG_H__ 23 | 24 | #include 25 | #include 26 | #include "ggit-types.h" 27 | #include "ggit-ref.h" 28 | #include "ggit-signature.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_REFLOG (ggit_reflog_get_type ()) 33 | #define GGIT_REFLOG(obj) ((GgitReflog *)obj) 34 | 35 | GType ggit_reflog_get_type (void) G_GNUC_CONST; 36 | 37 | GgitReflog *_ggit_reflog_wrap (GgitRef *ref, 38 | git_reflog *reflog); 39 | 40 | GgitReflog *ggit_reflog_ref (GgitReflog *reflog); 41 | void ggit_reflog_unref (GgitReflog *reflog); 42 | 43 | guint ggit_reflog_get_entry_count (GgitReflog *reflog); 44 | GgitReflogEntry *ggit_reflog_get_entry_from_index (GgitReflog *reflog, 45 | guint idx); 46 | 47 | gboolean ggit_reflog_write (GgitReflog *reflog, 48 | GError **error); 49 | 50 | gboolean ggit_reflog_rename (GgitReflog *reflog, 51 | const gchar *new_name, 52 | GError **error); 53 | 54 | gboolean ggit_reflog_append (GgitReflog *reflog, 55 | GgitOId *oid, 56 | GgitSignature *committer, 57 | const gchar *message, 58 | GError **error); 59 | 60 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitReflog, ggit_reflog_unref) 61 | 62 | G_END_DECLS 63 | 64 | #endif /* __GGIT_REFLOG_H__ */ 65 | 66 | /* ex:set ts=8 noet: */ 67 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-remote-callbacks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-remote-callbacks.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_REMOTE_CALLBACKS_H__ 23 | #define __GGIT_REMOTE_CALLBACKS_H__ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_REMOTE_CALLBACKS (ggit_remote_callbacks_get_type ()) 32 | G_DECLARE_DERIVABLE_TYPE (GgitRemoteCallbacks, ggit_remote_callbacks, GGIT, REMOTE_CALLBACKS, GObject) 33 | 34 | struct _GgitRemoteCallbacksClass 35 | { 36 | GObjectClass parent_class; 37 | 38 | /* signals */ 39 | void (*progress) (GgitRemoteCallbacks *callbacks, 40 | const gchar *message); 41 | 42 | void (*transfer_progress) (GgitRemoteCallbacks *callbacks, 43 | GgitTransferProgress *stats); 44 | 45 | void (*update_tips) (GgitRemoteCallbacks *callbacks, 46 | const gchar *refname, 47 | const GgitOId *a, 48 | const GgitOId *b); 49 | 50 | void (*completion) (GgitRemoteCallbacks *callbacks, 51 | GgitRemoteCompletionType type); 52 | 53 | /* virtual methods */ 54 | GgitCred *(*credentials) (GgitRemoteCallbacks *callbacks, 55 | const gchar *url, 56 | const gchar *username_from_url, 57 | GgitCredtype allowed_types, 58 | GError **error); 59 | 60 | 61 | }; 62 | 63 | git_remote_callbacks *_ggit_remote_callbacks_get_native (GgitRemoteCallbacks *remote_cbs); 64 | 65 | G_END_DECLS 66 | 67 | #endif /* __GGIT_REMOTE_CALLBACKS_H__ */ 68 | 69 | /* ex:set ts=8 noet: */ 70 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-revert-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-revert-options.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_REVERT_OPTIONS_H__ 23 | #define __GGIT_REVERT_OPTIONS_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "ggit-types.h" 29 | #include "ggit-checkout-options.h" 30 | 31 | G_BEGIN_DECLS 32 | 33 | #define GGIT_TYPE_REVERT_OPTIONS (ggit_revert_options_get_type ()) 34 | #define GGIT_REVERT_OPTIONS(obj) ((GgitRevertOptions *)obj) 35 | 36 | GType ggit_revert_options_get_type (void) G_GNUC_CONST; 37 | 38 | const git_revert_options * 39 | _ggit_revert_options_get_revert_options ( 40 | GgitRevertOptions *revert_options); 41 | 42 | GgitRevertOptions *ggit_revert_options_copy (GgitRevertOptions *revert_options); 43 | void ggit_revert_options_free (GgitRevertOptions *revert_options); 44 | 45 | GgitRevertOptions *ggit_revert_options_new (guint mainline, 46 | GgitMergeOptions *merge_options, 47 | GgitCheckoutOptions *checkout_options); 48 | 49 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitRevertOptions, ggit_revert_options_free) 50 | 51 | G_END_DECLS 52 | 53 | #endif /* __GGIT_REVERT_OPTIONS_H__ */ 54 | 55 | /* ex:set ts=8 noet: */ 56 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-signature.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-signature.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_SIGNATURE_H__ 22 | #define __GGIT_SIGNATURE_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GGIT_TYPE_SIGNATURE (ggit_signature_get_type ()) 31 | G_DECLARE_FINAL_TYPE (GgitSignature, ggit_signature, GGIT, SIGNATURE, GgitNative) 32 | 33 | GgitSignature *_ggit_signature_wrap (const git_signature *signature, 34 | const gchar *encoding, 35 | gboolean owned); 36 | 37 | GgitSignature *ggit_signature_new (const gchar *name, 38 | const gchar *email, 39 | GDateTime *signature_time, 40 | GError **error); 41 | 42 | GgitSignature *ggit_signature_new_now (const gchar *name, 43 | const gchar *email, 44 | GError **error); 45 | 46 | GgitSignature *ggit_signature_copy (GgitSignature *signature); 47 | 48 | const gchar *ggit_signature_get_name (GgitSignature *signature); 49 | 50 | const gchar *ggit_signature_get_email (GgitSignature *signature); 51 | 52 | GDateTime *ggit_signature_get_time (GgitSignature *signature); 53 | 54 | GTimeZone *ggit_signature_get_time_zone (GgitSignature *signature); 55 | 56 | G_END_DECLS 57 | 58 | #endif /* __GGIT_SIGNATURE_H__ */ 59 | 60 | /* ex:set ts=8 noet: */ 61 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-status-options.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-status-options.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Garrett Regier 6 | * Copyright (C) 2013 - Jesse van den Kieboom 7 | * 8 | * libgit2-glib is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * libgit2-glib is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with libgit2-glib. If not, see . 20 | */ 21 | 22 | #include "ggit-status-options.h" 23 | #include "ggit-utils.h" 24 | 25 | struct _GgitStatusOptions 26 | { 27 | git_status_options status_options; 28 | }; 29 | 30 | G_DEFINE_BOXED_TYPE (GgitStatusOptions, ggit_status_options, 31 | ggit_status_options_copy, ggit_status_options_free) 32 | 33 | const git_status_options * 34 | _ggit_status_options_get_status_options (GgitStatusOptions *status_options) 35 | { 36 | /* NULL is common for status_options as it specifies to use the default 37 | * so handle a NULL status_options here instead of in every caller. 38 | */ 39 | if (status_options == NULL) 40 | { 41 | return NULL; 42 | } 43 | 44 | return (const git_status_options *)&status_options->status_options; 45 | } 46 | 47 | /** 48 | * ggit_status_options_copy: 49 | * @status_options: a #GgitStatusOptions. 50 | * 51 | * Copies @status_options into a newly allocated #GgitStatusOptions. 52 | * 53 | * Returns: (transfer full) (nullable): a newly allocated #GgitStatusOptions or %NULL. 54 | */ 55 | GgitStatusOptions * 56 | ggit_status_options_copy (GgitStatusOptions *status_options) 57 | { 58 | GgitStatusOptions *new_status_options; 59 | 60 | g_return_val_if_fail (status_options != NULL, NULL); 61 | 62 | new_status_options = g_slice_new (GgitStatusOptions); 63 | 64 | new_status_options->status_options = status_options->status_options; 65 | 66 | git_strarray_copy (&new_status_options->status_options.pathspec, 67 | &status_options->status_options.pathspec); 68 | 69 | return new_status_options; 70 | } 71 | 72 | /** 73 | * ggit_status_options_free: 74 | * @status_options: a #GgitStatusOptions. 75 | * 76 | * Frees @status_options. 77 | */ 78 | void 79 | ggit_status_options_free (GgitStatusOptions *status_options) 80 | { 81 | git_status_options *gstatus_options; 82 | 83 | g_return_if_fail (status_options != NULL); 84 | 85 | gstatus_options = &status_options->status_options; 86 | git_strarray_free (&gstatus_options->pathspec); 87 | 88 | g_slice_free (GgitStatusOptions, status_options); 89 | } 90 | 91 | /** 92 | * ggit_status_options_new: 93 | * @options: status options. 94 | * @show: status show options. 95 | * @pathspec: (allow-none) (array zero-terminated=1): which paths to show, defaults to showing all paths. 96 | * 97 | * Creates a new #GgitStatusOptions for use in #ggit_repository_stash_foreach. 98 | * 99 | * Returns: a newly allocated #GgitStatusOptions. 100 | */ 101 | GgitStatusOptions * 102 | ggit_status_options_new (GgitStatusOption options, 103 | GgitStatusShow show, 104 | const gchar **pathspec) 105 | { 106 | GgitStatusOptions *status_options; 107 | git_status_options gstatus_options = GIT_STATUS_OPTIONS_INIT; 108 | 109 | status_options = g_slice_new (GgitStatusOptions); 110 | 111 | gstatus_options.flags = options; 112 | gstatus_options.show = (git_status_show_t)show; 113 | 114 | ggit_utils_get_git_strarray_from_str_array (pathspec, 115 | &gstatus_options.pathspec); 116 | 117 | status_options->status_options = gstatus_options; 118 | 119 | return status_options; 120 | } 121 | 122 | /* ex:set ts=8 noet: */ 123 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-status-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-status-options.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Garrett Regier 6 | * Copyright (C) 2013 - Jesse van den Kieboom 7 | * 8 | * libgit2-glib is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * libgit2-glib is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with libgit2-glib. If not, see . 20 | */ 21 | 22 | 23 | #ifndef __GGIT_STATUS_OPTIONS_H__ 24 | #define __GGIT_STATUS_OPTIONS_H__ 25 | 26 | #include 27 | #include 28 | 29 | #include "ggit-types.h" 30 | 31 | G_BEGIN_DECLS 32 | 33 | #define GGIT_TYPE_STATUS_OPTIONS (ggit_status_options_get_type ()) 34 | #define GGIT_STATUS_OPTIONS(obj) ((GgitStatusOptions *)obj) 35 | 36 | GType ggit_status_options_get_type (void) G_GNUC_CONST; 37 | 38 | const git_status_options * 39 | _ggit_status_options_get_status_options (GgitStatusOptions *status_options); 40 | 41 | GgitStatusOptions *ggit_status_options_copy (GgitStatusOptions *status_options); 42 | void ggit_status_options_free (GgitStatusOptions *status_options); 43 | 44 | GgitStatusOptions *ggit_status_options_new (GgitStatusOption options, 45 | GgitStatusShow show, 46 | const gchar **pathspec); 47 | 48 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitStatusOptions, ggit_status_options_free) 49 | 50 | G_END_DECLS 51 | 52 | #endif /* __GGIT_STATUS_OPTIONS_H__ */ 53 | 54 | /* ex:set ts=8 noet: */ 55 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-submodule-update-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-submodule-update-options.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2015 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_SUBMODULE_UPDATE_OPTIONS_H__ 22 | #define __GGIT_SUBMODULE_UPDATE_OPTIONS_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include "ggit-types.h" 28 | #include "ggit-checkout-options.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_SUBMODULE_UPDATE_OPTIONS (ggit_submodule_update_options_get_type ()) 33 | G_DECLARE_DERIVABLE_TYPE (GgitSubmoduleUpdateOptions, ggit_submodule_update_options, GGIT, SUBMODULE_UPDATE_OPTIONS, GObject) 34 | 35 | struct _GgitSubmoduleUpdateOptionsClass 36 | { 37 | GObjectClass parent_class; 38 | }; 39 | 40 | git_submodule_update_options * 41 | _ggit_submodule_update_options_get_submodule_update_options (GgitSubmoduleUpdateOptions *options); 42 | 43 | GgitSubmoduleUpdateOptions *ggit_submodule_update_options_new (void); 44 | 45 | GgitCheckoutOptions *ggit_submodule_update_options_get_checkout_options (GgitSubmoduleUpdateOptions *options); 46 | void ggit_submodule_update_options_set_checkout_options (GgitSubmoduleUpdateOptions *options, 47 | GgitCheckoutOptions *checkout_options); 48 | 49 | GgitFetchOptions *ggit_submodule_update_options_get_fetch_options (GgitSubmoduleUpdateOptions *options); 50 | void ggit_submodule_update_options_set_fetch_options (GgitSubmoduleUpdateOptions *options, 51 | GgitFetchOptions *fetch_options); 52 | 53 | G_END_DECLS 54 | 55 | #endif /* __GGIT_SUBMODULE_UPDATE_OPTIONS_H__ */ 56 | 57 | /* ex:set ts=8 noet: */ 58 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-tag.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-tag.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | 22 | #ifndef __GGIT_TAG_H__ 23 | #define __GGIT_TAG_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "ggit-object.h" 29 | #include "ggit-types.h" 30 | 31 | G_BEGIN_DECLS 32 | 33 | #define GGIT_TYPE_TAG (ggit_tag_get_type ()) 34 | G_DECLARE_DERIVABLE_TYPE (GgitTag, ggit_tag, GGIT, TAG, GgitObject) 35 | 36 | /** 37 | * GgitTagClass: 38 | * @parent_class: The parent class. 39 | * 40 | * The class structure for #GgitTagClass. 41 | */ 42 | struct _GgitTagClass 43 | { 44 | /*< private >*/ 45 | GgitObjectClass parent_class; 46 | }; 47 | 48 | GgitTag *_ggit_tag_wrap (git_tag *tag, 49 | gboolean owned); 50 | 51 | GgitObject *ggit_tag_get_target (GgitTag *tag, 52 | GError **error); 53 | 54 | GgitOId *ggit_tag_get_target_id (GgitTag *tag); 55 | 56 | const gchar *ggit_tag_get_name (GgitTag *tag); 57 | 58 | GgitSignature *ggit_tag_get_tagger (GgitTag *tag); 59 | 60 | const gchar *ggit_tag_get_message (GgitTag *tag); 61 | 62 | GType ggit_tag_get_target_type (GgitTag *tag); 63 | 64 | GgitObject *ggit_tag_peel (GgitTag *tag, 65 | GError **error); 66 | 67 | G_END_DECLS 68 | 69 | #endif /* __GGIT_TAG_H__ */ 70 | 71 | /* ex:set ts=8 noet: */ 72 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-transfer-progress.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-transfer-progress.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2013 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_TRANSFER_PROGRESS_H__ 22 | #define __GGIT_TRANSFER_PROGRESS_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include "ggit-types.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_TRANSFER_PROGRESS (ggit_transfer_progress_get_type ()) 32 | #define GGIT_TRANSFER_PROGRESS(obj) ((GgitTransferProgress *)obj) 33 | 34 | GType ggit_transfer_progress_get_type (void) G_GNUC_CONST; 35 | 36 | GgitTransferProgress *_ggit_transfer_progress_wrap (const git_transfer_progress *progress); 37 | 38 | GgitTransferProgress *ggit_transfer_progress_copy (GgitTransferProgress *progress); 39 | void ggit_transfer_progress_free (GgitTransferProgress *progress); 40 | 41 | guint ggit_transfer_progress_get_total_objects (GgitTransferProgress *progress); 42 | 43 | guint ggit_transfer_progress_get_indexed_objects (GgitTransferProgress *progress); 44 | 45 | guint ggit_transfer_progress_get_received_objects (GgitTransferProgress *progress); 46 | 47 | gsize ggit_transfer_progress_get_received_bytes (GgitTransferProgress *progress); 48 | 49 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitTransferProgress, ggit_transfer_progress_free) 50 | 51 | G_END_DECLS 52 | 53 | #endif /* __GGIT_TRANSFER_PROGRESS_H__ */ 54 | 55 | /* ex:set ts=8 noet: */ 56 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-tree-builder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-tree-builder.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_TREE_BUILDER_H__ 22 | #define __GGIT_TREE_BUILDER_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GGIT_TYPE_TREE_BUILDER (ggit_tree_builder_get_type ()) 32 | G_DECLARE_DERIVABLE_TYPE (GgitTreeBuilder, ggit_tree_builder, GGIT, TREE_BUILDER, GgitNative) 33 | 34 | /** 35 | * GgitTreeBuilderClass: 36 | * @parent_class: The parent class. 37 | * 38 | * The class structure for #GgitTreeBuilderClass. 39 | */ 40 | struct _GgitTreeBuilderClass 41 | { 42 | /*< private >*/ 43 | GgitNativeClass parent_class; 44 | }; 45 | 46 | GgitTreeBuilder *_ggit_tree_builder_wrap (git_treebuilder *builder, 47 | GgitRepository *repository, 48 | gboolean owned); 49 | 50 | void ggit_tree_builder_remove (GgitTreeBuilder *builder, 51 | const gchar *path, 52 | GError **error); 53 | 54 | void ggit_tree_builder_clear (GgitTreeBuilder *builder); 55 | 56 | GgitOId *ggit_tree_builder_write (GgitTreeBuilder *builder, 57 | GError **error); 58 | 59 | GgitTreeEntry *ggit_tree_builder_insert (GgitTreeBuilder *builder, 60 | const gchar *filename, 61 | GgitOId *oid, 62 | GgitFileMode file_mode, 63 | GError **error); 64 | 65 | GgitTreeEntry *ggit_tree_builder_get_entry (GgitTreeBuilder *builder, 66 | const gchar *path); 67 | 68 | G_END_DECLS 69 | 70 | #endif /* __GGIT_TREE_BUILDER_H__ */ 71 | 72 | /* ex:set ts=8 noet: */ 73 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-tree-entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-tree-entry.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_TREE_ENTRY_H__ 22 | #define __GGIT_TREE_ENTRY_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GGIT_TYPE_TREE_ENTRY (ggit_tree_entry_get_type ()) 31 | #define GGIT_TREE_ENTRY(obj) ((GgitTreeEntry *)obj) 32 | 33 | GType ggit_tree_entry_get_type (void) G_GNUC_CONST; 34 | 35 | GgitTreeEntry *_ggit_tree_entry_wrap (git_tree_entry *entry, 36 | gboolean free_entry); 37 | GgitTreeEntry *ggit_tree_entry_ref (GgitTreeEntry *entry); 38 | void ggit_tree_entry_unref (GgitTreeEntry *entry); 39 | 40 | GgitFileMode ggit_tree_entry_get_file_mode (GgitTreeEntry *entry); 41 | GgitOId *ggit_tree_entry_get_id (GgitTreeEntry *entry); 42 | const gchar * ggit_tree_entry_get_name (GgitTreeEntry *entry); 43 | 44 | GType ggit_tree_entry_get_object_type (GgitTreeEntry *entry); 45 | 46 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitTreeEntry, ggit_tree_entry_unref) 47 | 48 | G_END_DECLS 49 | 50 | #endif /* __GGIT_TREE_ENTRY_H__ */ 51 | 52 | /* ex:set ts=8 noet: */ 53 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-tree.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-tree.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2012 - Jesse van den Kieboom 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_TREE_H__ 22 | #define __GGIT_TREE_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GGIT_TYPE_TREE (ggit_tree_get_type ()) 33 | G_DECLARE_DERIVABLE_TYPE (GgitTree, ggit_tree, GGIT, TREE, GgitObject) 34 | 35 | /** 36 | * GgitTreeClass: 37 | * @parent_class: The parent class. 38 | * 39 | * The class structure for #GgitTreeClass. 40 | */ 41 | struct _GgitTreeClass 42 | { 43 | /*< private >*/ 44 | GgitObjectClass parent_class; 45 | }; 46 | 47 | GgitTree *_ggit_tree_wrap (git_tree *tree, 48 | gboolean owned); 49 | 50 | const git_tree *_ggit_tree_get_tree (GgitTree *tree); 51 | GgitOId *ggit_tree_get_id (GgitTree *tree); 52 | 53 | GgitTreeEntry *ggit_tree_get (GgitTree *tree, 54 | guint i); 55 | 56 | guint ggit_tree_size (GgitTree *tree); 57 | 58 | GgitTreeEntry *ggit_tree_get_by_name (GgitTree *tree, 59 | const gchar *name); 60 | 61 | GgitTreeEntry *ggit_tree_get_by_path (GgitTree *tree, 62 | const gchar *path, 63 | GError **error); 64 | 65 | void ggit_tree_walk (GgitTree *tree, 66 | GgitTreeWalkMode mode, 67 | GgitTreeWalkCallback callback, 68 | gpointer user_data, 69 | GError **error); 70 | 71 | G_END_DECLS 72 | 73 | #endif /* __GGIT_TREE_H__ */ 74 | 75 | /* ex:set ts=8 noet: */ 76 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-types-18.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-types-18.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2025 - Alberto Fanjul 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_TYPES_18_H__ 22 | #define __GGIT_TYPES_18_H__ 23 | 24 | /** 25 | * GgitConfigLevel: 26 | * @GGIT_CONFIG_LEVEL_PROGRAMDATA: System-wide on Windows, for compatibility with portable git. 27 | * @GGIT_CONFIG_LEVEL_SYSTEM: System-wide configuration file. 28 | * @GGIT_CONFIG_LEVEL_XDG: XDG compatible configuration file (.config/git/config). 29 | * @GGIT_CONFIG_LEVEL_GLOBAL: User-specific configuration file, also called Global configuration file. 30 | * @GGIT_CONFIG_LEVEL_LOCAL: Repository specific configuration file. 31 | * @GIT_CONFIG_LEVEL_WORKTREE: Worktree specific configuration file; $GIT_DIR/config.worktree 32 | * @GGIT_CONFIG_LEVEL_APP: Application specific configuration file; freely defined by applications. 33 | * @GGIT_CONFIG_LEVEL_HIGHEST: Represents the highest level of a config file. 34 | * 35 | * Priority level of a config file. 36 | * These priority levels correspond to the natural escalation logic 37 | * (from higher to lower) when searching for config entries in git.git. 38 | */ 39 | typedef enum 40 | { 41 | GGIT_CONFIG_LEVEL_PROGRAMDATA = 1, 42 | GGIT_CONFIG_LEVEL_SYSTEM = 2, 43 | GGIT_CONFIG_LEVEL_XDG = 3, 44 | GGIT_CONFIG_LEVEL_GLOBAL = 4, 45 | GGIT_CONFIG_LEVEL_LOCAL = 5, 46 | GGIT_CONFIG_LEVEL_WORKTREE = 6, 47 | GGIT_CONFIG_LEVEL_APP = 7, 48 | GGIT_CONFIG_LEVEL_HIGHEST = -1 49 | } GgitConfigLevel; 50 | 51 | typedef enum 52 | { 53 | GGIT_CHECKOUT_NONE = 0, 54 | GGIT_CHECKOUT_SAFE = (1u << 0), 55 | GGIT_CHECKOUT_FORCE = (1u << 1), 56 | GGIT_CHECKOUT_RECREATE_MISSING = (1u << 2), 57 | GGIT_CHECKOUT_ALLOW_CONFLICTS = (1u << 4), 58 | GGIT_CHECKOUT_REMOVE_UNTRACKED = (1u << 5), 59 | GGIT_CHECKOUT_REMOVE_IGNORED = (1u << 6), 60 | GGIT_CHECKOUT_UPDATE_ONLY = (1u << 7), 61 | GGIT_CHECKOUT_DONT_UPDATE_INDEX = (1u << 8), 62 | GGIT_CHECKOUT_NO_REFRESH = (1u << 9), 63 | GGIT_CHECKOUT_SKIP_UNMERGED = (1u << 10), 64 | GGIT_CHECKOUT_USE_OURS = (1u << 11), 65 | GGIT_CHECKOUT_USE_THEIRS = (1u << 12), 66 | GGIT_CHECKOUT_DISABLE_PATHSPEC_MATCH = (1u << 13), 67 | GGIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES = (1u << 18), 68 | GGIT_CHECKOUT_DONT_OVERWRITE_IGNORED = (1u << 19), 69 | GGIT_CHECKOUT_CONFLICT_STYLE_MERGE = (1u << 20), 70 | GGIT_CHECKOUT_CONFLICT_STYLE_DIFF3 = (1u << 21), 71 | GGIT_CHECKOUT_DONT_REMOVE_EXISTING = (1u << 22), 72 | GGIT_CHECKOUT_DONT_WRITE_INDEX = (1u << 23), 73 | GGIT_CHECKOUT_UPDATE_SUBMODULES = (1u << 16), 74 | GGIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = (1u << 17) 75 | } GgitCheckoutStrategy; 76 | 77 | #endif /* __GGIT_TYPES_18_H__ */ 78 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-types-19.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-types-19.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2025 - Alberto Fanjul 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_TYPES_19_H__ 22 | #define __GGIT_TYPES_19_H__ 23 | 24 | /** 25 | * GgitConfigLevel: 26 | * @GGIT_CONFIG_LEVEL_PROGRAMDATA: System-wide on Windows, for compatibility with portable git. 27 | * @GGIT_CONFIG_LEVEL_SYSTEM: System-wide configuration file. 28 | * @GGIT_CONFIG_LEVEL_XDG: XDG compatible configuration file (.config/git/config). 29 | * @GGIT_CONFIG_LEVEL_GLOBAL: User-specific configuration file, also called Global configuration file. 30 | * @GGIT_CONFIG_LEVEL_LOCAL: Repository specific configuration file. 31 | * @GIT_CONFIG_LEVEL_WORKTREE: Worktree specific configuration file; $GIT_DIR/config.worktree 32 | * @GGIT_CONFIG_LEVEL_APP: Application specific configuration file; freely defined by applications. 33 | * @GGIT_CONFIG_LEVEL_HIGHEST: Represents the highest level of a config file. 34 | * 35 | * Priority level of a config file. 36 | * These priority levels correspond to the natural escalation logic 37 | * (from higher to lower) when searching for config entries in git.git. 38 | */ 39 | typedef enum 40 | { 41 | GGIT_CONFIG_LEVEL_PROGRAMDATA = 1, 42 | GGIT_CONFIG_LEVEL_SYSTEM = 2, 43 | GGIT_CONFIG_LEVEL_XDG = 3, 44 | GGIT_CONFIG_LEVEL_GLOBAL = 4, 45 | GGIT_CONFIG_LEVEL_LOCAL = 5, 46 | GGIT_CONFIG_LEVEL_WORKTREE = 6, 47 | GGIT_CONFIG_LEVEL_APP = 7, 48 | GGIT_CONFIG_LEVEL_HIGHEST = -1 49 | } GgitConfigLevel; 50 | 51 | typedef enum 52 | { 53 | GGIT_CHECKOUT_SAFE = 0, 54 | GGIT_CHECKOUT_FORCE = (1u << 1), 55 | GGIT_CHECKOUT_RECREATE_MISSING = (1u << 2), 56 | GGIT_CHECKOUT_ALLOW_CONFLICTS = (1u << 4), 57 | GGIT_CHECKOUT_REMOVE_UNTRACKED = (1u << 5), 58 | GGIT_CHECKOUT_REMOVE_IGNORED = (1u << 6), 59 | GGIT_CHECKOUT_UPDATE_ONLY = (1u << 7), 60 | GGIT_CHECKOUT_DONT_UPDATE_INDEX = (1u << 8), 61 | GGIT_CHECKOUT_NO_REFRESH = (1u << 9), 62 | GGIT_CHECKOUT_SKIP_UNMERGED = (1u << 10), 63 | GGIT_CHECKOUT_USE_OURS = (1u << 11), 64 | GGIT_CHECKOUT_USE_THEIRS = (1u << 12), 65 | GGIT_CHECKOUT_DISABLE_PATHSPEC_MATCH = (1u << 13), 66 | GGIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES = (1u << 18), 67 | GGIT_CHECKOUT_DONT_OVERWRITE_IGNORED = (1u << 19), 68 | GGIT_CHECKOUT_CONFLICT_STYLE_MERGE = (1u << 20), 69 | GGIT_CHECKOUT_CONFLICT_STYLE_DIFF3 = (1u << 21), 70 | GGIT_CHECKOUT_DONT_REMOVE_EXISTING = (1u << 22), 71 | GGIT_CHECKOUT_DONT_WRITE_INDEX = (1u << 23), 72 | GGIT_CHECKOUT_DRY_RUN = (1u << 24), 73 | GGIT_CHECKOUT_CONFLICT_STYLE_ZDIFF3 = (1u << 25), 74 | GGIT_CHECKOUT_NONE = (1u << 30), 75 | GGIT_CHECKOUT_UPDATE_SUBMODULES = (1u << 16), 76 | GGIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = (1u << 17) 77 | } GgitCheckoutStrategy; 78 | 79 | #endif /* __GGIT_TYPES_19_H__ */ 80 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-types-pre18.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-types-pre18.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2025 - Alberto Fanjul 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_TYPES_PRE18_H__ 22 | #define __GGIT_TYPES_PRE18_H__ 23 | 24 | /** 25 | * GgitConfigLevel: 26 | * @GGIT_CONFIG_LEVEL_PROGRAMDATA: System-wide on Windows, for compatibility with portable git. 27 | * @GGIT_CONFIG_LEVEL_SYSTEM: System-wide configuration file. 28 | * @GGIT_CONFIG_LEVEL_XDG: XDG compatible configuration file (.config/git/config). 29 | * @GGIT_CONFIG_LEVEL_GLOBAL: User-specific configuration file, also called Global configuration file. 30 | * @GGIT_CONFIG_LEVEL_LOCAL: Repository specific configuration file. 31 | * @GGIT_CONFIG_LEVEL_APP: Application specific configuration file; freely defined by applications. 32 | * @GGIT_CONFIG_LEVEL_HIGHEST: Represents the highest level of a config file. 33 | * 34 | * Priority level of a config file. 35 | * These priority levels correspond to the natural escalation logic 36 | * (from higher to lower) when searching for config entries in git.git. 37 | */ 38 | typedef enum 39 | { 40 | GGIT_CONFIG_LEVEL_PROGRAMDATA = 1, 41 | GGIT_CONFIG_LEVEL_SYSTEM = 2, 42 | GGIT_CONFIG_LEVEL_XDG = 3, 43 | GGIT_CONFIG_LEVEL_GLOBAL = 4, 44 | GGIT_CONFIG_LEVEL_LOCAL = 5, 45 | GGIT_CONFIG_LEVEL_APP = 6, 46 | GGIT_CONFIG_LEVEL_HIGHEST = -1 47 | } GgitConfigLevel; 48 | 49 | typedef enum 50 | { 51 | GGIT_CHECKOUT_NONE = 0, 52 | GGIT_CHECKOUT_SAFE = (1u << 0), 53 | GGIT_CHECKOUT_FORCE = (1u << 1), 54 | GGIT_CHECKOUT_RECREATE_MISSING = (1u << 2), 55 | GGIT_CHECKOUT_ALLOW_CONFLICTS = (1u << 4), 56 | GGIT_CHECKOUT_REMOVE_UNTRACKED = (1u << 5), 57 | GGIT_CHECKOUT_REMOVE_IGNORED = (1u << 6), 58 | GGIT_CHECKOUT_UPDATE_ONLY = (1u << 7), 59 | GGIT_CHECKOUT_DONT_UPDATE_INDEX = (1u << 8), 60 | GGIT_CHECKOUT_NO_REFRESH = (1u << 9), 61 | GGIT_CHECKOUT_SKIP_UNMERGED = (1u << 10), 62 | GGIT_CHECKOUT_USE_OURS = (1u << 11), 63 | GGIT_CHECKOUT_USE_THEIRS = (1u << 12), 64 | GGIT_CHECKOUT_DISABLE_PATHSPEC_MATCH = (1u << 13), 65 | GGIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES = (1u << 18), 66 | GGIT_CHECKOUT_DONT_OVERWRITE_IGNORED = (1u << 19), 67 | GGIT_CHECKOUT_CONFLICT_STYLE_MERGE = (1u << 20), 68 | GGIT_CHECKOUT_CONFLICT_STYLE_DIFF3 = (1u << 21), 69 | GGIT_CHECKOUT_DONT_REMOVE_EXISTING = (1u << 22), 70 | GGIT_CHECKOUT_DONT_WRITE_INDEX = (1u << 23), 71 | GGIT_CHECKOUT_UPDATE_SUBMODULES = (1u << 16), 72 | GGIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = (1u << 17) 73 | } GgitCheckoutStrategy; 74 | 75 | #endif /* __GGIT_TYPES_PRE18_H__ */ 76 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-utils.c 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #include 22 | 23 | #include "ggit-blob.h" 24 | #include "ggit-commit.h" 25 | #include "ggit-tag.h" 26 | #include "ggit-tree.h" 27 | #include "ggit-utils.h" 28 | 29 | git_otype 30 | ggit_utils_get_otype_from_gtype (GType gtype) 31 | { 32 | git_otype otype; 33 | 34 | if (g_type_is_a (gtype, GGIT_TYPE_TAG)) 35 | { 36 | otype = GIT_OBJ_TAG; 37 | } 38 | else if (g_type_is_a (gtype, GGIT_TYPE_BLOB)) 39 | { 40 | otype = GIT_OBJ_BLOB; 41 | } 42 | else if (g_type_is_a (gtype, GGIT_TYPE_COMMIT)) 43 | { 44 | otype = GIT_OBJ_COMMIT; 45 | } 46 | else if (g_type_is_a (gtype, GGIT_TYPE_TREE)) 47 | { 48 | otype = GIT_OBJ_TREE; 49 | } 50 | else if (g_type_is_a (gtype, G_TYPE_NONE)) 51 | { 52 | otype = GIT_OBJ_ANY; 53 | } 54 | else 55 | { 56 | otype = GIT_OBJ_BAD; 57 | } 58 | 59 | return otype; 60 | } 61 | 62 | GType 63 | ggit_utils_get_gtype_from_otype (git_otype type) 64 | { 65 | switch (type) 66 | { 67 | case GIT_OBJ_TAG: 68 | return GGIT_TYPE_TAG; 69 | case GIT_OBJ_BLOB: 70 | return GGIT_TYPE_BLOB; 71 | case GIT_OBJ_TREE: 72 | return GGIT_TYPE_TREE; 73 | case GIT_OBJ_COMMIT: 74 | return GGIT_TYPE_COMMIT; 75 | default: 76 | return G_TYPE_NONE; 77 | } 78 | } 79 | 80 | GgitObject * 81 | ggit_utils_create_real_object (git_object *obj, 82 | gboolean owned) 83 | { 84 | git_otype otype; 85 | 86 | otype = git_object_type (obj); 87 | 88 | switch (otype) 89 | { 90 | case GIT_OBJ_TAG: 91 | return GGIT_OBJECT (_ggit_tag_wrap ((git_tag *)obj, owned)); 92 | case GIT_OBJ_BLOB: 93 | return GGIT_OBJECT (_ggit_blob_wrap ((git_blob *)obj, owned)); 94 | case GIT_OBJ_COMMIT: 95 | return GGIT_OBJECT (_ggit_commit_wrap ((git_commit *)obj, owned)); 96 | case GIT_OBJ_TREE: 97 | return GGIT_OBJECT (_ggit_tree_wrap ((git_tree *)obj, owned)); 98 | default: 99 | return NULL; 100 | } 101 | } 102 | 103 | gchar ** 104 | ggit_utils_get_str_array_from_git_strarray (git_strarray *gitarray) 105 | { 106 | gchar **array; 107 | gint i; 108 | 109 | array = g_new (gchar *, gitarray->count + 1); 110 | 111 | for (i = 0; i < gitarray->count; i++) 112 | { 113 | array[i] = gitarray->strings[i]; 114 | } 115 | array[i] = NULL; 116 | 117 | return array; 118 | } 119 | 120 | void 121 | ggit_utils_get_git_strarray_from_str_array (const gchar * const *array, 122 | git_strarray *gitarray) 123 | { 124 | git_strarray fake_gitarray; 125 | 126 | if (array == NULL) 127 | { 128 | gitarray->count = 0; 129 | gitarray->strings = NULL; 130 | return; 131 | } 132 | 133 | fake_gitarray.count = g_strv_length ((gchar **) array); 134 | fake_gitarray.strings = (gchar **) array; 135 | 136 | if (git_strarray_copy (gitarray, &fake_gitarray) != GIT_OK) 137 | { 138 | /* out of memory */ 139 | } 140 | } 141 | 142 | /* ex:set ts=8 noet: */ 143 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit-utils.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_UTILS_H__ 22 | #define __GGIT_UTILS_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include "ggit-object.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | git_otype ggit_utils_get_otype_from_gtype (GType gtype); 32 | GType ggit_utils_get_gtype_from_otype (git_otype type); 33 | 34 | GgitObject *ggit_utils_create_real_object (git_object *obj, 35 | gboolean owned); 36 | 37 | gchar **ggit_utils_get_str_array_from_git_strarray 38 | (git_strarray *gitarray); 39 | 40 | 41 | void ggit_utils_get_git_strarray_from_str_array 42 | (const gchar * const *array, 43 | git_strarray *gitarray); 44 | 45 | G_END_DECLS 46 | 47 | #endif 48 | 49 | /* ex:set ts=8 noet: */ 50 | -------------------------------------------------------------------------------- /libgit2-glib/ggit-version.h.in: -------------------------------------------------------------------------------- 1 | #ifndef GGIT_VERSION_H 2 | #define GGIT_VERSION_H 3 | 4 | /** 5 | * GGIT_VERSION 6 | * 7 | * libgit2-glib version. 8 | */ 9 | #define GGIT_VERSION (@VERSION@) 10 | 11 | /** 12 | * GGIT_VERSION_S: 13 | * 14 | * libgit2-glib version, encoded as a string, useful for printing and 15 | * concatenation. 16 | */ 17 | #define GGIT_VERSION_S "@VERSION@" 18 | 19 | /** 20 | * GGIT_MAJOR_VERSION: 21 | * 22 | * libgit2-glib major version component (e.g. 1 if %GGIT_VERSION is 1.2.3) 23 | */ 24 | #define GGIT_MAJOR_VERSION (@MAJOR_VERSION@) 25 | 26 | /** 27 | * GGIT_MINOR_VERSION: 28 | * 29 | * libgit2-glib minor version component (e.g. 2 if %GGIT_VERSION is 1.2.3) 30 | */ 31 | #define GGIT_MINOR_VERSION (@MINOR_VERSION@) 32 | 33 | /** 34 | * GGIT_MICRO_VERSION: 35 | * 36 | * libgit2-glib micro version component (e.g. 3 if %GGIT_VERSION is 1.2.3) 37 | */ 38 | #define GGIT_MICRO_VERSION (@MICRO_VERSION@) 39 | 40 | #define GGIT_ENCODE_VERSION(major,minor,micro) \ 41 | ((major) << 24 | (minor) << 16 | (micro) << 8) 42 | 43 | /** 44 | * GGIT_VERSION_HEX: 45 | * 46 | * libgit2-glib version, encoded as an hexadecimal number, useful for 47 | * integer comparisons. 48 | */ 49 | #define GGIT_VERSION_HEX \ 50 | (GGIT_ENCODE_VERSION (GGIT_MAJOR_VERSION, GGIT_MINOR_VERSION, 0)) 51 | 52 | /** 53 | * GGIT_BUILD_TYPE: 54 | * 55 | * The build type of the installed build. 56 | */ 57 | #define GGIT_BUILD_TYPE @BUILD_TYPE@ 58 | 59 | /** 60 | * GGIT_CHECK_VERSION: 61 | * @major: required major version 62 | * @minor: required minor version 63 | * @micro: required micro version 64 | * 65 | * Compile-time version checking. Evaluates to %TRUE if the version 66 | * of libgit2-glib is greater than the required one. 67 | * 68 | */ 69 | #define GGIT_CHECK_VERSION(major,minor,micro) \ 70 | (GGIT_MAJOR_VERSION > (major) || \ 71 | (GGIT_MAJOR_VERSION == (major) && GGIT_MINOR_VERSION > (minor)) || \ 72 | (GGIT_MAJOR_VERSION == (major) && GGIT_MINOR_VERSION == (minor) && \ 73 | GGIT_MICRO_VERSION >= (micro)) \ 74 | ) 75 | 76 | #endif /* GGIT_VERSION_H */ 77 | -------------------------------------------------------------------------------- /libgit2-glib/ggit.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * ggit.h 3 | * This file is part of libgit2-glib 4 | * 5 | * Copyright (C) 2011 - Ignacio Casal Quinteiro 6 | * 7 | * libgit2-glib is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * libgit2-glib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libgit2-glib. If not, see . 19 | */ 20 | 21 | #ifndef __GGIT_H__ 22 | #define __GGIT_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | #include 81 | @GGIT_SSH_INCLUDES@ 82 | #endif 83 | 84 | /* ex:set ts=8 noet: */ 85 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option('gtk_doc', type: 'boolean', value: false, description: 'Enable generating the API reference (depends on GTK-Doc)') 2 | option('introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection') 3 | option('python', type: 'boolean', value: true, description: 'Build with python support') 4 | option('ssh', type: 'boolean', value: true, description: 'Build with libgit2 ssh support') 5 | option('vapi', type: 'boolean', value: true, description: 'Build Vala bindings') 6 | option('translate_windows_paths', type: 'boolean', value: true, description: 'Turn windows paths into Unix paths') 7 | -------------------------------------------------------------------------------- /meson_python_compile.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import subprocess 5 | import sys 6 | 7 | if not os.environ.get('DESTDIR'): 8 | prefix = os.environ['MESON_INSTALL_PREFIX'] 9 | 10 | libdir = os.path.join(prefix, sys.argv[1]) 11 | 12 | print('Byte-compiling python modules...') 13 | subprocess.call([sys.argv[2], '-m', 'compileall', '-f', '-q', libdir]) 14 | 15 | print('Byte-compiling python modules (optimized versions) ...') 16 | subprocess.call([sys.argv[2], '-O', '-m', 'compileall', '-f', '-q', libdir]) 17 | -------------------------------------------------------------------------------- /tests/meson.build: -------------------------------------------------------------------------------- 1 | unit_test = 'repository' 2 | 3 | exe = executable( 4 | unit_test, 5 | unit_test + '.c', 6 | include_directories: top_inc, 7 | dependencies: libgit2_glib_dep, 8 | ) 9 | 10 | test( 11 | unit_test, 12 | exe, 13 | args: ['--tap', '-k'], 14 | ) 15 | -------------------------------------------------------------------------------- /tools/.gitignore: -------------------------------------------------------------------------------- 1 | /*.cache 2 | -------------------------------------------------------------------------------- /tools/clang/__init__.py: -------------------------------------------------------------------------------- 1 | #===- __init__.py - Clang Python Bindings --------------------*- python -*--===# 2 | # 3 | # The LLVM Compiler Infrastructure 4 | # 5 | # This file is distributed under the University of Illinois Open Source 6 | # License. See LICENSE.TXT for details. 7 | # 8 | #===------------------------------------------------------------------------===# 9 | 10 | r""" 11 | Clang Library Bindings 12 | ====================== 13 | 14 | This package provides access to the Clang compiler and libraries. 15 | 16 | The available modules are: 17 | 18 | cindex 19 | 20 | Bindings for the Clang indexing library. 21 | """ 22 | 23 | __all__ = ['cindex'] 24 | 25 | -------------------------------------------------------------------------------- /tools/clang/enumerations.py: -------------------------------------------------------------------------------- 1 | #===- enumerations.py - Python Enumerations ------------------*- python -*--===# 2 | # 3 | # The LLVM Compiler Infrastructure 4 | # 5 | # This file is distributed under the University of Illinois Open Source 6 | # License. See LICENSE.TXT for details. 7 | # 8 | #===------------------------------------------------------------------------===# 9 | 10 | """ 11 | Clang Enumerations 12 | ================== 13 | 14 | This module provides static definitions of enumerations that exist in libclang. 15 | 16 | Enumerations are typically defined as a list of tuples. The exported values are 17 | typically munged into other types or classes at module load time. 18 | 19 | All enumerations are centrally defined in this file so they are all grouped 20 | together and easier to audit. And, maybe even one day this file will be 21 | automatically generated by scanning the libclang headers! 22 | """ 23 | 24 | # Maps to CXTokenKind. Note that libclang maintains a separate set of token 25 | # enumerations from the C++ API. 26 | TokenKinds = [ 27 | ('PUNCTUATION', 0), 28 | ('KEYWORD', 1), 29 | ('IDENTIFIER', 2), 30 | ('LITERAL', 3), 31 | ('COMMENT', 4), 32 | ] 33 | 34 | __all__ = ['TokenKinds'] 35 | --------------------------------------------------------------------------------