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

[PATCH] merge-recursive: get rid of virtual_id

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Sep 5, 2008, 17:26 UTC
Message-ID
<1220635602-13796-1-git-send-email-vmiklos@frugalware.org>
In-Reply-To
<7vy7273f9v.fsf@gitster.siamese.dyndns.org>

We now just leave the object->sha1 field of virtual commits 0{40} as it is initialized, as a unique hash is not necessary in case of virtual commits.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
On Thu, Sep 04, 2008 at 12:03:08PM -0700, Junio C Hamano <gitster@pobox.com> wrote:
> Does it hurt if we get rid of virtual_id and always leave the
> object->sha1 field of virtual commits 0{40} as it is initialized?
I don't think so. Here is a patch that does it.
 merge-recursive.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 1c24c31..dbdb9ac 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -35,18 +35,14 @@ static struct tree *shift_tree_object(struct tree *one, struct tree *two)
 }
 
 /*
- * A virtual commit has
- * - (const char *)commit->util set to the name, and
- * - *(int *)commit->object.sha1 set to the virtual id.
+ * A virtual commit has (const char *)commit->util set to the name.
  */
 
 struct commit *make_virtual_commit(struct tree *tree, const char *comment)
 {
 	struct commit *commit = xcalloc(1, sizeof(struct commit));
-	static unsigned virtual_id = 1;
 	commit->tree = tree;
 	commit->util = (void*)comment;
-	*(int*)commit->object.sha1 = virtual_id++;
 	/* avoid warnings */
 	commit->object.parsed = 1;
 	return commit;
-- 
1.6.0.1
Previous: Junio C HamanoNext: Junio C Hamano
Message 14 of 15 in “Move call_depth and index_only to struct merge_options”
  1. 0/2 Move call_depth and index_only to struct merge_optionsMiklos Vajna, Sep 2, 2008
  2. 1/2 merge-recursive: move call_depth to struct merge_optionsMiklos Vajna, Sep 2, 2008
  3. 2/2 merge-recursive: move index_only to struct merge_optionsMiklos Vajna, Sep 2, 2008
  4. Makefile: add merge_recursive.h to LIB_HMiklos Vajna, Sep 2, 2008
  5. Junio C HamanoSep 2, 2008
  6. Makefile: add merge_recursive.h to LIB_HMiklos Vajna, Sep 2, 2008
  7. Junio C HamanoSep 2, 2008
  8. merge-recursive: get rid of the index_only global variableMiklos Vajna, Sep 3, 2008
  9. merge-recursive: move the global obuf to struct merge_optionsMiklos Vajna, Sep 3, 2008
  10. Miklos VajnaSep 3, 2008
  11. 1/2 merge-recursive: move current_{file,directory}_set to struct merge_optionsMiklos Vajna, Sep 3, 2008
  12. 2/2 merge-recursive: move make_virtual_commit()'s virtual_id to merge_optionsMiklos Vajna, Sep 3, 2008
  13. Junio C HamanoSep 4, 2008
  14. merge-recursive: get rid of virtual_idMiklos Vajna, Sep 5, 2008
  15. Junio C HamanoSep 4, 2008

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.