Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-11-23 05:22:25 +0300
committerJunio C Hamano <gitster@pobox.com>2022-11-23 05:22:25 +0300
commitf8828f91256b5bc9731c313d59f8cd2d26901541 (patch)
treeaee159d961fcd0af67d953e180bddac06e9cc2e4 /revision.h
parent173fc54b005c92dc0da0fe5e71034128eddbacc8 (diff)
parentbcec6780b2ec77ea5f846d5448771f97110041e1 (diff)
Merge branch 'ps/receive-use-only-advertised'
"git receive-pack" used to use all the local refs as the boundary for checking connectivity of the data "git push" sent, but now it uses only the refs that it advertised to the pusher. In a repository with the .hideRefs configuration, this reduces the resources needed to perform the check. cf. <221028.86bkpw805n.gmgdl@evledraar.gmail.com> cf. <xmqqr0yrizqm.fsf@gitster.g> * ps/receive-use-only-advertised: receive-pack: only use visible refs for connectivity check rev-parse: add `--exclude-hidden=` option revision: add new parameter to exclude hidden refs revision: introduce struct to handle exclusions revision: move together exclusion-related functions refs: get rid of global list of hidden refs refs: fix memory leak when parsing hideRefs config
Diffstat (limited to 'revision.h')
-rw-r--r--revision.h43
1 files changed, 37 insertions, 6 deletions
diff --git a/revision.h b/revision.h
index 8493a3f3b9..30febad09a 100644
--- a/revision.h
+++ b/revision.h
@@ -81,6 +81,35 @@ struct rev_cmdline_info {
} *rev;
};
+struct ref_exclusions {
+ /*
+ * Excluded refs is a list of wildmatch patterns. If any of the
+ * patterns matches, the reference will be excluded.
+ */
+ struct string_list excluded_refs;
+
+ /*
+ * Hidden refs is a list of patterns that is to be hidden via
+ * `ref_is_hidden()`.
+ */
+ struct string_list hidden_refs;
+
+ /*
+ * Indicates whether hidden refs have been configured. This is to
+ * distinguish between no hidden refs existing and hidden refs not
+ * being parsed.
+ */
+ char hidden_refs_configured;
+};
+
+/**
+ * Initialize a `struct ref_exclusions` with a macro.
+ */
+#define REF_EXCLUSIONS_INIT { \
+ .excluded_refs = STRING_LIST_INIT_DUP, \
+ .hidden_refs = STRING_LIST_INIT_DUP, \
+}
+
struct oidset;
struct topo_walk_info;
@@ -103,7 +132,7 @@ struct rev_info {
struct list_objects_filter_options filter;
/* excluding from --branches, --refs, etc. expansion */
- struct string_list *ref_excludes;
+ struct ref_exclusions ref_excludes;
/* Basic information */
const char *prefix;
@@ -455,12 +484,14 @@ void mark_trees_uninteresting_sparse(struct repository *r, struct oidset *trees)
void show_object_with_name(FILE *, struct object *, const char *);
/**
- * Helpers to check if a "struct string_list" item matches with
- * wildmatch().
+ * Helpers to check if a reference should be excluded.
*/
-int ref_excluded(struct string_list *, const char *path);
-void clear_ref_exclusion(struct string_list **);
-void add_ref_exclusion(struct string_list **, const char *exclude);
+
+int ref_excluded(const struct ref_exclusions *exclusions, const char *path);
+void init_ref_exclusions(struct ref_exclusions *);
+void clear_ref_exclusions(struct ref_exclusions *);
+void add_ref_exclusion(struct ref_exclusions *, const char *exclude);
+void exclude_hidden_refs(struct ref_exclusions *, const char *section);
/**
* This function can be used if you want to add commit objects as revision