]> git.ipfire.org Git - thirdparty/git.git/blobdiff - apply.c
Merge branch 'ma/list-object-filter-opt-msgfix'
[thirdparty/git.git] / apply.c
diff --git a/apply.c b/apply.c
index 76dba93c974b3814117e3856d875e7e4381d2f62..359ceb632ccc68c76791b98aab277fb0ed62442a 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -4699,8 +4699,13 @@ static int apply_patch(struct apply_state *state,
                        reverse_patches(patch);
                if (use_patch(state, patch)) {
                        patch_stats(state, patch);
-                       *listp = patch;
-                       listp = &patch->next;
+                       if (!list || !state->apply_in_reverse) {
+                               *listp = patch;
+                               listp = &patch->next;
+                       } else {
+                               patch->next = list;
+                               list = patch;
+                       }
 
                        if ((patch->new_name &&
                             ends_with_path_components(patch->new_name,