[Xfce4-commits] <thunar-vcs-plugin:master> Supply --no-pager to git commands.

Peter de Ridder noreply at xfce.org
Mon Dec 7 01:00:01 CET 2009


Updating branch refs/heads/master
         to 796cb565a69eb7f417a8ea66d6e12f9861106d5d (commit)
       from 57416ad99991e2483e496cbf3b0bd59a7ea9d8a9 (commit)

commit 796cb565a69eb7f417a8ea66d6e12f9861106d5d
Author: Peter de Ridder <peter at xfce.org>
Date:   Sun Dec 6 12:18:32 2009 +0100

    Supply --no-pager to git commands.
    
    This way git won't use a pager, if it for some reason wouldn't be able
    to see that the pipe isn't a terminal.

 tvp-git-helper/tgh-add.c                   |   11 ++--
 tvp-git-helper/tgh-blame.c                 |   11 ++--
 tvp-git-helper/tgh-branch.c                |    2 +-
 tvp-git-helper/tgh-clean.c                 |    7 ++-
 tvp-git-helper/tgh-clone.c                 |   13 +++--
 tvp-git-helper/tgh-file-selection-dialog.c |    2 +-
 tvp-git-helper/tgh-log.c                   |   15 +++---
 tvp-git-helper/tgh-move.c                  |    7 ++-
 tvp-git-helper/tgh-reset.c                 |   11 ++--
 tvp-git-helper/tgh-stash.c                 |   69 +++++++++++++++-------------
 tvp-git-helper/tgh-status.c                |    2 +-
 11 files changed, 81 insertions(+), 69 deletions(-)

diff --git a/tvp-git-helper/tgh-add.c b/tvp-git-helper/tgh-add.c
index 1ac5351..deb782e 100644
--- a/tvp-git-helper/tgh-add.c
+++ b/tvp-git-helper/tgh-add.c
@@ -44,18 +44,19 @@ static gboolean add_spawn (GtkWidget *dialog, gchar **files, GPid *pid)
   gint i;
   gchar **argv;
 
-  length = 5;
+  length = 6;
   length += g_strv_length(files);
 
   argv = g_new(gchar*, length);
 
   argv[0] = "git";
-  argv[1] = "add";
-  argv[2] = "-v";
-  argv[3] = "--";
+  argv[1] = "--no-pager";
+  argv[2] = "add";
+  argv[3] = "-v";
+  argv[4] = "--";
   argv[length-1] = NULL;
 
-  i = 4;
+  i = 5;
   while(*files)
     argv[i++] = *files++;
 
diff --git a/tvp-git-helper/tgh-blame.c b/tvp-git-helper/tgh-blame.c
index 61b3b2e..81c3ae7 100644
--- a/tvp-git-helper/tgh-blame.c
+++ b/tvp-git-helper/tgh-blame.c
@@ -41,13 +41,14 @@ static gboolean blame_spawn (GtkWidget *dialog, gchar *file, GPid *pid)
   TghOutputParser *parser;
   gchar **argv;
 
-  argv = g_new (gchar*, 5);
+  argv = g_new (gchar*, 6);
 
   argv[0] = "git";
