All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Parth Gala via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Parth Gala <parthpgala@gmail.com>, Parth Gala <parthpgala@gmail.com>
Subject: [PATCH 4/5] object.c: clear_object_flags() accept 'r' as parameter
Date: Wed, 12 Feb 2020 19:19:10 +0000	[thread overview]
Message-ID: <a8202cc5353d274f6278f2350ae1371af0a093d5.1581535151.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.545.git.1581535151.gitgitgadget@gmail.com>

From: Parth Gala <parthpgala@gmail.com>

'clear_object_flags()' and its callers are modified to enable
passing 'r' as an argument to 'clear_object_flags()'.

Signed-off-by: Parth Gala <parthpgala@gmail.com>
---
 builtin/log.c | 3 ++-
 object.c      | 6 +++---
 object.h      | 2 +-
 revision.c    | 3 ++-
 shallow.c     | 3 ++-
 upload-pack.c | 2 +-
 6 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/builtin/log.c b/builtin/log.c
index 83a4a6188e..b163d2fbdf 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1592,6 +1592,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 {
 	struct commit *commit;
 	struct commit **list = NULL;
+	struct repository *r = the_repository;
 	struct rev_info rev;
 	struct setup_revision_opt s_r_opt;
 	int nr = 0, total, i;
@@ -1998,7 +1999,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 	if (base_commit) {
 		struct commit *base = get_base_commit(base_commit, list, nr);
 		reset_revision_walk();
-		clear_object_flags(UNINTERESTING);
+		clear_object_flags(r, UNINTERESTING);
 		prepare_bases(&bases, base, list, nr);
 	}
 
diff --git a/object.c b/object.c
index 0a7a278c88..804488c8dd 100644
--- a/object.c
+++ b/object.c
@@ -432,12 +432,12 @@ void object_array_remove_duplicates(struct object_array *array)
 	}
 }
 
-void clear_object_flags(unsigned flags)
+void clear_object_flags(struct repository *r, unsigned flags)
 {
 	int i;
 
-	for (i=0; i < the_repository->parsed_objects->obj_hash_size; i++) {
-		struct object *obj = the_repository->parsed_objects->obj_hash[i];
+	for (i=0; i < r->parsed_objects->obj_hash_size; i++) {
+		struct object *obj = r->parsed_objects->obj_hash[i];
 		if (obj)
 			obj->flags &= ~flags;
 	}
diff --git a/object.h b/object.h
index 92af2ead8f..bfc95e062a 100644
--- a/object.h
+++ b/object.h
@@ -185,7 +185,7 @@ void object_array_remove_duplicates(struct object_array *array);
  */
 void object_array_clear(struct object_array *array);
 
-void clear_object_flags(unsigned flags);
+void clear_object_flags(struct repository *, unsigned flags);
 
 /*
  * Clear the specified object flags from all in-core commit objects.
diff --git a/revision.c b/revision.c
index 8136929e23..ac32ecf2e2 100644
--- a/revision.c
+++ b/revision.c
@@ -3086,7 +3086,8 @@ static void set_children(struct rev_info *revs)
 
 void reset_revision_walk(void)
 {
-	clear_object_flags(SEEN | ADDED | SHOWN | TOPO_WALK_EXPLORED | TOPO_WALK_INDEGREE);
+	struct repository *r = the_repository;
+	clear_object_flags(r, SEEN | ADDED | SHOWN | TOPO_WALK_EXPLORED | TOPO_WALK_INDEGREE);
 }
 
 static int mark_uninteresting(const struct object_id *oid,
diff --git a/shallow.c b/shallow.c
index 4537d98482..d32adbe088 100644
--- a/shallow.c
+++ b/shallow.c
@@ -180,6 +180,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
 {
 	struct commit_list *result = NULL, *p;
 	struct commit_list *not_shallow_list = NULL;
+	struct repository *r = the_repository;
 	struct rev_info revs;
 	int both_flags = shallow_flag | not_shallow_flag;
 
@@ -187,7 +188,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
 	 * SHALLOW (excluded) and NOT_SHALLOW (included) should not be
 	 * set at this point. But better be safe than sorry.
 	 */
-	clear_object_flags(both_flags);
+	clear_object_flags(r, both_flags);
 
 	is_repository_shallow(the_repository); /* make sure shallows are read */
 
diff --git a/upload-pack.c b/upload-pack.c
index daea9059f0..e296f2cfa8 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -1472,7 +1472,7 @@ int upload_pack_v2(struct repository *r, struct argv_array *keys,
 	struct object_array have_obj = OBJECT_ARRAY_INIT;
 	struct object_array want_obj = OBJECT_ARRAY_INIT;
 
-	clear_object_flags(ALL_FLAGS);
+	clear_object_flags(r, ALL_FLAGS);
 
 	git_config(upload_pack_config, NULL);
 
-- 
gitgitgadget


  parent reply	other threads:[~2020-02-12 19:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12 19:19 [PATCH 0/5] object.c: localize global the_repository variable into r Parth Gala via GitGitGadget
2020-02-12 19:19 ` [PATCH 1/5] object.c: get_max_object_index and get_indexed_object accept 'r' parameter Parth Gala via GitGitGadget
2020-02-12 20:22   ` Taylor Blau
2020-02-12 21:13     ` Eric Sunshine
2020-02-13  5:23     ` parth gala
2020-02-12 19:19 ` [PATCH 2/5] object.c: lookup_unknown_object() accept 'r' as parameter Parth Gala via GitGitGadget
2020-02-12 20:25   ` Taylor Blau
2020-02-12 21:11     ` Junio C Hamano
2020-02-13 18:00       ` Taylor Blau
2020-02-13 18:10         ` Junio C Hamano
2020-02-13 18:52           ` Jeff King
2020-02-15  0:00             ` Taylor Blau
2020-02-12 19:19 ` [PATCH 3/5] object.c: parse_object_or_die() " Parth Gala via GitGitGadget
2020-02-12 19:19 ` Parth Gala via GitGitGadget [this message]
2020-02-12 19:19 ` [PATCH 5/5] object.c: clear_commit_marks_all() " Parth Gala via GitGitGadget
2020-02-12 20:18 ` [PATCH 0/5] object.c: localize global the_repository variable into r Taylor Blau
2020-02-13  5:14   ` parth gala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a8202cc5353d274f6278f2350ae1371af0a093d5.1581535151.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=parthpgala@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.