git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v2 0/3] bundle.c: remove "ref_list" in favor of string-list.c API
@ 2021-06-21 15:16 Ævar Arnfjörð Bjarmason
  2021-06-30 14:06 ` [PATCH v3 0/3] Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 136+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2021-06-21 15:16 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jeff King, Johannes Schindelin, Andrei Rybak,
	Ævar Arnfjörð Bjarmason

This v2 addresses an omission noted by Andrei Rybak[1]. I didn't
factor out the "name" into a variable in 2/3 for ease of reading
3/3. That's now done.

1. https://lore.kernel.org/git/23c4ce5f-7769-1d2c-3a97-ac9733f73a25@gmail.com/

Ævar Arnfjörð Bjarmason (3):
  bundle cmd: stop leaking memory from parse_options_cmd_bundle()
  bundle.c: use a temporary variable for OIDs and names
  bundle: remove "ref_list" in favor of string-list.c API

 builtin/bundle.c | 91 ++++++++++++++++++++++++++++++++----------------
 bundle.c         | 74 ++++++++++++++++++++++-----------------
 bundle.h         | 20 +++++------
 transport.c      | 12 +++++--
 4 files changed, 122 insertions(+), 75 deletions(-)

Range-diff against v1:
1:  f4191088ac3 = 1:  932c0883ce0 bundle cmd: stop leaking memory from parse_options_cmd_bundle()
2:  f297fd0432a ! 2:  7e0d57951e5 bundle.c: use a temporary variable for OIDs and names
    @@ bundle.c: int verify_bundle(struct repository *r,
      	for (i = 0; i < p->nr; i++) {
      		struct ref_list_entry *e = p->list + i;
     -		struct object *o = parse_object(r, &e->oid);
    ++		const char *name = e->name;
     +		struct object_id *oid = &e->oid;
     +		struct object *o = parse_object(r, oid);
      		if (o) {
      			o->flags |= PREREQ_MARK;
    - 			add_pending_object(&revs, o, e->name);
    -@@ bundle.c: int verify_bundle(struct repository *r,
    +-			add_pending_object(&revs, o, e->name);
    ++			add_pending_object(&revs, o, name);
    + 			continue;
      		}
      		if (++ret == 1)
      			error("%s", message);
     -		error("%s %s", oid_to_hex(&e->oid), e->name);
    -+		error("%s %s", oid_to_hex(oid), e->name);
    ++		error("%s %s", oid_to_hex(oid), name);
      	}
      	if (revs.pending.nr != p->nr)
      		return ret;
    @@ bundle.c: int verify_bundle(struct repository *r,
      	for (i = 0; i < p->nr; i++) {
      		struct ref_list_entry *e = p->list + i;
     -		struct object *o = parse_object(r, &e->oid);
    ++		const char *name = e->name;
     +		struct object_id *oid = &e->oid;
     +		struct object *o = parse_object(r, oid);
      		assert(o); /* otherwise we'd have returned early */
    @@ bundle.c: int verify_bundle(struct repository *r,
      		if (++ret == 1)
      			error("%s", message);
     -		error("%s %s", oid_to_hex(&e->oid), e->name);
    -+		error("%s %s", oid_to_hex(oid), e->name);
    ++		error("%s %s", oid_to_hex(oid), name);
      	}
      
      	/* Clean up objects used, as they will be reused. */
    @@ bundle.c: int verify_bundle(struct repository *r,
     
      ## transport.c ##
     @@ transport.c: static struct ref *get_refs_from_bundle(struct transport *transport,
    + 
      	for (i = 0; i < data->header.references.nr; i++) {
      		struct ref_list_entry *e = data->header.references.list + i;
    - 		struct ref *ref = alloc_ref(e->name);
    +-		struct ref *ref = alloc_ref(e->name);
     -		oidcpy(&ref->old_oid, &e->oid);
    ++		const char *name = e->name;
    ++		struct ref *ref = alloc_ref(name);
     +		struct object_id *oid = &e->oid;
     +		oidcpy(&ref->old_oid, oid);
      		ref->next = result;
3:  887313d3b02 ! 3:  9d9cb5aaf9e bundle: remove "ref_list" in favor of string-list.c API
    @@ bundle.c: int verify_bundle(struct repository *r,
      	repo_init_revisions(r, &revs, NULL);
      	for (i = 0; i < p->nr; i++) {
     -		struct ref_list_entry *e = p->list + i;
    +-		const char *name = e->name;
     -		struct object_id *oid = &e->oid;
     +		struct string_list_item *e = p->items + i;
    ++		const char *name = e->string;
     +		struct object_id *oid = e->util;
      		struct object *o = parse_object(r, oid);
      		if (o) {
      			o->flags |= PREREQ_MARK;
    --			add_pending_object(&revs, o, e->name);
    -+			add_pending_object(&revs, o, e->string);
    - 			continue;
    - 		}
    - 		if (++ret == 1)
    - 			error("%s", message);
    --		error("%s %s", oid_to_hex(oid), e->name);
    -+		error("%s %s", oid_to_hex(oid), e->string);
    - 	}
    - 	if (revs.pending.nr != p->nr)
    - 		return ret;
     @@ bundle.c: int verify_bundle(struct repository *r,
      			i--;
      
      	for (i = 0; i < p->nr; i++) {
     -		struct ref_list_entry *e = p->list + i;
    +-		const char *name = e->name;
     -		struct object_id *oid = &e->oid;
     +		struct string_list_item *e = p->items + i;
    ++		const char *name = e->string;
     +		const struct object_id *oid = e->util;
      		struct object *o = parse_object(r, oid);
      		assert(o); /* otherwise we'd have returned early */
      		if (o->flags & SHOWN)
    - 			continue;
    - 		if (++ret == 1)
    - 			error("%s", message);
    --		error("%s %s", oid_to_hex(oid), e->name);
    -+		error("%s %s", oid_to_hex(oid), e->string);
    - 	}
    +@@ bundle.c: int verify_bundle(struct repository *r,
      
      	/* Clean up objects used, as they will be reused. */
      	for (i = 0; i < p->nr; i++) {
    @@ transport.c: static struct ref *get_refs_from_bundle(struct transport *transport
      
      	for (i = 0; i < data->header.references.nr; i++) {
     -		struct ref_list_entry *e = data->header.references.list + i;
    --		struct ref *ref = alloc_ref(e->name);
    --		struct object_id *oid = &e->oid;
    +-		const char *name = e->name;
     +		struct string_list_item *e = data->header.references.items + i;
    -+		struct ref *ref = alloc_ref(e->string);
    -+		const struct object_id *oid = e->util;
    ++		const char *name = e->string;
    + 		struct ref *ref = alloc_ref(name);
    +-		struct object_id *oid = &e->oid;
    ++		struct object_id *oid = e->util;
      		oidcpy(&ref->old_oid, oid);
      		ref->next = result;
      		result = ref;
-- 
2.32.0.599.g3967b4fa4ac


^ permalink raw reply	[flat|nested] 136+ messages in thread
* Re: [PATCH v2 1/3] Move the user-facing test library to test-lib-functions.sh
@ 2012-02-16 22:14 Junio C Hamano
  2012-02-17 10:25 ` [PATCH v3 0/3] Thomas Rast
  0 siblings, 1 reply; 136+ messages in thread
