commit - d0275cf721b0a74c20c210cf04b585c770e55109
commit + e620954619292de6ad76df32021946b9d6aa168c
blob - 86376ee292ee135f052fc9d6e3b2af6794462a1f
blob + 1242a086fa287cd6d80a920af5d192decb4eb1b1
--- got/got.c
+++ got/got.c
#include "got_reference.h"
#include "got_repository.h"
#include "got_path.h"
+#include "got_cancel.h"
#include "got_worktree.h"
#include "got_diff.h"
#include "got_commit_graph.h"
blob - /dev/null
blob + feffaf3ce97363f7cedaaba16d6d781e777e2838 (mode 644)
--- /dev/null
+++ include/got_cancel.h
+/*
+ * Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * A callback function which is invoked at cancellation points.
+ * May return GOT_ERR_CANCELLED to abort the runing operation.
+ */
+typedef const struct got_error *(*got_cancel_cb)(void *);
blob - 1a7f2a24bda27f5261331d7f5788b4a0b5ccdf91
blob + 1bd4eff4c92e7c57dc9166775ec5c8efd2916fec
--- include/got_worktree.h
+++ include/got_worktree.h
typedef const struct got_error *(*got_worktree_checkout_cb)(void *,
unsigned char, const char *);
-/* A callback function which is invoked at cancellation points.
- * May return GOT_ERR_CANCELLED to abort the runing operation. */
-typedef const struct got_error *(*got_worktree_cancel_cb)(void *);
-
/*
* Attempt to check out files into a work tree from its associated repository
* and path prefix, and update the work tree's file index accordingly.
*/
const struct got_error *got_worktree_checkout_files(struct got_worktree *,
struct got_pathlist_head *, struct got_repository *,
- got_worktree_checkout_cb, void *, got_worktree_cancel_cb, void *);
+ got_worktree_checkout_cb, void *, got_cancel_cb, void *);
/* Merge the differences between two commits into a work tree. */
const struct got_error *
got_worktree_merge_files(struct got_worktree *,
struct got_object_id *, struct got_object_id *,
struct got_repository *, got_worktree_checkout_cb, void *,
- got_worktree_cancel_cb, void *);
+ got_cancel_cb, void *);
/* A callback function which is invoked to report a path's status. */
typedef const struct got_error *(*got_worktree_status_cb)(void *,
*/
const struct got_error *got_worktree_status(struct got_worktree *,
struct got_pathlist_head *, struct got_repository *,
- got_worktree_status_cb, void *, got_worktree_cancel_cb cancel_cb, void *);
+ got_worktree_status_cb, void *, got_cancel_cb cancel_cb, void *);
/*
* Try to resolve a user-provided path to an on-disk path in the work tree.
const struct got_error *got_worktree_rebase_merge_files(
struct got_pathlist_head *, struct got_worktree *, struct got_fileindex *,
struct got_object_id *, struct got_object_id *, struct got_repository *,
- got_worktree_checkout_cb, void *, got_worktree_cancel_cb, void *);
+ got_worktree_checkout_cb, void *, got_cancel_cb, void *);
/*
* Commit changes merged by got_worktree_rebase_merge_files() to a temporary
const struct got_error *got_worktree_histedit_merge_files(
struct got_pathlist_head *, struct got_worktree *, struct got_fileindex *,
struct got_object_id *, struct got_object_id *, struct got_repository *,
- got_worktree_checkout_cb, void *, got_worktree_cancel_cb, void *);
+ got_worktree_checkout_cb, void *, got_cancel_cb, void *);
/*
* Commit changes merged by got_worktree_histedit_merge_files() to a temporary
blob - 293708998a14514dfef24428b4aa26e8e2c97ffc
blob + 6b47a6ca6cbe47ad06ff20e0a5afee543df08851
--- lib/repository.c
+++ lib/repository.c
#include "got_reference.h"
#include "got_repository.h"
#include "got_path.h"
+#include "got_cancel.h"
#include "got_worktree.h"
#include "got_object.h"
blob - 715b19e7c0796c190b6a68be4e36bcb3dde4df4d
blob + 30b65e930802c67ccebb4b4023d1ba02f176761e
--- lib/worktree.c
+++ lib/worktree.c
#include "got_reference.h"
#include "got_object.h"
#include "got_path.h"
+#include "got_cancel.h"
#include "got_worktree.h"
#include "got_opentemp.h"
#include "got_diff.h"
struct got_repository *repo;
got_worktree_checkout_cb progress_cb;
void *progress_arg;
- got_worktree_cancel_cb cancel_cb;
+ got_cancel_cb cancel_cb;
void *cancel_arg;
};
checkout_files(struct got_worktree *worktree, struct got_fileindex *fileindex,
const char *relpath, struct got_object_id *tree_id, const char *entry_name,
struct got_repository *repo, got_worktree_checkout_cb progress_cb,
- void *progress_arg, got_worktree_cancel_cb cancel_cb, void *cancel_arg)
+ void *progress_arg, got_cancel_cb cancel_cb, void *cancel_arg)
{
const struct got_error *err = NULL;
struct got_commit_object *commit = NULL;
got_worktree_checkout_files(struct got_worktree *worktree,
struct got_pathlist_head *paths, struct got_repository *repo,
got_worktree_checkout_cb progress_cb, void *progress_arg,
- got_worktree_cancel_cb cancel_cb, void *cancel_arg)
+ got_cancel_cb cancel_cb, void *cancel_arg)
{
const struct got_error *err = NULL, *sync_err, *unlockerr;
struct got_commit_object *commit = NULL;
struct got_fileindex *fileindex;
got_worktree_checkout_cb progress_cb;
void *progress_arg;
- got_worktree_cancel_cb cancel_cb;
+ got_cancel_cb cancel_cb;
void *cancel_arg;
struct got_object_id *commit_id2;
};
const char *fileindex_path, struct got_object_id *commit_id1,
struct got_object_id *commit_id2, struct got_repository *repo,
got_worktree_checkout_cb progress_cb, void *progress_arg,
- got_worktree_cancel_cb cancel_cb, void *cancel_arg)
+ got_cancel_cb cancel_cb, void *cancel_arg)
{
const struct got_error *err = NULL, *sync_err;
struct got_object_id *tree_id1 = NULL, *tree_id2 = NULL;
got_worktree_merge_files(struct got_worktree *worktree,
struct got_object_id *commit_id1, struct got_object_id *commit_id2,
struct got_repository *repo, got_worktree_checkout_cb progress_cb,
- void *progress_arg, got_worktree_cancel_cb cancel_cb, void *cancel_arg)
+ void *progress_arg, got_cancel_cb cancel_cb, void *cancel_arg)
{
const struct got_error *err, *unlockerr;
char *fileindex_path = NULL;
struct got_repository *repo;
got_worktree_status_cb status_cb;
void *status_arg;
- got_worktree_cancel_cb cancel_cb;
+ got_cancel_cb cancel_cb;
void *cancel_arg;
/* A pathlist containing per-directory pathlists of ignore patterns. */
struct got_pathlist_head ignores;
worktree_status(struct got_worktree *worktree, const char *path,
struct got_fileindex *fileindex, struct got_repository *repo,
got_worktree_status_cb status_cb, void *status_arg,
- got_worktree_cancel_cb cancel_cb, void *cancel_arg)
+ got_cancel_cb cancel_cb, void *cancel_arg)
{
const struct got_error *err = NULL;
DIR *workdir = NULL;
got_worktree_status(struct got_worktree *worktree,
struct got_pathlist_head *paths, struct got_repository *repo,
got_worktree_status_cb status_cb, void *status_arg,
- got_worktree_cancel_cb cancel_cb, void *cancel_arg)
+ got_cancel_cb cancel_cb, void *cancel_arg)
{
const struct got_error *err = NULL;
char *fileindex_path = NULL;
struct got_fileindex *fileindex, struct got_object_id *parent_commit_id,
struct got_object_id *commit_id, struct got_repository *repo,
got_worktree_checkout_cb progress_cb, void *progress_arg,
- got_worktree_cancel_cb cancel_cb, void *cancel_arg)
+ got_cancel_cb cancel_cb, void *cancel_arg)
{
const struct got_error *err;
struct got_reference *commit_ref = NULL;
struct got_object_id *parent_commit_id, struct got_object_id *commit_id,
struct got_repository *repo,
got_worktree_checkout_cb progress_cb, void *progress_arg,
- got_worktree_cancel_cb cancel_cb, void *cancel_arg)
+ got_cancel_cb cancel_cb, void *cancel_arg)
{
const struct got_error *err;
char *commit_ref_name;
struct got_object_id *parent_commit_id, struct got_object_id *commit_id,
struct got_repository *repo,
got_worktree_checkout_cb progress_cb, void *progress_arg,
- got_worktree_cancel_cb cancel_cb, void *cancel_arg)
+ got_cancel_cb cancel_cb, void *cancel_arg)
{
const struct got_error *err;
char *commit_ref_name;
blob - d1997e2a143daa17a6cd975dfdd7f88fbee2773a
blob + c92a4d04f1ff3d0ed6ae29e308c93512bed28e2e
--- tog/tog.c
+++ tog/tog.c
#include "got_blame.h"
#include "got_privsep.h"
#include "got_path.h"
+#include "got_cancel.h"
#include "got_worktree.h"
#ifndef MIN