[gitg] Force UTF-8 encoding for 'log' and 'show'



commit 6c4dd2cfd645f5f2263beb95cc89c1417f02c5ee
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sat Aug 29 12:37:43 2009 +0200

    Force UTF-8 encoding for 'log' and 'show'

 gitg/gitg-commit-view.c        |    2 +-
 gitg/gitg-repository.c         |   10 ++++++----
 gitg/gitg-revision-tree-view.c |    4 ++--
 gitg/gitg-revision-view.c      |    2 +-
 4 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/gitg/gitg-commit-view.c b/gitg/gitg-commit-view.c
index 301be06..b8b9585 100644
--- a/gitg/gitg-commit-view.c
+++ b/gitg/gitg-commit-view.c
@@ -511,7 +511,7 @@ staged_selection_changed(GtkTreeSelection *selection, GitgCommitView *view)
 			connect_update(view);
 
 			gchar *indexpath = g_strconcat(":0:", path, NULL);
-			gitg_repository_run_commandv(view->priv->repository, view->priv->runner, NULL, "show", indexpath, NULL);
+			gitg_repository_run_commandv(view->priv->repository, view->priv->runner, NULL, "show", "--encoding=UTF-8", indexpath, NULL);
 			g_free(indexpath);
 		}
 		
diff --git a/gitg/gitg-repository.c b/gitg/gitg-repository.c
index ea6e8b7..1c7c7e7 100644
--- a/gitg/gitg-repository.c
+++ b/gitg/gitg-repository.c
@@ -1007,13 +1007,13 @@ reload_revisions(GitgRepository *repository, GError **error)
 	
 	repository->priv->load_stage = LOAD_STAGE_STASH;
 	
-	return gitg_repository_run_commandv(repository, repository->priv->loader, error, "log", "--pretty=format:%H\x01%an\x01%s\x01%at", "-g", "refs/stash", NULL);
+	return gitg_repository_run_commandv(repository, repository->priv->loader, error, "log", "--pretty=format:%H\x01%an\x01%s\x01%at", "--encoding=UTF-8", "-g", "refs/stash", NULL);
 }
 
 static void
 build_log_args(GitgRepository *self, gint argc, gchar const **av)
 {
-	gchar **argv = g_new0(gchar *, 5 + (argc > 0 ? argc - 1 : 0));
+	gchar **argv = g_new0(gchar *, 6 + (argc > 0 ? argc - 1 : 0));
 
 	argv[0] = g_strdup("log");
 	
@@ -1026,6 +1026,8 @@ build_log_args(GitgRepository *self, gint argc, gchar const **av)
 		argv[1] = g_strdup("--pretty=format:%H\x01%an\x01%s\x01%P\x01%at");
 	}
 	
+	argv[2] = g_strdup ("--encoding=UTF-8");
+	
 	gchar *head = NULL;
 	
 	if (argc <= 0)
@@ -1034,7 +1036,7 @@ build_log_args(GitgRepository *self, gint argc, gchar const **av)
 		
 		if (head)
 		{
-			argv[2] = g_strdup("HEAD");
+			argv[3] = g_strdup("HEAD");
 		}
 		
 		g_free(head);
@@ -1045,7 +1047,7 @@ build_log_args(GitgRepository *self, gint argc, gchar const **av)
 
 		for (i = 0; i < argc; ++i)
 		{
-			argv[2 + i] = g_strdup(av[i]);
+			argv[3 + i] = g_strdup(av[i]);
 		}
 	}
 
diff --git a/gitg/gitg-revision-tree-view.c b/gitg/gitg-revision-tree-view.c
index f0d30d7..bd8d26e 100644
--- a/gitg/gitg-revision-tree-view.c
+++ b/gitg/gitg-revision-tree-view.c
@@ -232,7 +232,7 @@ on_selection_changed(GtkTreeSelection *selection, GitgRevisionTreeView *tree)
 		gtk_source_buffer_set_language(GTK_SOURCE_BUFFER(buffer), language);
 		
 		gchar *id = node_identity(tree, &iter);
-		gitg_repository_run_commandv(tree->priv->repository, tree->priv->content_runner, NULL, "show", id, NULL);
+		gitg_repository_run_commandv(tree->priv->repository, tree->priv->content_runner, NULL, "show", "--encoding=UTF-8", id, NULL);
 		
 		g_free(id);
 	}
@@ -695,7 +695,7 @@ load_node(GitgRevisionTreeView *tree, GtkTreeIter *parent)
 		tree->priv->load_path = NULL;
 
 	tree->priv->skipped_blank_line = FALSE;
-	gitg_repository_run_commandv(tree->priv->repository, tree->priv->loader, NULL, "show", id, NULL);
+	gitg_repository_run_commandv(tree->priv->repository, tree->priv->loader, NULL, "show", "--encoding=UTF-8", id, NULL);
 	g_free(id);
 }
 
diff --git a/gitg/gitg-revision-view.c b/gitg/gitg-revision-view.c
index 6138a27..1e644b0 100644
--- a/gitg/gitg-revision-view.c
+++ b/gitg/gitg-revision-view.c
@@ -562,7 +562,7 @@ on_diff_end_loading(GitgRunner *runner, gboolean cancelled, GitgRevisionView *se
 	{
 		gchar *sha = gitg_revision_get_sha1(self->priv->revision);
 		gitg_repository_run_commandv(self->priv->repository, self->priv->diff_files_runner, NULL,
-								 "show", "--raw", "-M", "--pretty=format:", "--abbrev=40", sha, NULL);
+								 "show", "--encoding=UTF-8", "--raw", "-M", "--pretty=format:", "--abbrev=40", sha, NULL);
 		g_free(sha);
 	}
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]