[client] Don't popup "auto merge" notifications.

This commit is contained in:
Jiaqiang Xu 2014-02-20 11:08:17 +08:00
parent d62b9025da
commit 07c1d0524e

View File

@ -410,6 +410,47 @@ static const char *sync_state_str[] = {
"cancel pending"
};
static gboolean
find_meaningful_commit (SeafCommit *commit, void *data, gboolean *stop)
{
SeafCommit **p_head = data;
if (commit->second_parent_id && commit->new_merge && !commit->conflict)
return TRUE;
*stop = TRUE;
seaf_commit_ref (commit);
*p_head = commit;
return TRUE;
}
static void
notify_sync (SeafRepo *repo)
{
SeafCommit *head = NULL;
if (!seaf_commit_manager_traverse_commit_tree (seaf->commit_mgr,
repo->head->commit_id,
find_meaningful_commit,
&head, FALSE)) {
seaf_warning ("Failed to traverse commit tree of %.8s.\n", repo->id);
return;
}
if (!head)
return;
GString *buf = g_string_new (NULL);
g_string_append_printf (buf, "%s\t%s\t%s",
repo->name,
repo->id,
head->desc);
seaf_mq_manager_publish_notification (seaf->mq_mgr,
"sync.done",
buf->str);
g_string_free (buf, TRUE);
seaf_commit_unref (head);
}
static inline void
transition_sync_state (SyncTask *task, int new_state)
{
@ -429,21 +470,7 @@ transition_sync_state (SyncTask *task, int new_state)
new_state == SYNC_STATE_DONE &&
need_notify_sync(task->repo))
{
SeafCommit *head;
head = seaf_commit_manager_get_commit (seaf->commit_mgr,
task->repo->head->commit_id);
if (head) {
GString *buf = g_string_new (NULL);
g_string_append_printf (buf, "%s\t%s\t%s",
task->repo->name,
task->repo->id,
head->desc);
seaf_mq_manager_publish_notification (seaf->mq_mgr,
"sync.done",
buf->str);
g_string_free (buf, TRUE);
seaf_commit_unref (head);
}
notify_sync (task->repo);
}
task->state = new_state;