Merge branch 'jc/strbuf-getline'
[gitweb.git] / builtin / pull.c
index 9e3c73809f83af636150cc3edd8628c339ba40c1..10eff03967e0b9cb473d262b443949c55681fd1b 100644 (file)
@@ -22,7 +22,8 @@ enum rebase_type {
        REBASE_INVALID = -1,
        REBASE_FALSE = 0,
        REBASE_TRUE,
-       REBASE_PRESERVE
+       REBASE_PRESERVE,
+       REBASE_INTERACTIVE
 };
 
 /**
@@ -42,6 +43,8 @@ static enum rebase_type parse_config_rebase(const char *key, const char *value,
                return REBASE_TRUE;
        else if (!strcmp(value, "preserve"))
                return REBASE_PRESERVE;
+       else if (!strcmp(value, "interactive"))
+               return REBASE_INTERACTIVE;
 
        if (fatal)
                die(_("Invalid value for %s: %s"), key, value);
@@ -113,7 +116,7 @@ static struct option pull_options[] = {
        /* Options passed to git-merge or git-rebase */
        OPT_GROUP(N_("Options related to merging")),
        { OPTION_CALLBACK, 'r', "rebase", &opt_rebase,
-         "false|true|preserve",
+         "false|true|preserve|interactive",
          N_("incorporate changes by rebasing rather than merging"),
          PARSE_OPT_OPTARG, parse_opt_rebase },
        OPT_PASSTHRU('n', NULL, &opt_diffstat, NULL,
@@ -382,7 +385,7 @@ static void get_merge_heads(struct sha1_array *merge_heads)
 
        if (!(fp = fopen(filename, "r")))
                die_errno(_("could not open '%s' for reading"), filename);
-       while (strbuf_getline(&sb, fp, '\n') != EOF) {
+       while (strbuf_getline_lf(&sb, fp) != EOF) {
                if (get_sha1_hex(sb.buf, sha1))
                        continue;  /* invalid line: does not start with SHA1 */
                if (starts_with(sb.buf + GIT_SHA1_HEXSZ, "\tnot-for-merge\t"))
@@ -778,6 +781,8 @@ static int run_rebase(const unsigned char *curr_head,
        /* Options passed to git-rebase */
        if (opt_rebase == REBASE_PRESERVE)
                argv_array_push(&args, "--preserve-merges");
+       else if (opt_rebase == REBASE_INTERACTIVE)
+               argv_array_push(&args, "--interactive");
        if (opt_diffstat)
                argv_array_push(&args, opt_diffstat);
        argv_array_pushv(&args, opt_strategies.argv);