Also support pushing code
This commit is contained in:
parent
aa1f5af82f
commit
b56dc6f382
|
@ -83,6 +83,7 @@ static void _git_on_diff(gpointer data);
|
|||
static void _git_on_init(gpointer data);
|
||||
static void _git_on_log(gpointer data);
|
||||
static void _git_on_pull(gpointer data);
|
||||
static void _git_on_push(gpointer data);
|
||||
static void _git_on_status(gpointer data);
|
||||
|
||||
|
||||
|
@ -171,6 +172,9 @@ static Git * _git_init(BrowserPluginHelper * helper)
|
|||
widget = _init_button(group, GTK_STOCK_REFRESH, _("Pull"),
|
||||
G_CALLBACK(_git_on_pull), git);
|
||||
gtk_box_pack_start(GTK_BOX(git->directory), widget, FALSE, TRUE, 0);
|
||||
widget = _init_button(group, GTK_STOCK_CONNECT, _("Push"),
|
||||
G_CALLBACK(_git_on_push), git);
|
||||
gtk_box_pack_start(GTK_BOX(git->directory), widget, FALSE, TRUE, 0);
|
||||
widget = _init_button(group, GTK_STOCK_JUMP_TO, _("Commit"),
|
||||
G_CALLBACK(_git_on_commit), git);
|
||||
gtk_box_pack_start(GTK_BOX(git->directory), widget, FALSE, TRUE, 0);
|
||||
|
@ -199,6 +203,9 @@ static Git * _git_init(BrowserPluginHelper * helper)
|
|||
widget = _init_button(group, GTK_STOCK_REFRESH, _("Pull"),
|
||||
G_CALLBACK(_git_on_pull), git);
|
||||
gtk_box_pack_start(GTK_BOX(git->file), widget, FALSE, TRUE, 0);
|
||||
widget = _init_button(group, GTK_STOCK_CONNECT, _("Push"),
|
||||
G_CALLBACK(_git_on_push), git);
|
||||
gtk_box_pack_start(GTK_BOX(git->file), widget, FALSE, TRUE, 0);
|
||||
widget = _init_button(group, GTK_STOCK_JUMP_TO, _("Commit"),
|
||||
G_CALLBACK(_git_on_commit), git);
|
||||
gtk_box_pack_start(GTK_BOX(git->file), widget, FALSE, TRUE, 0);
|
||||
|
@ -566,6 +573,28 @@ static void _git_on_pull(gpointer data)
|
|||
}
|
||||
|
||||
|
||||
/* git_on_push */
|
||||
static void _git_on_push(gpointer data)
|
||||
{
|
||||
Git * git = data;
|
||||
struct stat st;
|
||||
gchar * dirname;
|
||||
gchar * basename;
|
||||
char * argv[] = { "git", "push", "--", NULL, NULL };
|
||||
|
||||
if(git->filename == NULL || lstat(git->filename, &st) != 0)
|
||||
return;
|
||||
dirname = S_ISDIR(st.st_mode) ? g_strdup(git->filename)
|
||||
: g_path_get_dirname(git->filename);
|
||||
basename = S_ISDIR(st.st_mode) ? NULL
|
||||
: g_path_get_basename(git->filename);
|
||||
argv[3] = basename;
|
||||
_git_add_task(git, "git push", dirname, argv, NULL);
|
||||
g_free(basename);
|
||||
g_free(dirname);
|
||||
}
|
||||
|
||||
|
||||
/* git_on_status */
|
||||
static void _git_on_status(gpointer data)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user