From: Junio C Hamano @ 2012-02-16 22:14 UTC (permalink / raw)
  To: Thomas Rast; +Cc: git

Thomas Rast <trast@student.ethz.ch> writes:

> This just moves all the user-facing functions to a separate file and
> sources that instead.
>
> Signed-off-by: Thomas Rast <trast@student.ethz.ch>
> ---
>  t/test-lib-functions.sh |  835 +++++++++++++++++++++++++++++++++++++++++++++++
>  t/test-lib.sh           |  552 +-------------------------------
>  2 files changed, 840 insertions(+), 547 deletions(-)
>  create mode 100644 t/test-lib-functions.sh

I would have expected from the log description that the number of deleted
lines would be about the same as the number of added lines, and the
difference would primarily come from the addition of "include" aka "dot"
". ./test-lib-functions.sh" that becomes necessary in t/test-lib.sh, some
boilerplate material at the beginning of the new file e.g. "#!/bin/sh",
and copying (not moving) the same Copyright block to the new file.

But 835-552 = 283 feels way way more than that.  What else is going on?

^ permalink raw reply	[flat|nested] 136+ messages in thread

end of thread, other threads:[~2021-07-01 10:53 UTC | newest]

Thread overview: 136+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <"<CAC05386q2iGoiJ_fRgwoOTF23exEN2D1+oh4VjajEvYQ58O1TQ@mail.gmail.com>
2018-09-27 15:13 ` [PATCH] branch: colorize branches checked out in a linked working tree the same way as the current branch is colorized Nickolai Belakovski
2018-09-27 15:33   ` Ævar Arnfjörð Bjarmason
2018-09-27 17:46     ` Nickolai Belakovski
     [not found]     ` <CAC05387S9P+w8yqqcjkQDnURYSgQmqtukxS4KvqJu-kDA+_o0g@mail.gmail.com>
