From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: pclouds@gmail.com
Cc: git@vger.kernel.org, gitster@pobox.com, peff@peff.net
Subject: [PATCH v3 00/15] Die commit->util, die!
Date: Sat, 19 May 2018 07:28:16 +0200 [thread overview]
Message-ID: <20180519052831.12603-1-pclouds@gmail.com> (raw)
In-Reply-To: <20180513055208.17952-1-pclouds@gmail.com>
v3 fixes Junio's comments on v2:
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index b08e5ea0e3..5aaf5c8e59 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -592,7 +592,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,
if (!S_ISGITLINK(diff_queued_diff.queue[i]->two->mode))
export_blob(&diff_queued_diff.queue[i]->two->oid);
- refname = *revision_sources_peek(&revision_sources, commit);
+ refname = *revision_sources_at(&revision_sources, commit);
if (anonymize) {
refname = anonymize_refname(refname);
anonymize_ident_line(&committer, &committer_end);
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 29d15d16d2..f2e985c00a 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -22,6 +22,11 @@ static int showbranch_use_color = -1;
static struct argv_array default_args = ARGV_ARRAY_INIT;
+/*
+ * TODO: convert this use of commit->object.flags to commit-slab
+ * instead to store a pointer to ref name directly. Then use the same
+ * UNINTERESTING definition from revision.h here.
+ */
#define UNINTERESTING 01
#define REV_SHIFT 2
diff --git a/commit-slab-hdr.h b/commit-slab-decl.h
similarity index 100%
rename from commit-slab-hdr.h
rename to commit-slab-decl.h
diff --git a/commit-slab-impl.h b/commit-slab-impl.h
index 19a88d7d8f..87a9cadfcc 100644
--- a/commit-slab-impl.h
+++ b/commit-slab-impl.h
@@ -87,7 +87,7 @@ struct slabname
* to allow a terminating semicolon, which makes instantiations look
* like function declarations. I.e., the expansion of
*
- * implement_commit_slab(indegree, int);
+ * implement_commit_slab(indegree, int, static);
*
* ends in 'struct indegree;'. This would otherwise
* be a syntax error according (at least) to ISO C. It's hard to
diff --git a/commit-slab.h b/commit-slab.h
index dc029acc66..69bf0c807c 100644
--- a/commit-slab.h
+++ b/commit-slab.h
@@ -1,7 +1,7 @@
#ifndef COMMIT_SLAB_H
#define COMMIT_SLAB_H
-#include "commit-slab-hdr.h"
+#include "commit-slab-decl.h"
#include "commit-slab-impl.h"
/*
diff --git a/commit.c b/commit.c
index 8202067cd5..e63a8dfeaa 100644
--- a/commit.c
+++ b/commit.c
@@ -1575,7 +1575,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,
}
define_commit_slab(merge_desc_slab, struct merge_remote_desc *);
-struct merge_desc_slab merge_desc_slab = COMMIT_SLAB_INIT(1, merge_desc_slab);
+static struct merge_desc_slab merge_desc_slab = COMMIT_SLAB_INIT(1, merge_desc_slab);
struct merge_remote_desc *merge_remote_util(struct commit *commit)
{
diff --git a/commit.h b/commit.h
index 70371e111e..4432458367 100644
--- a/commit.h
+++ b/commit.h
@@ -16,6 +16,11 @@ struct commit_list {
struct commit_list *next;
};
+/*
+ * The size of this struct matters in full repo walk operations like
+ * 'git clone' or 'git gc'. Consider using commit-slab to attach data
+ * to a commit instead of adding new fields here.
+ */
struct commit {
struct object object;
unsigned int index;
@@ -23,11 +28,6 @@ struct commit {
struct commit_list *parents;
struct tree *tree;
uint32_t graph_pos;
- /*
- * Do not add more fields here unless it's _very_ often
- * used. Use commit-slab to associate more data with a commit
- * instead.
- */
};
extern int save_commit_buffer;
diff --git a/object.h b/object.h
index b8e70e5519..caf36529f3 100644
--- a/object.h
+++ b/object.h
@@ -43,6 +43,7 @@ struct object_array {
* builtin/index-pack.c: 2021
* builtin/pack-objects.c: 20
* builtin/reflog.c: 10--12
+ * builtin/show-branch.c: 0-------------------------------------------26
* builtin/unpack-objects.c: 2021
*/
#define FLAG_BITS 27
diff --git a/revision.h b/revision.h
index f3dc5f9740..bf2239f876 100644
--- a/revision.h
+++ b/revision.h
@@ -6,7 +6,7 @@
#include "notes.h"
#include "pretty.h"
#include "diff.h"
-#include "commit-slab-hdr.h"
+#include "commit-slab-decl.h"
/* Remember to update object flag allocation in object.h */
#define SEEN (1u<<0)
diff --git a/sequencer.c b/sequencer.c
index dd4993fd99..3b6d56d085 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3161,7 +3161,7 @@ static enum check_level get_missing_commit_check_level(void)
return CHECK_IGNORE;
}
-define_commit_slab(commit_seen, uint8_t);
+define_commit_slab(commit_seen, unsigned char);
/*
* Check if the user dropped some commits by mistake
* Behaviour determined by rebase.missingCommitsCheck.
diff --git a/shallow.c b/shallow.c
index daf60a9391..0301049781 100644
--- a/shallow.c
+++ b/shallow.c
@@ -110,7 +110,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
} else {
commit = (struct commit *)
object_array_pop(&stack);
- cur_depth = **commit_depth_peek(&depths, commit);
+ cur_depth = **commit_depth_at(&depths, commit);
}
}
parse_commit_or_die(commit);
@@ -140,8 +140,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
NULL, &stack);
else {
commit = p->item;
- depth_slot = commit_depth_peek(&depths, commit);
- cur_depth = **depth_slot;
+ cur_depth = **commit_depth_at(&depths, commit);
}
}
}
Nguyễn Thái Ngọc Duy (15):
commit-slab.h: code split
commit-slab: support shared commit-slab
blame: use commit-slab for blame suspects instead of commit->util
describe: use commit-slab for commit names instead of commit->util
shallow.c: use commit-slab for commit depth instead of commit->util
sequencer.c: use commit-slab to mark seen commits
sequencer.c: use commit-slab to associate todo items to commits
revision.c: use commit-slab for show_source
bisect.c: use commit-slab for commit weight instead of commit->util
name-rev: use commit-slab for rev-name instead of commit->util
show-branch: use commit-slab for commit-name instead of commit->util
show-branch: note about its object flags usage
log: use commit-slab in prepare_bases() instead of commit->util
merge: use commit-slab in merge remote desc instead of commit->util
commit.h: delete 'util' field in struct commit
bisect.c | 12 +++--
blame.c | 42 +++++++++++----
blame.h | 2 +
builtin/blame.c | 2 +-
builtin/describe.c | 16 ++++--
builtin/fast-export.c | 14 +++--
builtin/log.c | 17 +++++--
builtin/merge.c | 25 ++++-----
builtin/name-rev.c | 23 +++++++--
builtin/show-branch.c | 44 +++++++++++-----
commit-slab-decl.h | 43 ++++++++++++++++
commit-slab-impl.h | 97 +++++++++++++++++++++++++++++++++++
commit-slab.h | 115 +++---------------------------------------
commit.c | 12 ++++-
commit.h | 8 ++-
log-tree.c | 8 ++-
merge-recursive.c | 8 +--
object.h | 1 +
revision.c | 19 +++++--
revision.h | 5 +-
sequencer.c | 24 ++++++---
shallow.c | 40 ++++++++++-----
22 files changed, 382 insertions(+), 195 deletions(-)
create mode 100644 commit-slab-decl.h
create mode 100644 commit-slab-impl.h
--
2.17.0.705.g3525833791
next prev parent reply other threads:[~2018-05-19 5:28 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-12 8:00 [PATCH 00/12] Die commit->util, die! Nguyễn Thái Ngọc Duy
2018-05-12 8:00 ` [PATCH 01/12] blame: use commit-slab for blame suspects instead of commit->util Nguyễn Thái Ngọc Duy
2018-05-12 9:22 ` Jeff King
2018-05-12 12:13 ` Duy Nguyen
2018-05-12 8:00 ` [PATCH 02/12] describe: use commit-slab for commit names " Nguyễn Thái Ngọc Duy
2018-05-12 8:00 ` [PATCH 03/12] shallow.c: use commit-slab for commit depth " Nguyễn Thái Ngọc Duy
2018-05-12 9:07 ` Jeff King
2018-05-12 9:18 ` Jeff King
2018-05-12 12:09 ` Duy Nguyen
2018-05-12 19:12 ` Jeff King
2018-05-12 11:59 ` Duy Nguyen
2018-05-12 8:00 ` [PATCH 04/12] sequencer.c: use commit-slab to mark seen commits Nguyễn Thái Ngọc Duy
2018-05-12 9:25 ` Jeff King
2018-05-12 13:43 ` Junio C Hamano
2018-05-12 14:00 ` Duy Nguyen
2018-05-12 8:00 ` [PATCH 05/12] sequencer.c: use commit-slab to associate todo items to commits Nguyễn Thái Ngọc Duy
2018-05-12 9:28 ` Jeff King
2018-05-12 8:00 ` [PATCH 06/12] revision.c: use commit-slab for show_source Nguyễn Thái Ngọc Duy
2018-05-12 9:33 ` Jeff King
2018-05-12 13:58 ` Junio C Hamano
2018-05-12 14:13 ` Duy Nguyen
2018-05-12 19:06 ` Jeff King
2018-05-12 8:00 ` [PATCH 07/12] bisect.c: use commit-slab for commit weight instead of commit->util Nguyễn Thái Ngọc Duy
2018-05-12 13:59 ` Junio C Hamano
2018-05-12 8:00 ` [PATCH 08/12] name-rev: use commit-slab for rev-name " Nguyễn Thái Ngọc Duy
2018-05-12 8:00 ` [PATCH 09/12] show-branch: use commit-slab for commit-name " Nguyễn Thái Ngọc Duy
2018-05-12 8:00 ` [PATCH 10/12] log: use commit-slab in prepare_bases() " Nguyễn Thái Ngọc Duy
2018-05-12 8:00 ` [PATCH 11/12] merge: use commit-slab in merge remote desc " Nguyễn Thái Ngọc Duy
2018-05-12 8:00 ` [PATCH 12/12] commit.h: delete 'util' field in struct commit Nguyễn Thái Ngọc Duy
2018-05-12 9:41 ` [PATCH 00/12] Die commit->util, die! Jeff King
2018-05-12 18:50 ` Jakub Narebski
2018-05-13 5:39 ` Duy Nguyen
2018-05-13 5:51 ` [PATCH v2 00/14] " Nguyễn Thái Ngọc Duy
2018-05-13 5:51 ` [PATCH v2 01/14] commit-slab.h: code split Nguyễn Thái Ngọc Duy
2018-05-13 23:33 ` Junio C Hamano
2018-05-13 5:51 ` [PATCH v2 02/14] commit-slab: support shared commit-slab Nguyễn Thái Ngọc Duy
2018-05-13 23:36 ` Junio C Hamano
2018-05-13 5:51 ` [PATCH v2 03/14] blame: use commit-slab for blame suspects instead of commit->util Nguyễn Thái Ngọc Duy
2018-05-13 23:42 ` Junio C Hamano
2018-05-13 5:51 ` [PATCH v2 04/14] describe: use commit-slab for commit names " Nguyễn Thái Ngọc Duy
2018-05-13 23:45 ` Junio C Hamano
2018-05-13 5:51 ` [PATCH v2 05/14] shallow.c: use commit-slab for commit depth " Nguyễn Thái Ngọc Duy
2018-05-13 5:52 ` [PATCH v2 06/14] sequencer.c: use commit-slab to mark seen commits Nguyễn Thái Ngọc Duy
2018-05-14 4:17 ` Junio C Hamano
2018-05-13 5:52 ` [PATCH v2 07/14] sequencer.c: use commit-slab to associate todo items to commits Nguyễn Thái Ngọc Duy
2018-05-13 5:52 ` [PATCH v2 08/14] revision.c: use commit-slab for show_source Nguyễn Thái Ngọc Duy
2018-05-14 5:10 ` Junio C Hamano
2018-05-14 5:37 ` Junio C Hamano
2018-05-13 5:52 ` [PATCH v2 09/14] bisect.c: use commit-slab for commit weight instead of commit->util Nguyễn Thái Ngọc Duy
2018-05-14 6:16 ` Junio C Hamano
2018-05-13 5:52 ` [PATCH v2 10/14] name-rev: use commit-slab for rev-name " Nguyễn Thái Ngọc Duy
2018-05-13 5:52 ` [PATCH v2 11/14] show-branch: use commit-slab for commit-name " Nguyễn Thái Ngọc Duy
2018-05-14 6:45 ` Junio C Hamano
2018-05-19 4:51 ` Duy Nguyen
2018-05-13 5:52 ` [PATCH v2 12/14] log: use commit-slab in prepare_bases() " Nguyễn Thái Ngọc Duy
2018-05-13 5:52 ` [PATCH v2 13/14] merge: use commit-slab in merge remote desc " Nguyễn Thái Ngọc Duy
2018-05-18 2:16 ` Junio C Hamano
2018-05-18 17:54 ` Ramsay Jones
2018-05-13 5:52 ` [PATCH v2 14/14] commit.h: delete 'util' field in struct commit Nguyễn Thái Ngọc Duy
2018-05-14 7:52 ` Junio C Hamano
2018-05-14 16:07 ` Duy Nguyen
2018-05-14 17:30 ` Duy Nguyen
2018-05-14 18:14 ` Derrick Stolee
2018-05-19 5:41 ` Duy Nguyen
2018-05-19 5:28 ` Nguyễn Thái Ngọc Duy [this message]
2018-05-19 5:28 ` [PATCH v3 01/15] commit-slab.h: code split Nguyễn Thái Ngọc Duy
2018-05-21 5:11 ` Junio C Hamano
2018-05-19 5:28 ` [PATCH v3 02/15] commit-slab: support shared commit-slab Nguyễn Thái Ngọc Duy
2018-05-19 5:28 ` [PATCH v3 03/15] blame: use commit-slab for blame suspects instead of commit->util Nguyễn Thái Ngọc Duy
2018-05-19 5:28 ` [PATCH v3 04/15] describe: use commit-slab for commit names " Nguyễn Thái Ngọc Duy
2018-05-19 5:28 ` [PATCH v3 05/15] shallow.c: use commit-slab for commit depth " Nguyễn Thái Ngọc Duy
2018-05-19 5:28 ` [PATCH v3 06/15] sequencer.c: use commit-slab to mark seen commits Nguyễn Thái Ngọc Duy
2018-05-19 5:28 ` [PATCH v3 07/15] sequencer.c: use commit-slab to associate todo items to commits Nguyễn Thái Ngọc Duy
2018-05-19 5:28 ` [PATCH v3 08/15] revision.c: use commit-slab for show_source Nguyễn Thái Ngọc Duy
2018-05-19 5:28 ` [PATCH v3 09/15] bisect.c: use commit-slab for commit weight instead of commit->util Nguyễn Thái Ngọc Duy
2018-05-19 5:28 ` [PATCH v3 10/15] name-rev: use commit-slab for rev-name " Nguyễn Thái Ngọc Duy
2018-05-19 5:28 ` [PATCH v3 11/15] show-branch: use commit-slab for commit-name " Nguyễn Thái Ngọc Duy
2018-05-19 5:28 ` [PATCH v3 12/15] show-branch: note about its object flags usage Nguyễn Thái Ngọc Duy
2018-05-19 5:28 ` [PATCH v3 13/15] log: use commit-slab in prepare_bases() instead of commit->util Nguyễn Thái Ngọc Duy
2018-05-19 5:28 ` [PATCH v3 14/15] merge: use commit-slab in merge remote desc " Nguyễn Thái Ngọc Duy
2018-05-19 5:28 ` [PATCH v3 15/15] commit.h: delete 'util' field in struct commit Nguyễn Thái Ngọc Duy
2018-05-22 22:40 ` [PATCH 00/12] Die commit->util, die! Stefan Beller
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=20180519052831.12603-1-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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 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 NNTP newsgroup(s).