]> git.ipfire.org Git - thirdparty/git.git/blobdiff - shallow.c
Merge branch 'as/shallow-slab-use-fix'
[thirdparty/git.git] / shallow.c
index 8de0bad2a5afd6547c56bed5bf6a1179ba574423..c33ab94bd780355711d557c8ced1a837a418dff9 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -16,6 +16,7 @@
 #include "list-objects.h"
 #include "commit-slab.h"
 #include "repository.h"
+#include "commit-reach.h"
 
 void set_alternate_shallow_file(struct repository *r, const char *path, int override)
 {
@@ -42,6 +43,13 @@ int register_shallow(struct repository *r, const struct object_id *oid)
 
 int is_repository_shallow(struct repository *r)
 {
+       /*
+        * NEEDSWORK: This function updates
+        * r->parsed_objects->{is_shallow,shallow_stat} as a side effect but
+        * there is no corresponding function to clear them when the shallow
+        * file is updated.
+        */
+
        FILE *fp;
        char buf[1024];
        const char *path = r->parsed_objects->alternate_shallow_file;
@@ -186,7 +194,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
 
        is_repository_shallow(the_repository); /* make sure shallows are read */
 
-       init_revisions(&revs, NULL);
+       repo_init_revisions(the_repository, &revs, NULL);
        save_commit_buffer = 0;
        setup_revisions(ac, av, &revs, NULL);
 
@@ -242,7 +250,8 @@ static void check_shallow_file_for_update(struct repository *r)
        if (r->parsed_objects->is_shallow == -1)
                BUG("shallow must be initialized by now");
 
-       if (!stat_validity_check(r->parsed_objects->shallow_stat, git_path_shallow(the_repository)))
+       if (!stat_validity_check(r->parsed_objects->shallow_stat,
+                                git_path_shallow(r)))
                die("shallow file has changed since we read it");
 }