]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/pull.c
commit.h: remove method declarations
[thirdparty/git.git] / builtin / pull.c
index 1f2ecf3a88d95de5f819285aa1fc1558b63b6c4e..15ad01096817c9108e56647c4d52051968979a99 100644 (file)
@@ -22,6 +22,7 @@
 #include "tempfile.h"
 #include "lockfile.h"
 #include "wt-status.h"
+#include "commit-reach.h"
 
 enum rebase_type {
        REBASE_INVALID = -1,
@@ -356,7 +357,7 @@ static int git_pull_config(const char *var, const char *value, void *cb)
  */
 static void get_merge_heads(struct oid_array *merge_heads)
 {
-       const char *filename = git_path_fetch_head();
+       const char *filename = git_path_fetch_head(the_repository);
        FILE *fp;
        struct strbuf sb = STRBUF_INIT;
        struct object_id oid;
@@ -673,7 +674,7 @@ static const char *get_upstream_branch(const char *remote)
 }
 
 /**
- * Derives the remote tracking branch from the remote and refspec.
+ * Derives the remote-tracking branch from the remote and refspec.
  *
  * FIXME: The current implementation assumes the default mapping of
  * refs/heads/<branch_name> to refs/remotes/<remote_name>/<branch_name>.
@@ -684,7 +685,7 @@ static const char *get_tracking_branch(const char *remote, const char *refspec)
        const char *spec_src;
        const char *merge_branch;
 
-       refspec_item_init(&spec, refspec, REFSPEC_FETCH);
+       refspec_item_init_or_die(&spec, refspec, REFSPEC_FETCH);
        spec_src = spec.src;
        if (!*spec_src || !strcmp(spec_src, "HEAD"))
                spec_src = "HEAD";
@@ -711,7 +712,7 @@ static const char *get_tracking_branch(const char *remote, const char *refspec)
 
 /**
  * Given the repo and refspecs, sets fork_point to the point at which the
- * current branch forked from its remote tracking branch. Returns 0 on success,
+ * current branch forked from its remote-tracking branch. Returns 0 on success,
  * -1 on failure.
  */
 static int get_rebase_fork_point(struct object_id *fork_point, const char *repo,
@@ -765,10 +766,13 @@ static int get_octopus_merge_base(struct object_id *merge_base,
 {
        struct commit_list *revs = NULL, *result;
 
-       commit_list_insert(lookup_commit_reference(curr_head), &revs);
-       commit_list_insert(lookup_commit_reference(merge_head), &revs);
+       commit_list_insert(lookup_commit_reference(the_repository, curr_head),
+                          &revs);
+       commit_list_insert(lookup_commit_reference(the_repository, merge_head),
+                          &revs);
        if (!is_null_oid(fork_point))
-               commit_list_insert(lookup_commit_reference(fork_point), &revs);
+               commit_list_insert(lookup_commit_reference(the_repository, fork_point),
+                                  &revs);
 
        result = get_octopus_merge_bases(revs);
        free_commit_list(revs);
@@ -864,7 +868,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
        if (read_cache_unmerged())
                die_resolve_conflict("pull");
 
-       if (file_exists(git_path_merge_head()))
+       if (file_exists(git_path_merge_head(the_repository)))
                die_conclude_merge();
 
        if (get_oid("HEAD", &orig_head))
@@ -944,9 +948,11 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
                        struct commit_list *list = NULL;
                        struct commit *merge_head, *head;
 
-                       head = lookup_commit_reference(&orig_head);
+                       head = lookup_commit_reference(the_repository,
+                                                      &orig_head);
                        commit_list_insert(head, &list);
-                       merge_head = lookup_commit_reference(&merge_heads.oid[0]);
+                       merge_head = lookup_commit_reference(the_repository,
+                                                            &merge_heads.oid[0]);
                        if (is_descendant_of(merge_head, list)) {
                                /* we can fast-forward this without invoking rebase */
                                opt_ff = "--ff-only";