Skip to content
Commits on Source (26)
*.bak
*.lo
*.la
*.o
*.gir
*.typelib
*~
*.stamp
.*.sw[nop]
*.gcov
.deps
.libs
Makefile
Makefile.in
/ABOUT-NLS
/aclocal.m4
/autom4te.cache
/config.cache
/config.guess
/config.h
/config.h.in
/config.log
/config.lt
/config.rpath
/config.status
/config.status.lineno
/config.sub
/configure
/configure.lineno
/depcomp
/examples/general
/examples/walk
/gnome-doc-utils.make
/gtk-doc.make
/INSTALL
/install-sh
/intltool-extract
/intltool-extract.in
/intltool-merge
/intltool-merge.in
/intltool-update
/intltool-update.in
/libgit2-glib-1.0.pc
/libgit2-glib-*.tar.bz2
/libgit2-glib/ggit-enum-types.c
/libgit2-glib/ggit-enum-types.h
/libtool
/ltmain.sh
/m4
/missing
/mkinstalldirs
/omf.make
/po/*.header
/po/*.gmo
/po/*.mo
/po/*.sed
/po/*.sin
/po/.intltool-merge-cache
/po/Makefile
/po/Makefile.in
/po/Makefile.in.in
/po/Makevars.template
/po/POTFILES
/po/Rules-quot
/po/stamp-it
/py-compile
/so_locations
/stamp-h1
/tests/repository
/xmldocs.make
image: fedora:34
stages:
- build
before_script:
- dnf install -y gcc meson ninja-build gettext gtk-doc glib2-devel libgit2-devel gobject-introspection-devel vala libssh2-devel
build-libgit2-glib:
stage: build
script:
- meson _build .
- ninja -C _build
- ninja -C _build install
News in 1.0.0.1
---------------
* Fix deprecation
News in 1.0.0
-------------
* Allow diff without repository
* Allow null options on ggit_checkout API
* Invalid path resolving relative path on windows
* Add git_repository_set_head_detached to the public API
* Added a wrapper function for git_remote_prune
* Several meson improvements
* Misc bug fixes
News in 0.99.0.1
----------------
* git_merge: fix their_heads_length parameter
......
......@@ -20,8 +20,8 @@ gobject-introspection 0.9.x.
Simple install procedure:
% tar Jxf libgit2-glib-0.99.0.1.tar.xz # unpack the sources
% cd libgit2-glib-0.99.0.1 # change to the toplevel directory
% tar Jxf libgit2-glib-1.0.0.1.tar.xz # unpack the sources
% cd libgit2-glib-1.0.0.1 # change to the toplevel directory
% meson builddir # run meson
% ninja -C builddir # build libgit2-glib
# [ Become root if necessary ]
......
......@@ -16,7 +16,7 @@ typedef struct
GgitRemoteCallbacks parent;
} Cloner;
static void cloner_class_init (ClonerClass *klass);
GType cloner_get_type (void);
G_DEFINE_TYPE (Cloner, cloner, GGIT_TYPE_REMOTE_CALLBACKS)
......@@ -29,17 +29,16 @@ static void
cloner_transfer_progress (GgitRemoteCallbacks *callbacks,
GgitTransferProgress *stats)
{
guint recvobjs;
guint totobjs;
guint indexobjs;
guint recvobjs, totobjs, indexobjs;
guint network_percent, index_percent, kbytes;
recvobjs = ggit_transfer_progress_get_received_objects (stats);
totobjs = ggit_transfer_progress_get_total_objects (stats);
indexobjs = ggit_transfer_progress_get_indexed_objects (stats);
guint network_percent = totobjs > 0 ? recvobjs * 100 / totobjs : 0;
guint index_percent = totobjs > 0 ? indexobjs * 100 / totobjs : 0;
guint kbytes = ggit_transfer_progress_get_received_bytes (stats) / 1024;
network_percent = totobjs > 0 ? recvobjs * 100 / totobjs : 0;
index_percent = totobjs > 0 ? indexobjs * 100 / totobjs : 0;
kbytes = ggit_transfer_progress_get_received_bytes (stats) / 1024;
g_printf ("\rnet %3d%% (%4d kb, %5d/%5d) / idx %3d%% (%5d/%5d)",
network_percent, kbytes,
......
......@@ -208,12 +208,17 @@ ggit_diff_file_callback_wrapper (const git_diff_delta *delta,
path = ggit_diff_file_get_path (file);
data->encoding =
ggit_repository_get_attribute (priv->repository,
path,
"encoding",
GGIT_ATTRIBUTE_CHECK_FILE_THEN_INDEX,
NULL);
if (priv->repository != NULL)
{
data->encoding =
ggit_repository_get_attribute (priv->repository,
path,
"encoding",
GGIT_ATTRIBUTE_CHECK_FILE_THEN_INDEX,
NULL);
} else {
data->encoding = "UTF-8";
}
}
}
......@@ -963,14 +968,14 @@ ggit_diff_blobs (GgitBlob *old_blob,
* there was no error, %NULL otherwise.
*/
GgitDiff *
ggit_diff_new_buffers (const guint8 *buffer1,
gssize buffer1_len,
const gchar *buffer1_as_path,
const guint8 *buffer2,
gssize buffer2_len,
const gchar *buffer2_as_path,
GgitDiffOptions *diff_options,
GError **error)
ggit_diff_new_buffers (const guint8 *buffer1,
gssize buffer1_len,
const gchar *buffer1_as_path,
const guint8 *buffer2,
gssize buffer2_len,
const gchar *buffer2_as_path,
GgitDiffOptions *diff_options,
GError **error)
{
......@@ -1047,18 +1052,18 @@ ggit_diff_new_buffers (const guint8 *buffer1,
* Same as ggit_diff_blobs() but using a buffer.
*/
void
ggit_diff_blob_to_buffer (GgitBlob *old_blob,
const gchar *old_as_path,
const guint8 *buffer,
gssize buffer_len,
const gchar *buffer_as_path,
GgitDiffOptions *diff_options,
GgitDiffFileCallback file_cb,
GgitDiffBinaryCallback binary_cb,
GgitDiffHunkCallback hunk_cb,
GgitDiffLineCallback line_cb,
gpointer user_data,
GError **error)
ggit_diff_blob_to_buffer (GgitBlob *old_blob,
const gchar *old_as_path,
const guint8 *buffer,
gssize buffer_len,
const gchar *buffer_as_path,
GgitDiffOptions *diff_options,
GgitDiffFileCallback file_cb,
GgitDiffBinaryCallback binary_cb,
GgitDiffHunkCallback hunk_cb,
GgitDiffLineCallback line_cb,
gpointer user_data,
GError **error)
{
gint ret;
const git_diff_options *gdiff_options;
......
......@@ -330,6 +330,7 @@ ggit_index_remove (GgitIndex *idx,
gchar *path;
GgitRepository *repo;
GFile *wd;
GString *gs_path;
g_return_val_if_fail (GGIT_IS_INDEX (idx), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
......@@ -341,6 +342,11 @@ ggit_index_remove (GgitIndex *idx,
g_object_unref (repo);
path = g_file_get_relative_path (wd, file);
#ifdef TRANSLATE_WINDOWS_PATHS
gs_path = g_string_new (path);
g_string_replace (gs_path, "\\", "/", 0);
path = g_string_free (gs_path, FALSE);
#endif
g_object_unref (wd);
g_return_val_if_fail (path != NULL, FALSE);
......@@ -447,6 +453,7 @@ ggit_index_add_file (GgitIndex *idx,
GFile *wd;
gchar *path;
gint ret;
GString *gs_path;
g_return_val_if_fail (GGIT_IS_INDEX (idx), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
......@@ -456,6 +463,11 @@ ggit_index_add_file (GgitIndex *idx,
wd = ggit_repository_get_workdir (repo);
path = g_file_get_relative_path (wd, file);
#ifdef TRANSLATE_WINDOWS_PATHS
gs_path = g_string_new (path);
g_string_replace (gs_path, "\\", "/", 0);
path = g_string_free (gs_path, FALSE);
#endif
g_object_unref (wd);
g_object_unref (repo);
......
......@@ -81,7 +81,7 @@ ggit_object_factory_constructor (GType type,
if (the_instance)
{
return g_object_ref (the_instance);
return G_OBJECT (g_object_ref (the_instance));
}
ret = G_OBJECT_CLASS (ggit_object_factory_parent_class)->constructor (type,
......@@ -185,26 +185,6 @@ ggit_object_factory_unregister (GgitObjectFactory *factory,
}
}
static GParameter *
convert_to_gparameter (GObjectConstructParam *params,
guint num)
{
GParameter *ret;
guint i;
ret = g_new0 (GParameter, num);
for (i = 0; i < num; ++i)
{
ret[i].name = params[i].pspec->name;
g_value_init (&ret[i].value, G_VALUE_TYPE (params[i].value));
g_value_copy (params[i].value, &ret[i].value);
}
return ret;
}
/**
* ggit_object_factory_construct:
* @factory: a #GgitObjectFactory.
......@@ -235,21 +215,36 @@ ggit_object_factory_construct (GgitObjectFactory *factory,
if (val)
{
/* convert construct properties to gparameter and call newv */
GParameter *params;
/* convert construct properties and call new_with_properties */
const char **names;
GValue *values;
guint i;
params = convert_to_gparameter (construct_properties,
n_construct_properties);
names = g_new (const char *, n_construct_properties);
values = g_new0 (GValue, n_construct_properties);
for (i = 0; i < n_construct_properties; ++i)
{
const GValue *value;
names[i] = construct_properties[i].pspec->name;
value = construct_properties[i].value;
g_value_init (&values[i], G_VALUE_TYPE (value));
g_value_copy (value, &values[i]);
}
ret = g_object_newv (val->type, n_construct_properties, params);
ret = g_object_new_with_properties (val->type,
n_construct_properties,
names, values);
for (i = 0; i < n_construct_properties; ++i)
{
g_value_unset (&params[i].value);
g_value_unset (&values[i]);
}
g_free (params);
g_free (names);
g_free (values);
}
else
{
......
......@@ -625,4 +625,31 @@ ggit_remote_upload (GgitRemote *remote,
return TRUE;
}
/**
* ggit_remote_prune:
* @remote: a #GgitRemote.
* @callbacks: the callbacks to use for this connection.
* @error: a #GError for error reporting, or %NULL.
*
* Prune tracking refs that are no longer present on remote.
*/
void
ggit_remote_prune (GgitRemote *remote,
GgitRemoteCallbacks *callbacks,
GError **error)
{
gint ret;
g_return_if_fail (GGIT_IS_REMOTE (remote));
g_return_if_fail (error == NULL || *error == NULL);
ret = git_remote_prune (_ggit_native_get (remote),
_ggit_remote_callbacks_get_native (callbacks));
if (ret != GIT_OK)
{
_ggit_error_set (error, ret);
}
}
/* ex:set ts=8 noet: */
......@@ -115,6 +115,10 @@ gboolean ggit_remote_upload (GgitRemote
GgitPushOptions *push_options,
GError **error);
void ggit_remote_prune (GgitRemote *remote,
GgitRemoteCallbacks *callbacks,
GError **error);
G_END_DECLS
#endif /* __GGIT_REMOTE_H__ */
......
......@@ -942,6 +942,37 @@ ggit_repository_set_head (GgitRepository *repository,
return TRUE;
}
/**
* ggit_repository_set_head_detached:
* @repository: a #GgitRepository.
* @ref_name: canonical name of the reference HEAD should point to.
* @error: a #GError for error reporting, or %NULL.
*
* Returns: %TRUE if head was successfully set, %FALSE otherwise.
*
**/
gboolean
ggit_repository_set_head_detached (GgitRepository *repository,
GgitOId *oid,
GError **error)
{
gint ret;
g_return_val_if_fail (GGIT_IS_REPOSITORY (repository), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
ret = git_repository_set_head_detached (_ggit_native_get(repository),
(const git_oid *)_ggit_oid_get_oid(oid));
if (ret != GIT_OK)
{
_ggit_error_set (error, ret);
return FALSE;
}
return TRUE;
}
/**
* ggit_repository_discover:
* @location: the base location where the lookup starts.
......@@ -3539,7 +3570,7 @@ ggit_repository_checkout_head (GgitRepository *repository,
gint ret;
g_return_val_if_fail (GGIT_IS_REPOSITORY (repository), FALSE);
g_return_val_if_fail (GGIT_IS_CHECKOUT_OPTIONS (options), FALSE);
g_return_val_if_fail (options == NULL || GGIT_IS_CHECKOUT_OPTIONS (options), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
ret = git_checkout_head (_ggit_native_get (repository),
......@@ -3580,7 +3611,7 @@ ggit_repository_checkout_index (GgitRepository *repository,
g_return_val_if_fail (GGIT_IS_REPOSITORY (repository), FALSE);
g_return_val_if_fail (index == NULL || GGIT_IS_INDEX (index), FALSE);
g_return_val_if_fail (GGIT_IS_CHECKOUT_OPTIONS (options), FALSE);
g_return_val_if_fail (options == NULL || GGIT_IS_CHECKOUT_OPTIONS (options), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
ret = git_checkout_index (_ggit_native_get (repository),
......@@ -3622,7 +3653,7 @@ ggit_repository_checkout_tree (GgitRepository *repository,
g_return_val_if_fail (GGIT_IS_REPOSITORY (repository), FALSE);
g_return_val_if_fail (tree == NULL || GGIT_IS_OBJECT (tree), FALSE);
g_return_val_if_fail (GGIT_IS_CHECKOUT_OPTIONS (options), FALSE);
g_return_val_if_fail (options == NULL || GGIT_IS_CHECKOUT_OPTIONS (options), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
ret = git_checkout_tree (_ggit_native_get (repository),
......@@ -4030,8 +4061,9 @@ ggit_repository_merge (GgitRepository *repository,
GgitCheckoutOptions *checkout_opts,
GError **error)
{
gint ret, i;
git_annotated_commit **their_heads_native;
gint ret;
gsize i;
const git_annotated_commit **their_heads_native;
g_return_if_fail (GGIT_IS_REPOSITORY (repository));
g_return_if_fail (their_heads != NULL);
......@@ -4039,7 +4071,7 @@ ggit_repository_merge (GgitRepository *repository,
g_return_if_fail (GGIT_IS_CHECKOUT_OPTIONS (checkout_opts));
g_return_if_fail (error == NULL || *error == NULL);
their_heads_native = g_new0 (git_annotated_commit *, their_heads_length);
their_heads_native = g_new0 (const git_annotated_commit *, their_heads_length);
for (i = 0; i < their_heads_length; ++i)
{
......
......@@ -301,6 +301,10 @@ gboolean ggit_repository_set_head (GgitRepository *re
const gchar *ref_name,
GError **error);
gboolean ggit_repository_set_head_detached (GgitRepository *repository,
GgitOId *oid,
GError **error);
GFile *ggit_repository_discover (GFile *location,
GError **error);
......
......@@ -381,7 +381,7 @@ ggit_signature_get_time_zone (GgitSignature *signature)
time_zone_id = g_strdup_printf ("%s%02i:%02i",
s->when.offset >= 0 ? "+" : "-",
hours, minutes);
time_zone = g_time_zone_new (time_zone_id);
time_zone = g_time_zone_new_identifier (time_zone_id);
g_free (time_zone_id);
......
......@@ -161,7 +161,7 @@ ggit_submodule_update_options_new (void)
return g_object_new (GGIT_TYPE_SUBMODULE_UPDATE_OPTIONS, NULL);
}
const git_submodule_update_options *
git_submodule_update_options *
_ggit_submodule_update_options_get_submodule_update_options (GgitSubmoduleUpdateOptions *options)
{
if (options != NULL)
......
......@@ -37,7 +37,7 @@ struct _GgitSubmoduleUpdateOptionsClass
GObjectClass parent_class;
};
const git_submodule_update_options *
git_submodule_update_options *
_ggit_submodule_update_options_get_submodule_update_options (GgitSubmoduleUpdateOptions *options);
GgitSubmoduleUpdateOptions *ggit_submodule_update_options_new (void);
......
project(
'libgit2-glib', 'c',
version: '0.99.0.1',
version: '1.0.0.1',
default_options: 'buildtype=debugoptimized',
license: 'LGPL2+',
meson_version: '>= 0.49.0',
......@@ -99,12 +99,14 @@ else
]
endif
# Workaround for meson's bug
# https://github.com/mesonbuild/meson/pull/1896
if get_option('b_ndebug') == 'true'
if ['true', 'if-release'].contains(get_option('b_ndebug'))
common_flags += ['-DG_DISABLE_ASSERT']
endif
if get_option('translate_windows_paths')
common_flags += ['-DTRANSLATE_WINDOWS_PATHS']
endif
add_project_arguments(common_flags, language: 'c')
if cc.has_link_argument('-Wl,-Bsymbolic-functions')
......
......@@ -3,3 +3,4 @@ option('introspection', type: 'boolean', value: true, description: 'Enable GObje
option('python', type: 'boolean', value: true, description: 'Build with python support')
option('ssh', type: 'boolean', value: true, description: 'Build with libgit2 ssh support')
option('vapi', type: 'boolean', value: true, description: 'Build Vala bindings')
option('translate_windows_paths', type: 'boolean', value: true, description: 'Turn windows paths into Unix paths')
......@@ -8,7 +8,7 @@ if not os.environ.get('DESTDIR'):
libdir = sys.argv[1]
print('Byte-compiling python modules...')
subprocess.call(['python3', '-m', 'compileall', '-f', '-q', libdir])
subprocess.check_call(['python3', '-m', 'compileall', '-f', '-q', libdir])
print('Byte-compiling python modules (optimized versions) ...')
subprocess.call(['python3', '-O', '-m', 'compileall', '-f', '-q', libdir])
subprocess.check_call(['python3', '-O', '-m', 'compileall', '-f', '-q', libdir])
#!/usr/bin/env python3
import os
import subprocess
import shutil
import sys
vapidir = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], sys.argv[1], 'vala', 'vapi')
datadir = sys.argv[1]
destdir = os.environ.get('DESTDIR')
if destdir:
datadir = os.path.splitdrive(datadir)[1].lstrip(os.path.sep)
datadir = os.path.join(destdir, datadir)
vapidir = os.path.join(datadir, 'vala', 'vapi')
os.chdir(vapidir)
# FIXME: meson will not track the creation of these files
# https://github.com/mesonbuild/meson/blob/master/mesonbuild/scripts/uninstall.py#L39
old = 'ggit-1.0'
new = 'libgit2-glib-1.0'
wd = os.getcwd()
os.chdir(vapidir)
for ext in ['vapi', 'deps']:
src = os.path.join('{}.{}'.format(new, ext))
dest = os.path.join('{}.{}'.format(old, ext))
subprocess.call(['ln', '-s', '-f', src, dest])
os.chdir(wd)
src = '{}.{}'.format(new, ext)
dest = '{}.{}'.format(old, ext)
try:
os.symlink(src, dest)
except OSError:
shutil.copy(src, dest)
......@@ -73,7 +73,7 @@ _g_mkdtemp (gchar *tmpl)
static const int NLETTERS = sizeof (letters) - 1;
static int counter = 0;
char *XXXXXX;
GTimeVal tv;
gint64 time;
glong value;
int count;
......@@ -87,8 +87,8 @@ _g_mkdtemp (gchar *tmpl)
}
/* Get some more or less random data. */
g_get_current_time (&tv);
value = (tv.tv_usec ^ tv.tv_sec) + counter++;
time = g_get_real_time ();
value = ((time % G_USEC_PER_SEC) ^ (time / G_USEC_PER_SEC)) + counter++;
for (count = 0; count < 100; value += 7777, ++count)
{
......