]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'sp/shallow-time-boundary' into seen
authorJunio C Hamano <gitster@pobox.com>
Sat, 17 Jan 2026 18:37:38 +0000 (10:37 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 17 Jan 2026 18:37:38 +0000 (10:37 -0800)
The set of shallow boundary "git clone --shallow-since" leaves
contained commits that are not on the boundary, which has been
corrected.

* sp/shallow-time-boundary:
  shallow: set borders which are all reachable after clone shallow since

1  2 
shallow.c
t/t5500-fetch-pack.sh

diff --cc shallow.c
index 7c237bd48b6ab81b0aadbe2f35dc872076776045,a12c031ce8605fdd5da96a67d1d8185928fbdbb7..471fc52337349b3a2b4ec45e7cb2cc30bc68f0d6
+++ b/shallow.c
@@@ -278,13 -284,26 +301,26 @@@ struct commit_list *get_shallow_commits
                            oid_to_hex(&c->object.oid));
  
                for (parent = c->parents; parent; parent = parent->next)
-                       if (!(parent->item->object.flags & not_shallow_flag)) {
+                       if (parent->item->object.flags & not_shallow_flag) {
+                               must_not_be_shallow = 1;
+                       } else {
                                c->object.flags |= shallow_flag;
-                               commit_list_insert(c, &result);
-                               break;
+                               parent->item->object.flags |= shallow_flag;
                        }
+               if (must_not_be_shallow) {
+                       c->object.flags &= ~shallow_flag;
+                       for (parent = c->parents; parent; parent = parent->next)
+                               if (parent->item->object.flags & shallow_flag) {
+                                       parent->item->object.flags |= not_shallow_flag;
+                                       commit_list_insert(parent->item, &result);
+                               }
+               } else {
+                       for (parent = c->parents; parent; parent = parent->next)
+                               parent->item->object.flags &= ~shallow_flag;
+                       commit_list_insert(c, &result);
+               }
        }
 -      free_commit_list(not_shallow_list);
 +      commit_list_free(not_shallow_list);
  
        /*
         * Now we can clean up NOT_SHALLOW on border commits. Having
Simple merge