-  argv[1] = "blame";
-  argv[2] = "--";
-  argv[3] = file;
-  argv[4] = NULL;
+  argv[1] = "--no-pager";
+  argv[2] = "blame";
+  argv[3] = "--";
+  argv[4] = file;
+  argv[5] = NULL;
 
   if (!g_spawn_async_with_pipes (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, NULL, NULL, pid, NULL, &fd_out, &fd_err, &error))
   {
diff --git a/tvp-git-helper/tgh-branch.c b/tvp-git-helper/tgh-branch.c
index 9e3c652..b8b5f9e 100644
--- a/tvp-git-helper/tgh-branch.c
+++ b/tvp-git-helper/tgh-branch.c
@@ -33,7 +33,7 @@
 
 #include "tgh-branch.h"
 
-static gchar *argv[] = {"git", "branch", NULL};
+static gchar *argv[] = {"git", "--no-pager", "branch", NULL};
 
 static gboolean branch_spawn (TghBranchDialog *dialog, GPid *pid)
 {
diff --git a/tvp-git-helper/tgh-clean.c b/tvp-git-helper/tgh-clean.c
index 632ee5c..7f545a8 100644
--- a/tvp-git-helper/tgh-clean.c
+++ b/tvp-git-helper/tgh-clean.c
@@ -52,7 +52,7 @@ static gboolean clean_spawn (GtkWidget *dialog, gchar **files, gboolean direcotr
   gint i;
   gchar **argv;
 
-  length = 4;
+  length = 5;
   if (direcotries)
     length++;
   if (ignore != TGH_CLEAN_IGNORE_EXCLUDE)
@@ -64,10 +64,11 @@ static gboolean clean_spawn (GtkWidget *dialog, gchar **files, gboolean direcotr
   argv = g_new (gchar*, length);
 
   argv[0] = "git";
-  argv[1] = "clean";
+  argv[1] = "--no-pager";
+  argv[2] = "clean";
   argv[length-1] = NULL;
 
-  i = 2;
+  i = 3;
   if (direcotries)
     argv[i++] = "-d";
   switch (ignore)
diff --git a/tvp-git-helper/tgh-clone.c b/tvp-git-helper/tgh-clone.c
index 76ccfd5..a9a53db 100644
--- a/tvp-git-helper/tgh-clone.c
+++ b/tvp-git-helper/tgh-clone.c
@@ -73,14 +73,15 @@ static gboolean clone_spawn (GtkWidget *dialog, gchar *repository, gchar *path,
   gchar **argv;
   struct exit_args *args;
 
-  argv = g_new(gchar*, 6);
+  argv = g_new(gchar*, 7);
 
   argv[0] = "git";
-  argv[1] = "clone";
-  argv[2] = "--";
-  argv[3] = repository;
-  argv[4] = path;
-  argv[5] = NULL;
+  argv[1] = "--no-pager";
+  argv[2] = "clone";
+  argv[3] = "--";
+  argv[4] = repository;
+  argv[5] = path;
+  argv[6] = NULL;
 
   if(!g_spawn_async_with_pipes(NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, NULL, NULL, pid, NULL, NULL, &fd_err, &error))
   {
diff --git a/tvp-git-helper/tgh-file-selection-dialog.c b/tvp-git-helper/tgh-file-selection-dialog.c
index caa2150..15aadd2 100644
--- a/tvp-git-helper/tgh-file-selection-dialog.c
+++ b/tvp-git-helper/tgh-file-selection-dialog.c
@@ -54,7 +54,7 @@ struct _TghFileSelectionDialogClass
 
 G_DEFINE_TYPE (TghFileSelectionDialog, tgh_file_selection_dialog, GTK_TYPE_DIALOG)
 
-static gchar *argv[] = {"git", "status", NULL};
+static gchar *argv[] = {"git", "--no-pager", "status", NULL};
 
 static void
 tgh_file_selection_dialog_class_init (TghFileSelectionDialogClass *klass)
diff --git a/tvp-git-helper/tgh-log.c b/tvp-git-helper/tgh-log.c
index f9d1918..403fe4f 100644
--- a/tvp-git-helper/tgh-log.c
+++ b/tvp-git-helper/tgh-log.c
@@ -43,21 +43,22 @@ static gboolean log_spawn (TghLogDialog *dialog, gchar **files, GPid *pid)
   gint i;
   gchar **argv;
 
-  length = 7;
+  length = 8;
   if(files)
     length += g_strv_length(files);
 
   argv = g_new(gchar*, length);
 
   argv[0] = "git";
-  argv[1] = "log";
-  argv[2] = "--numstat";
-  argv[3] = "--pretty=fuller";
-  argv[4] = "--boundary";
-  argv[5] = "--";
+  argv[1] = "--no-pager";
+  argv[2] = "log";
+  argv[3] = "--numstat";
+  argv[4] = "--parents";
+  argv[5] = "--pretty=fuller";
+  argv[6] = "--";
   argv[length-1] = NULL;
 
-  i = 6;
+  i = 7;
   if(files)
     while(*files)
       argv[i++] = *files++;
diff --git a/tvp-git-helper/tgh-move.c b/tvp-git-helper/tgh-move.c
index 9b8cd6b..5c90635 100644
--- a/tvp-git-helper/tgh-move.c
+++ b/tvp-git-helper/tgh-move.c
@@ -75,16 +75,17 @@ static gboolean move_spawn (GtkWidget *dialog, gchar **files, gchar *dest, GPid
   gchar **argv;
   struct exit_args *args;
 
-  length = 4;
+  length = 5;
   length += g_strv_length (files);
 
   argv = g_new (gchar*, length);
 
   argv[0] = "git";
-  argv[1] = "mv";
+  argv[1] = "--no-pager";
+  argv[2] = "mv";
   argv[length-1] = NULL;
 
-  i = 2;
+  i = 3;
   while (*files)
     argv[i++] = *files++;
 
diff --git a/tvp-git-helper/tgh-reset.c b/tvp-git-helper/tgh-reset.c
index 10300dc..9ea408b 100644
--- a/tvp-git-helper/tgh-reset.c
+++ b/tvp-git-helper/tgh-reset.c
@@ -75,18 +75,19 @@ static gboolean reset_spawn (GtkWidget *dialog, gchar **files, GPid *pid)
   gchar **argv;
   struct exit_args *args;
 
-  length = 5;
+  length = 6;
   length += g_strv_length(files);
 
   argv = g_new(gchar*, length);
 
   argv[0] = "git";
-  argv[1] = "reset";
-  argv[2] = "-q";
-  argv[3] = "--";
+  argv[1] = "--no-pager";
+  argv[2] = "reset";
+  argv[3] = "-q";
+  argv[4] = "--";
   argv[length-1] = NULL;
 
-  i = 4;
+  i = 5;
   while(*files)
     argv[i++] = *files++;
 
diff --git a/tvp-git-helper/tgh-stash.c b/tvp-git-helper/tgh-stash.c
index ee87cd9..fd6945e 100644
--- a/tvp-git-helper/tgh-stash.c
+++ b/tvp-git-helper/tgh-stash.c
@@ -55,8 +55,8 @@ static void child_exit (GPid pid, gint status, gpointer user_data)
   g_free (args);
 }
 
-static gchar *argv_list[] = {"git", "stash", "list", NULL};
-static gchar *argv_clear[] = {"git", "stash", "clear", NULL};
+static gchar *argv_list[] = {"git", "--no-pager", "stash", "list", NULL};
+static gchar *argv_clear[] = {"git", "--no-pager", "stash", "clear", NULL};
 
 static gboolean stash_list_spawn (TghStashDialog *dialog, GPid *pid)
 {
@@ -90,14 +90,15 @@ static gboolean stash_show_spawn (TghStashDialog *dialog, const gchar *name, GPi
   TghOutputParser *parser;
   gchar **argv;
 
-  argv = g_new (gchar*, 6);
+  argv = g_new (gchar*, 7);
 
   argv[0] = "git";
-  argv[1] = "stash";
-  argv[2] = "show";
-  argv[3] = "--numstat";
-  argv[4] = (gchar*)name;
-  argv[5] = NULL;
+  argv[1] = "--no-pager";
+  argv[2] = "stash";
+  argv[3] = "show";
+  argv[4] = "--numstat";
+  argv[5] = (gchar*)name;
+  argv[6] = NULL;
 
   if (!g_spawn_async_with_pipes (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, NULL, NULL, pid, NULL, &fd_out, &fd_err, &error))
   {
@@ -127,14 +128,15 @@ static gboolean stash_save_spawn (TghStashDialog *dialog, const gchar *name, GPi
   gchar **argv;
   struct exit_args *args;
 
-  argv = g_new (gchar*, 6);
+  argv = g_new (gchar*, 7);
 
   argv[0] = "git";
-  argv[1] = "stash";
-  argv[2] = "save";
-  argv[3] = "-q";
-  argv[4] = (gchar*)name;
-  argv[5] = NULL;
+  argv[1] = "--no-pager";
+  argv[2] = "stash";
+  argv[3] = "save";
+  argv[4] = "-q";
+  argv[5] = (gchar*)name;
+  argv[6] = NULL;
 
   if (!g_spawn_async_with_pipes (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, NULL, NULL, pid, NULL, NULL, &fd_err, &error))
   {
@@ -166,14 +168,15 @@ static gboolean stash_apply_spawn (TghStashDialog *dialog, const gchar *name, GP
   gchar **argv;
   struct exit_args *args;
 
-  argv = g_new (gchar*, 6);
+  argv = g_new (gchar*, 7);
 
   argv[0] = "git";
-  argv[1] = "stash";
-  argv[2] = "apply";
-  argv[3] = "-q";
-  argv[4] = (gchar*)name;
-  argv[5] = NULL;
+  argv[1] = "--no-pager";
+  argv[2] = "stash";
+  argv[3] = "apply";
+  argv[4] = "-q";
+  argv[5] = (gchar*)name;
+  argv[6] = NULL;
 
   if (!g_spawn_async_with_pipes (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, NULL, NULL, pid, NULL, NULL, &fd_err, &error))
   {
@@ -205,14 +208,15 @@ static gboolean stash_pop_spawn (TghStashDialog *dialog, const gchar *name, GPid
   gchar **argv;
   struct exit_args *args;
 
-  argv = g_new (gchar*, 6);
+  argv = g_new (gchar*, 7);
 
   argv[0] = "git";
-  argv[1] = "stash";
-  argv[2] = "pop";
-  argv[3] = "-q";
-  argv[4] = (gchar*)name;
-  argv[5] = NULL;
+  argv[1] = "--no-pager";
+  argv[2] = "stash";
+  argv[3] = "pop";
+  argv[4] = "-q";
+  argv[5] = (gchar*)name;
+  argv[6] = NULL;
 
   if (!g_spawn_async_with_pipes (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, NULL, NULL, pid, NULL, NULL, &fd_err, &error))
   {
@@ -244,14 +248,15 @@ static gboolean stash_drop_spawn (TghStashDialog *dialog, const gchar *name, GPi
   gchar **argv;
   struct exit_args *args;
 
-  argv = g_new (gchar*, 6);
+  argv = g_new (gchar*, 7);
 
   argv[0] = "git";
-  argv[1] = "stash";
-  argv[2] = "drop";
-  argv[3] = "-q";
-  argv[4] = (gchar*)name;
-  argv[5] = NULL;
+  argv[1] = "--no-pager";
+  argv[2] = "stash";
+  argv[3] = "drop";
+  argv[4] = "-q";
+  argv[5] = (gchar*)name;
+  argv[6] = NULL;
 
   if (!g_spawn_async_with_pipes (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, NULL, NULL, pid, NULL, NULL, &fd_err, &error))
   {
diff --git a/tvp-git-helper/tgh-status.c b/tvp-git-helper/tgh-status.c
index 330ed1c..8b065f5 100644
--- a/tvp-git-helper/tgh-status.c
+++ b/tvp-git-helper/tgh-status.c
@@ -33,7 +33,7 @@
 
 #include "tgh-status.h"
 
-static gchar *argv[] = {"git", "status", NULL};
+static gchar *argv[] = {"git", "--no-pager", "status", NULL};
 
 static gboolean status_spawn (TghStatusDialog *dialog, GPid *pid)
 {



More information about the Xfce4-commits mailing list