git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/2] format-patch: use clear_commit_marks() instead of some adhocery

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jun 26, 2006, 15:33 UTC
Message-ID
<Pine.LNX.4.63.0606261728340.29667@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<Pine.LNX.4.63.0606250349280.29667@wbgn013.biozentrum.uni-wuerzburg.de>
It is cleaner, and it describes better what is the idea behind the code.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
	This goes on top of the --ignore-if-in-upstream patch.
	On Sun, 25 Jun 2006, Johannes Schindelin wrote:
	> - To add the patch ids of the upstream, the revision walker must
	> be called twice.
	> 
	> So, if format-patch was called with a range "a..b" (a single
	> revision "a" is handled as "a..HEAD" by format-patch), a 
	> revision walker is set up for "b..a", and the patch ids are 
	> calculated and stored. This is done by toggling the 
	> UNINTERESTING bits of both pending objects.
	> 
	> After that, the flags of all objects are reset to 0, so that the
	> revisions can be walked again. The flags of the two pending 
	> objects are then reset to their original state.
	It is not clean to reset the flags of all objects to 0. Instead, 
	the commits are walked directly. Not that it matters in that
	particular case (the only read objects _are_ these commits).
 builtin-log.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index e78a9a4..e2cd975 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -160,15 +160,6 @@ static void reopen_stdout(struct commit 
 	freopen(filename, "w", stdout);
 }
 
-static void reset_all_objects_flags()
-{
-	int i;
-
-	for (i = 0; i < obj_allocs; i++)
-		if (objs[i])
-			objs[i]->flags = 0;
-}
-
 static int get_patch_id(struct commit *commit, struct diff_options *options,
 		unsigned char *sha1)
 {
@@ -220,7 +211,8 @@ static void get_patch_ids(struct rev_inf
 	}
 
 	/* reset for next revision walk */
-	reset_all_objects_flags();
+	clear_commit_marks((struct commit *)o1, SEEN | UNINTERESTING);
+	clear_commit_marks((struct commit *)o2, SEEN | UNINTERESTING);
 	o1->flags = flags1;
 	o2->flags = flags2;
 }
-- 
1.4.1.rc1.gc792
Previous: Johannes SchindelinNext: Junio C Hamano
Message 2 of 20 in “resurrect format-patch's patch id checking”
  1. 0/2 resurrect format-patch's patch id checkingJohannes Schindelin, Jun 25, 2006
  2. 3/2 format-patch: use clear_commit_marks() instead of some adhoceryJohannes Schindelin, Jun 26, 2006
  3. Junio C HamanoJun 26, 2006
  4. Johannes SchindelinJun 26, 2006
  5. Martin LanghoffJun 26, 2006
  6. Johannes SchindelinJun 26, 2006
  7. Martin LanghoffJun 26, 2006
  8. Johannes SchindelinJun 26, 2006
  9. Junio C HamanoJun 26, 2006
  10. format-patch: support really old non-range syntax, with a warningJohannes Schindelin, Jun 26, 2006
  11. Martin Langhoff (CatalystIT)Jun 26, 2006
  12. Johannes SchindelinJun 26, 2006
  13. Johannes SchindelinJun 27, 2006
  14. Martin LanghoffJun 27, 2006
  15. Johannes SchindelinJun 27, 2006
  16. Martin LanghoffJun 27, 2006
  17. Johannes SchindelinJun 27, 2006
  18. Junio C HamanoJun 26, 2006
  19. Johannes SchindelinJun 26, 2006
  20. format-patch: use clear_commit_marks() instead of some adhoceryJohannes Schindelin, Jun 27, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.