-
Notifications
You must be signed in to change notification settings - Fork 140
[RFC] Create 'core.featureAdoptionRate' setting to update config defaults #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -577,7 +577,8 @@ the `GIT_NOTES_REF` environment variable. See linkgit:git-notes[1]. | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Carlo Arenas wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Carlo Arenas wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Duy Nguyen wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Ævar Arnfjörð Bjarmason wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Jakub Narebski wrote (reply to this):
|
||
core.commitGraph:: | ||
If true, then git will read the commit-graph file (if it exists) | ||
to parse the graph structure of commits. Defaults to false. See | ||
to parse the graph structure of commits. Defaults to false, unless | ||
`core.featureAdoptionRate` is at least three. See | ||
linkgit:git-commit-graph[1] for more information. | ||
|
||
core.useReplaceRefs:: | ||
|
@@ -601,3 +602,34 @@ core.abbrev:: | |
in your repository, which hopefully is enough for | ||
abbreviated object names to stay unique for some time. | ||
The minimum length is 4. | ||
|
||
core.featureAdoptionRate:: | ||
Set an integer value on a scale from 0 to 10 describing your | ||
desire to adopt new performance features. Defaults to 0. As | ||
the value increases, features are enabled by changing the | ||
default values of other config settings. If a config variable | ||
is specified explicitly, the explicit value will override these | ||
defaults: | ||
+ | ||
If the value is at least 3, then the following defaults are modified. | ||
These represent relatively new features that have existed for multiple | ||
major releases, and may present performance benefits. These benefits | ||
depend on the amount and kind of data in your repo and how you use it. | ||
The settings do not modify the user-facing output of porcelain commands. | ||
+ | ||
* `core.commitGraph=true` enables reading commit-graph files. | ||
+ | ||
* `gc.writeCommitGraph=true` eneables writing commit-graph files during | ||
`git gc`. | ||
+ | ||
* `index.version=4` uses prefix-compression to reduce the size of the | ||
.git/index file. | ||
+ | ||
If the value is at least 5, then all of the defaults above are included, | ||
plus the defaults below. These represent new features that present | ||
significant performance benefits, but may not have been released for | ||
multiple major versions. | ||
+ | ||
* `pack.useSparse=true` uses the sparse tree-walk algorithm, which is | ||
optimized for enumerating objects during linkgit:git-push[1] from a | ||
client machine. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include "cache.h" | ||
#include "repository.h" | ||
#include "config.h" | ||
#include "repo-settings.h" | ||
|
||
#define UPDATE_DEFAULT(s,v) do { if (s == -1) { s = v; } } while(0) | ||
|
||
static int git_repo_config(const char *key, const char *value, void *cb) | ||
{ | ||
struct repo_settings *rs = (struct repo_settings *)cb; | ||
|
||
if (!strcmp(key, "core.featureadoptionrate")) { | ||
int rate = git_config_int(key, value); | ||
if (rate >= 3) { | ||
UPDATE_DEFAULT(rs->core_commit_graph, 1); | ||
UPDATE_DEFAULT(rs->gc_write_commit_graph, 1); | ||
UPDATE_DEFAULT(rs->index_version, 4); | ||
} | ||
if (rate >= 5) { | ||
UPDATE_DEFAULT(rs->pack_use_sparse, 1); | ||
} | ||
return 0; | ||
} | ||
if (!strcmp(key, "core.commitgraph")) { | ||
rs->core_commit_graph = git_config_bool(key, value); | ||
return 0; | ||
} | ||
if (!strcmp(key, "gc.writecommitgraph")) { | ||
rs->gc_write_commit_graph = git_config_bool(key, value); | ||
return 0; | ||
} | ||
if (!strcmp(key, "pack.usesparse")) { | ||
rs->pack_use_sparse = git_config_bool(key, value); | ||
return 0; | ||
} | ||
if (!strcmp(key, "index.version")) { | ||
rs->index_version = git_config_int(key, value); | ||
return 0; | ||
} | ||
|
||
return 1; | ||
} | ||
|
||
void prepare_repo_settings(struct repository *r) | ||
{ | ||
if (r->settings) | ||
return; | ||
|
||
r->settings = xmalloc(sizeof(*r->settings)); | ||
|
||
/* Defaults */ | ||
r->settings->core_commit_graph = -1; | ||
r->settings->gc_write_commit_graph = -1; | ||
r->settings->pack_use_sparse = -1; | ||
r->settings->index_version = -1; | ||
|
||
repo_config(r, git_repo_config, r->settings); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef REPO_SETTINGS_H | ||
#define REPO_SETTINGS_H | ||
|
||
struct repo_settings { | ||
int core_commit_graph; | ||
int gc_write_commit_graph; | ||
int pack_use_sparse; | ||
int index_version; | ||
}; | ||
|
||
struct repository; | ||
|
||
void prepare_repo_settings(struct repository *r); | ||
|
||
#endif /* REPO_SETTINGS_H */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Jeff Hostetler wrote (reply to this):