2018-09-27 17:59       ` Ævar Arnfjörð Bjarmason
2018-10-02 20:41         ` Johannes Schindelin
2018-09-27 17:58   ` Duy Nguyen
2018-09-27 18:17   ` Jeff King
2018-09-27 18:39     ` Nickolai Belakovski
2018-09-27 18:51       ` Jeff King
2018-09-27 19:28     ` Rafael Ascensão
2018-09-27 19:35       ` Jeff King
2018-09-27 19:41         ` Jeff King
2018-09-27 21:22           ` Junio C Hamano
2018-09-28  1:05             ` Jeff King
2018-09-28  1:28               ` Junio C Hamano
2018-09-27 21:35         ` Rafael Ascensão
2018-09-28  1:07           ` Jeff King
2018-09-27 20:02       ` Ævar Arnfjörð Bjarmason
2018-09-27 20:16         ` Nickolai Belakovski
2018-09-27 20:40           ` Rafael Ascensão
2018-11-11 23:58             ` [PATCH v2 0/2] refactoring branch colorization to ref-filter nbelakovski
2018-11-11 23:58               ` [PATCH v2 1/2] ref-filter: add worktree atom nbelakovski
2018-11-12 10:11                 ` Junio C Hamano
2018-11-12 12:22                   ` Jeff King
2018-11-13  1:38                     ` Junio C Hamano
2018-11-21 14:05                       ` Nickolai Belakovski
2018-11-21 14:08                         ` Jeff King
2018-11-12 12:23                 ` Jeff King
2018-11-11 23:58               ` [PATCH v2 2/2] branch: Mark and colorize a branch differently if it is checked out in a linked worktree nbelakovski
2018-11-12 10:20                 ` Junio C Hamano
2018-11-12 12:14                   ` Jeff King
2018-11-12 18:07                     ` Rafael Ascensão
2018-11-13  1:45                       ` Junio C Hamano
2018-11-13 14:49                       ` Jeff King
2018-11-21 14:07                         ` Nickolai Belakovski
2018-12-16 21:57               ` [PATCH v3 0/3] nbelakovski
2018-12-16 21:57                 ` [PATCH v3 1/3] ref-filter: add worktreepath atom nbelakovski
2018-12-18 17:22                   ` Jeff King
2018-12-20  7:09                     ` Nickolai Belakovski
2018-12-20 14:59                       ` Jeff King
2018-12-24  8:47                         ` [PATCH v4 0/3] nbelakovski
2018-12-24  8:47                           ` [PATCH v4 1/3] ref-filter: add worktreepath atom nbelakovski
2019-01-03  5:40                             ` Jeff King
2019-01-03  9:31                               ` Eric Sunshine
2018-12-24  8:47                           ` [PATCH v4 2/3] branch: Mark and color a branch differently if it is checked out in a linked worktree nbelakovski
2018-12-24  8:47                           ` [PATCH v4 3/3] branch: Add an extra verbose output displaying worktree path for refs " nbelakovski
2019-01-03  5:42                             ` Jeff King
2019-01-03  5:22                           ` [PATCH v4 0/3] Jeff King
2018-12-16 21:57                 ` [PATCH v3 2/3] branch: Mark and color a branch differently if it is checked out in a linked worktree nbelakovski
2018-12-16 21:57                 ` [PATCH v3 3/3] branch: Add an extra verbose output displaying worktree path for refs " nbelakovski
2018-12-18 17:25                 ` [PATCH v3 0/3] Jeff King
2019-01-06  0:26   ` [PATCH v5 0/3] nbelakovski
2019-01-06  0:26     ` [PATCH v5 1/3] ref-filter: add worktreepath atom nbelakovski
2019-01-07 18:20       ` Junio C Hamano
2019-01-18 22:17         ` Nickolai Belakovski
2019-01-18 22:20           ` Nickolai Belakovski
2019-01-06  0:26     ` [PATCH v5 2/3] branch: Mark and color a branch differently if it is checked out in a linked worktree nbelakovski
2019-01-07 19:04       ` Junio C Hamano
2019-01-10 21:42         ` Philip Oakley
2019-01-13  1:41           ` Nickolai Belakovski
2019-01-14 18:18             ` Junio C Hamano
2019-01-18 22:18               ` Nickolai Belakovski
2019-01-06  0:26     ` [PATCH v5 3/3] branch: Add an extra verbose output displaying worktree path for refs " nbelakovski
2019-01-07 19:09       ` Junio C Hamano
2019-01-22 23:22   ` [PATCH v6 0/3] nbelakovski
2019-01-22 23:22     ` [PATCH v6 1/3] ref-filter: add worktreepath atom nbelakovski
2019-01-23 18:57       ` Junio C Hamano
2019-01-23 23:34         ` Nickolai Belakovski
2019-01-24 18:26           ` Junio C Hamano
2019-01-24 18:32             ` Jeff King
2019-01-24 19:27               ` Junio C Hamano
2019-01-24 19:34                 ` Jeff King
2019-01-24 19:30               ` Junio C Hamano
2019-01-24 21:26                 ` Jeff King
2019-01-31 20:53                   ` Nickolai Belakovski
2019-01-31 23:21                     ` Jeff King
2019-01-31 21:42                   ` Junio C Hamano
2019-01-31 23:20                     ` Jeff King
2019-01-22 23:23     ` [PATCH v6 2/3] branch: Mark and color a branch differently if it is checked out in a linked worktree nbelakovski
2019-01-22 23:23     ` [PATCH v6 3/3] branch: Add an extra verbose output displaying worktree path for refs " nbelakovski
2019-02-01 22:04   ` [PATCH v7 0/3] nbelakovski
2019-02-01 22:28     ` Junio C Hamano
2019-02-01 23:31       ` Nickolai Belakovski
2019-02-01 22:04   ` [PATCH v7 1/3] ref-filter: add worktreepath atom nbelakovski
2019-02-01 22:20     ` Eric Sunshine
2019-02-01 22:41       ` Nickolai Belakovski
2019-02-04 18:14         ` Junio C Hamano
2019-02-18 10:09           ` Nickolai Belakovski
2019-02-01 22:31     ` Junio C Hamano
2019-02-01 22:04   ` [PATCH v7 2/3] branch: Mark and color a branch differently if it is checked out in a linked worktree nbelakovski
2019-02-01 22:34     ` Junio C Hamano
2019-02-01 23:12       ` Nickolai Belakovski
2019-02-04 18:18         ` Junio C Hamano
2019-02-01 22:04   ` [PATCH v7 3/3] branch: Add an extra verbose output displaying worktree path for refs " nbelakovski
2019-02-01 22:27     ` Eric Sunshine
2019-02-01 22:45       ` Nickolai Belakovski
2019-02-01 22:53     ` Junio C Hamano
2019-02-01 23:06       ` Nickolai Belakovski
2019-02-02  1:22         ` [RFC] Sample of test for git branch -vv nbelakovski
2019-02-19  8:31   ` [PATCH v8 0/3] nbelakovski
2019-02-19  8:31     ` [PATCH v8 1/3] ref-filter: add worktreepath atom nbelakovski
2019-02-19  8:31     ` [PATCH v8 2/3] branch: update output to include worktree info nbelakovski
2019-02-21 12:44       ` Jeff King
2019-03-14  5:45         ` Nickolai Belakovski
2019-02-19  8:31     ` [PATCH v8 3/3] branch: add worktree info on verbose output nbelakovski
2019-02-21 12:59       ` Jeff King
2019-03-14  5:58         ` Nickolai Belakovski
2019-03-18  2:12           ` Junio C Hamano
2019-02-21 12:36     ` [PATCH v8 0/3] Jeff King
2019-03-14  6:10       ` Nickolai Belakovski
2019-03-16  1:38   ` [PATCH v9 0/3] nbelakovski
2019-03-16  1:38     ` [PATCH v9 1/3] ref-filter: add worktreepath atom nbelakovski
2019-03-16  1:38     ` [PATCH v9 2/3] branch: update output to include worktree info nbelakovski
2019-03-16  1:38     ` [PATCH v9 3/3] branch: add worktree info on verbose output nbelakovski
2019-03-18 12:10       ` SZEDER Gábor
2019-03-18  5:30     ` [PATCH v9 0/3] Junio C Hamano
2019-04-29  5:19   ` [PATCH v10 0/3] nbelakovski
2019-04-29  5:19     ` [PATCH v10 1/3] ref-filter: add worktreepath atom nbelakovski
2019-04-29  5:19     ` [PATCH v10 2/3] branch: update output to include worktree info nbelakovski
2019-04-29  5:19     ` [PATCH v10 3/3] branch: add worktree info on verbose output nbelakovski
2019-04-29 14:12     ` [PATCH v10 0/3] SZEDER Gábor
2019-04-29 19:27       ` Nickolai Belakovski
2019-04-29 20:57     ` Johannes Schindelin
2019-04-29 21:33       ` Nickolai Belakovski
     [not found]       ` <CAC05385Mc7pqiCd5mb+1c4WM+v7K=h=GMHuvkw9xizhRFJXXBA@mail.gmail.com>
2019-04-30 21:46         ` Johannes Schindelin
2021-06-21 15:16 [PATCH v2 0/3] bundle.c: remove "ref_list" in favor of string-list.c API Ævar Arnfjörð Bjarmason
2021-06-30 14:06 ` [PATCH v3 0/3] Ævar Arnfjörð Bjarmason
2021-06-30 17:34   ` Jeff King
2021-06-30 17:45     ` Jeff King
2021-06-30 18:00       ` Ævar Arnfjörð Bjarmason
2021-07-01 10:53         ` Ævar Arnfjörð Bjarmason
  -- strict thread matches above, loose matches on Subject: below --
2012-02-16 22:14 [PATCH v2 1/3] Move the user-facing test library to test-lib-functions.sh Junio C Hamano
2012-02-17 10:25 ` [PATCH v3 0/3] Thomas Rast
2012-02-17 17:03   ` Junio C Hamano
2012-02-17 23:28     ` Junio C Hamano
2012-02-18  0:51       ` Jeff King
2012-02-18  7:27         ` Junio C Hamano
2012-02-18  8:52           ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).