git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
5e9249c4370f824f373ac7257dd17d6635e10a68 blob 3334 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
 
#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, "feature.experimental")) {
		UPDATE_DEFAULT(rs->pack_use_sparse, 1);
		UPDATE_DEFAULT(rs->merge_directory_renames, MERGE_DIRECTORY_RENAMES_TRUE);
		UPDATE_DEFAULT(rs->fetch_negotiation_algorithm, FETCH_NEGOTIATION_SKIPPING);
		return 0;
	}
	if (!strcmp(key, "feature.manycommits")) {
		UPDATE_DEFAULT(rs->core_commit_graph, 1);
		UPDATE_DEFAULT(rs->gc_write_commit_graph, 1);
		return 0;
	}
	if (!strcmp(key, "feature.manyfiles")) {
		UPDATE_DEFAULT(rs->index_version, 4);
		UPDATE_DEFAULT(rs->core_untracked_cache,
			       CORE_UNTRACKED_CACHE_KEEP | CORE_UNTRACKED_CACHE_WRITE);
		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;
	}
	if (!strcmp(key, "core.untrackedcache")) {
		int bool_value = git_parse_maybe_bool(value);
		if (bool_value == 0)
			rs->core_untracked_cache = 0;
		else if (bool_value == 1)
			rs->core_untracked_cache = CORE_UNTRACKED_CACHE_KEEP |
						   CORE_UNTRACKED_CACHE_WRITE;
		else if (!strcasecmp(value, "keep"))
			rs->core_untracked_cache = CORE_UNTRACKED_CACHE_KEEP;
		else
			error(_("unknown core.untrackedCache value '%s'; "
				"using 'keep' default value"), value);
		return 0;
	}
	if (!strcmp(key, "merge.directoryrenames")) {
		int bool_value = git_parse_maybe_bool(value);
		if (0 <= bool_value) {
			rs->merge_directory_renames = bool_value ? MERGE_DIRECTORY_RENAMES_TRUE : 0;
		} else if (!strcasecmp(value, "conflict")) {
			rs->merge_directory_renames = MERGE_DIRECTORY_RENAMES_CONFLICT;
		}
		return 0;
	}
	if (!strcmp(key, "fetch.negotiationalgorithm"))	{
		if (!strcasecmp(value, "skipping")) {
			rs->fetch_negotiation_algorithm = FETCH_NEGOTIATION_SKIPPING;
		} else {
			rs->fetch_negotiation_algorithm = FETCH_NEGOTIATION_DEFAULT;
		}
		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->index_version = -1;
	r->settings->core_untracked_cache = -1;

	r->settings->pack_use_sparse = -1;
	r->settings->merge_directory_renames = -1;
	r->settings->fetch_negotiation_algorithm = -1;

	repo_config(r, git_repo_config, r->settings);

	/* Hack for test programs like test-dump-untracked-cache */
	if (ignore_untracked_cache_config)
		r->settings->core_untracked_cache = CORE_UNTRACKED_CACHE_KEEP;
	else
		UPDATE_DEFAULT(r->settings->core_untracked_cache, CORE_UNTRACKED_CACHE_KEEP);

	UPDATE_DEFAULT(r->settings->merge_directory_renames, MERGE_DIRECTORY_RENAMES_CONFLICT);
	UPDATE_DEFAULT(r->settings->fetch_negotiation_algorithm, FETCH_NEGOTIATION_DEFAULT);
}
debug log:

solving 5e9249c437 ...
found 5e9249c437 in https://public-inbox.org/git/da7685936f44a32121ec0568df2a9f23e4003506.1563818059.git.gitgitgadget@gmail.com/
found 9e4b8e6268 in https://public-inbox.org/git/63b522a858bdd2fad78da53eae207e64f2f7a6e0.1563818059.git.gitgitgadget@gmail.com/
found 807c5a29d6 in https://public-inbox.org/git/47ae3e7d4d765a00d14e8892db88a8936d56591b.1563818059.git.gitgitgadget@gmail.com/
found f328602fd7 in https://public-inbox.org/git/e00a1be75b410694374b0d9bd60ab16d67ef6d20.1563818059.git.gitgitgadget@gmail.com/
found 13a9128f62 in https://public-inbox.org/git/72f652b89c71526cc423e7812de66f41a079f181.1563818059.git.gitgitgadget@gmail.com/

applying [1/5] https://public-inbox.org/git/72f652b89c71526cc423e7812de66f41a079f181.1563818059.git.gitgitgadget@gmail.com/
diff --git a/repo-settings.c b/repo-settings.c
new file mode 100644
index 0000000000..13a9128f62


applying [2/5] https://public-inbox.org/git/e00a1be75b410694374b0d9bd60ab16d67ef6d20.1563818059.git.gitgitgadget@gmail.com/
diff --git a/repo-settings.c b/repo-settings.c
index 13a9128f62..f328602fd7 100644


applying [3/5] https://public-inbox.org/git/47ae3e7d4d765a00d14e8892db88a8936d56591b.1563818059.git.gitgitgadget@gmail.com/
diff --git a/repo-settings.c b/repo-settings.c
index f328602fd7..807c5a29d6 100644


applying [4/5] https://public-inbox.org/git/63b522a858bdd2fad78da53eae207e64f2f7a6e0.1563818059.git.gitgitgadget@gmail.com/
diff --git a/repo-settings.c b/repo-settings.c
index 807c5a29d6..9e4b8e6268 100644


applying [5/5] https://public-inbox.org/git/da7685936f44a32121ec0568df2a9f23e4003506.1563818059.git.gitgitgadget@gmail.com/
diff --git a/repo-settings.c b/repo-settings.c
index 9e4b8e6268..5e9249c437 100644

Checking patch repo-settings.c...
Applied patch repo-settings.c cleanly.
Checking patch repo-settings.c...
Applied patch repo-settings.c cleanly.
Checking patch repo-settings.c...
Applied patch repo-settings.c cleanly.
Checking patch repo-settings.c...
Applied patch repo-settings.c cleanly.
Checking patch repo-settings.c...
Applied patch repo-settings.c cleanly.

index at:
100644 5e9249c4370f824f373ac7257dd17d6635e10a68	repo-settings.c

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git