@@ -466,6 +466,8 @@ include::config/trace2.txt[]
include::config/transfer.txt[]
+include::config/update.txt[]
+
include::config/uploadarchive.txt[]
include::config/uploadpack.txt[]
new file mode 100644
@@ -0,0 +1,4 @@
+update.mode::
+ When `git update` is run, this determines the mode of operation,
+ possible values are 'fast-forward', 'merge', and 'rebase'. The default
+ is 'fast-forward'.
@@ -5,9 +5,11 @@
#include "builtin.h"
#include "parse-options.h"
#include "run-command.h"
+#include "config.h"
#include "dir.h"
enum update_mode_type {
+ UPDATE_MODE_INVALID = -1,
UPDATE_MODE_FAST_FORWARD = 0,
UPDATE_MODE_MERGE,
UPDATE_MODE_REBASE
@@ -34,6 +36,28 @@ static struct option update_options[] = {
OPT_END()
};
+static enum update_mode_type update_mode_parse_value(const char *value)
+{
+ if (!strcmp(value, "fast-forward"))
+ return UPDATE_MODE_FAST_FORWARD;
+ if (!strcmp(value, "merge"))
+ return UPDATE_MODE_MERGE;
+ if (!strcmp(value, "rebase"))
+ return UPDATE_MODE_REBASE;
+
+ return UPDATE_MODE_INVALID;
+}
+
+static int git_update_config(const char *var, const char *value, void *cb)
+{
+ if (!strcmp(var, "update.mode")) {
+ mode = update_mode_parse_value(value);
+ return 0;
+ }
+
+ return git_default_config(var, value, cb);
+}
+
static int run_fetch(void)
{
struct strvec args = STRVEC_INIT;
@@ -87,6 +111,8 @@ int cmd_update(int argc, const char **argv, const char *prefix)
if (!getenv("GIT_REFLOG_ACTION"))
setenv("GIT_REFLOG_ACTION", "update", 0);
+ git_config(git_update_config, NULL);
+
argc = parse_options(argc, argv, prefix, update_options, update_usage, 0);
if (repo_read_index_unmerged(the_repository))
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> --- Documentation/config.txt | 2 ++ Documentation/config/update.txt | 4 ++++ builtin/update.c | 26 ++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 Documentation/config/update.txt