[libgit2-glib] Allow diff without repository
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Allow diff without repository
- Date: Wed, 22 Dec 2021 22:47:24 +0000 (UTC)
commit 8f8ae68a85011fceb944575488aa3a94458e8eea
Author: Alberto Fanjul <albertofanjul gmail com>
Date: Wed Dec 22 23:46:40 2021 +0100
Allow diff without repository
libgit2-glib/ggit-diff.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/libgit2-glib/ggit-diff.c b/libgit2-glib/ggit-diff.c
index d6c0f1a..06e0657 100644
--- a/libgit2-glib/ggit-diff.c
+++ b/libgit2-glib/ggit-diff.c
@@ -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";
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]