summaryrefslogtreecommitdiff
path: root/src/checkout.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-12-06 13:36:17 -0800
committerRussell Belfer <rb@github.com>2013-01-04 15:47:42 -0800
commitcf208031705388a2d1907fb9ec409ff22179f380 (patch)
tree264c79be7de58b468b02c56979e4c8765556f934 /src/checkout.h
parentbfe7d7de226e91c7ed99b68fc447aa0bcd5182ab (diff)
downloadlibgit2-cf208031705388a2d1907fb9ec409ff22179f380.tar.gz
Rework checkout internals (again)
I've tried to map out the detailed behaviors of checkout and make sure that we're handling the various cases correctly, along with providing options to allow us to emulate "git checkout" and "git checkout-index" with the various flags. I've thrown away flags in the checkout API that seemed like clutter and added some new ones. Also, I've converted the conflict callback to a general notification callback so we can emulate "git checkout" output and display "dirty" files. As of this commit, the new behavior is not working 100% but some of that is probably baked into tests that are not testing the right thing. This is a decent snapshot point, I think, along the way to getting the update done.
Diffstat (limited to 'src/checkout.h')
-rw-r--r--src/checkout.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/checkout.h b/src/checkout.h
new file mode 100644
index 000000000..651b0033f
--- /dev/null
+++ b/src/checkout.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2009-2012 the libgit2 contributors
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+#ifndef INCLUDE_checkout_h__
+#define INCLUDE_checkout_h__
+
+#include "git2/checkout.h"
+#include "iterator.h"
+
+#define GIT_CHECKOUT__FREE_BASELINE (1u << 24)
+
+/**
+ * Given a working directory which is expected to match the contents
+ * of iterator "expected", this will make the directory match the
+ * contents of "desired" according to the rules in the checkout "opts".
+ *
+ * Because the iterators for the desired and expected values were already
+ * created when this is invoked, if the checkout opts `paths` is in play,
+ * then presumably the pathspec_pfx was already computed, so it should be
+ * passed in to prevent reallocation.
+ */
+extern int git_checkout__from_iterators(
+ git_iterator *desired,
+ git_iterator *expected,
+ git_checkout_opts *opts,
+ const char *pathspec_pfx);
+
+#endif