Skip to content

Commit 8a57be8

Browse files
committed
Revert "remove #[momo] directive as it seems to prevent auto-completion in IDEs."
This reverts commit 3a339da.
1 parent ca8d64c commit 8a57be8

File tree

18 files changed

+55
-0
lines changed

18 files changed

+55
-0
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gix/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ cache-efficiency-debug = ["gix-features/cache-efficiency-debug"]
304304

305305

306306
[dependencies]
307+
gix-macros = { version = "^0.1.5", path = "../gix-macros" }
307308
gix-utils = { version = "^0.3.0", path = "../gix-utils" }
308309
gix-fs = { version = "^0.15.0", path = "../gix-fs" }
309310
gix-ref = { version = "^0.52.1", path = "../gix-ref" }

gix/src/config/snapshot/access.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
use std::{borrow::Cow, ffi::OsStr};
33

44
use gix_features::threading::OwnShared;
5+
use gix_macros::momo;
56

67
use crate::{
78
bstr::{BStr, BString, ByteSlice},
@@ -25,6 +26,7 @@ impl<'repo> Snapshot<'repo> {
2526
}
2627

2728
/// Like [`boolean()`][Self::boolean()], but it will report an error if the value couldn't be interpreted as boolean.
29+
#[momo]
2830
pub fn try_boolean(&self, key: impl gix_config::AsKey) -> Option<Result<bool, gix_config::value::Error>> {
2931
self.repo.config.resolved.boolean(key)
3032
}
@@ -40,20 +42,23 @@ impl<'repo> Snapshot<'repo> {
4042
}
4143

4244
/// Like [`integer()`][Self::integer()], but it will report an error if the value couldn't be interpreted as boolean.
45+
#[momo]
4346
pub fn try_integer(&self, key: impl gix_config::AsKey) -> Option<Result<i64, gix_config::value::Error>> {
4447
self.repo.config.resolved.integer(key)
4548
}
4649

4750
/// Return the string at `key`, or `None` if there is no such value.
4851
///
4952
/// Note that this method takes the most recent value at `key` even if it is from a file with reduced trust.
53+
#[momo]
5054
pub fn string(&self, key: impl gix_config::AsKey) -> Option<Cow<'repo, BStr>> {
5155
self.repo.config.resolved.string(key)
5256
}
5357

5458
/// Return the trusted and fully interpolated path at `key`, or `None` if there is no such value
5559
/// or if no value was found in a trusted file.
5660
/// An error occurs if the path could not be interpolated to its final value.
61+
#[momo]
5762
pub fn trusted_path(
5863
&self,
5964
key: impl gix_config::AsKey,
@@ -63,6 +68,7 @@ impl<'repo> Snapshot<'repo> {
6368

6469
/// Return the trusted string at `key` for launching using [command::prepare()](gix_command::prepare()),
6570
/// or `None` if there is no such value or if no value was found in a trusted file.
71+
#[momo]
6672
pub fn trusted_program(&self, key: impl gix_config::AsKey) -> Option<Cow<'repo, OsStr>> {
6773
let value = self
6874
.repo
@@ -112,6 +118,7 @@ impl<'repo> SnapshotMut<'repo> {
112118

113119
/// Set the value at `key` to `new_value`, possibly creating the section if it doesn't exist yet, or overriding the most recent existing
114120
/// value, which will be returned.
121+
#[momo]
115122
pub fn set_value<'b>(
116123
&mut self,
117124
key: &'static dyn crate::config::tree::Key,
@@ -135,6 +142,7 @@ impl<'repo> SnapshotMut<'repo> {
135142

136143
/// Set the value at `key` to `new_value` in the given `subsection`, possibly creating the section and sub-section if it doesn't exist yet,
137144
/// or overriding the most recent existing value, which will be returned.
145+
#[momo]
138146
pub fn set_subsection_value<'a, 'b>(
139147
&mut self,
140148
key: &'static dyn crate::config::tree::Key,

gix/src/create.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::{
66

77
use gix_config::parse::section;
88
use gix_discover::DOT_GIT_DIR;
9+
use gix_macros::momo;
910

1011
/// The error used in [`into()`].
1112
#[derive(Debug, thiserror::Error)]
@@ -124,6 +125,7 @@ pub struct Options {
124125
/// Note that this is a simple template-based initialization routine which should be accompanied with additional corrections
125126
/// to respect git configuration, which is accomplished by [its callers][crate::ThreadSafeRepository::init_opts()]
126127
/// that return a [Repository][crate::Repository].
128+
#[momo]
127129
pub fn into(
128130
directory: impl Into<PathBuf>,
129131
kind: Kind,

gix/src/discover.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
use std::path::Path;
33

44
pub use gix_discover::*;
5+
use gix_macros::momo;
56

67
use crate::{bstr::BString, ThreadSafeRepository};
78

@@ -31,6 +32,7 @@ impl ThreadSafeRepository {
3132
/// if the directory that is discovered can indeed be trusted (or else they'd have to implement the discovery themselves
3233
/// and be sure that no attacker ever gets access to a directory structure. The cost of this is a permission check, which
3334
/// seems acceptable).
35+
#[momo]
3436
pub fn discover_opts(
3537
directory: impl AsRef<Path>,
3638
options: upwards::Options<'_>,
@@ -68,6 +70,7 @@ impl ThreadSafeRepository {
6870
/// Consider to set [`match_ceiling_dir_or_error = false`](gix_discover::upwards::Options::match_ceiling_dir_or_error)
6971
/// to allow discovery if an outside environment variable sets non-matching ceiling directories for greater
7072
/// compatibility with Git.
73+
#[momo]
7174
pub fn discover_with_environment_overrides_opts(
7275
directory: impl AsRef<Path>,
7376
mut options: upwards::Options<'_>,

gix/src/init.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![allow(clippy::result_large_err)]
22
use std::{borrow::Cow, path::Path};
33

4+
use gix_macros::momo;
45
use gix_ref::{
56
store::WriteReflog,
67
transaction::{PreviousValue, RefEdit},
@@ -40,6 +41,7 @@ impl ThreadSafeRepository {
4041
///
4142
/// Fails without action if there is already a `.git` repository inside of `directory`, but
4243
/// won't mind if the `directory` otherwise is non-empty.
44+
#[momo]
4345
pub fn init(
4446
directory: impl AsRef<Path>,
4547
kind: crate::create::Kind,
@@ -56,6 +58,7 @@ impl ThreadSafeRepository {
5658
///
5759
/// Instead of naming the default branch `master`, we name it `main` unless configured explicitly using the `init.defaultBranch`
5860
/// configuration key.
61+
#[momo]
5962
pub fn init_opts(
6063
directory: impl AsRef<Path>,
6164
kind: crate::create::Kind,

gix/src/object/tree/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use gix_hash::ObjectId;
2+
use gix_macros::momo;
23
pub use gix_object::tree::{EntryKind, EntryMode};
34
use gix_object::{bstr::BStr, FindExt, TreeRefIter};
45

@@ -142,6 +143,7 @@ impl<'repo> Tree<'repo> {
142143
///
143144
/// If any path component contains illformed UTF-8 and thus can't be converted to bytes on platforms which can't do so natively,
144145
/// the returned component will be empty which makes the lookup fail.
146+
#[momo]
145147
pub fn lookup_entry_by_path(
146148
&self,
147149
relative_path: impl AsRef<std::path::Path>,
@@ -160,6 +162,7 @@ impl<'repo> Tree<'repo> {
160162
///
161163
/// If any path component contains illformed UTF-8 and thus can't be converted to bytes on platforms which can't do so natively,
162164
/// the returned component will be empty which makes the lookup fail.
165+
#[momo]
163166
pub fn peel_to_entry_by_path(
164167
&mut self,
165168
relative_path: impl AsRef<std::path::Path>,

gix/src/open/repository.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![allow(clippy::result_large_err)]
22
use gix_config::file::Metadata;
33
use gix_features::threading::OwnShared;
4+
use gix_macros::momo;
45
use gix_object::bstr::ByteSlice;
56
use gix_path::RelativePath;
67
use std::path::Path;
@@ -67,6 +68,7 @@ impl ThreadSafeRepository {
6768
///
6869
/// Note that opening a repository for implementing custom hooks is also handle specifically in
6970
/// [`open_with_environment_overrides()`][Self::open_with_environment_overrides()].
71+
#[momo]
7072
pub fn open_opts(path: impl Into<PathBuf>, mut options: Options) -> Result<Self, Error> {
7173
let _span = gix_trace::coarse!("ThreadSafeRepository::open()");
7274
let (path, kind) = {
@@ -120,6 +122,7 @@ impl ThreadSafeRepository {
120122
// GIT_PROXY_SSL_CERT, GIT_PROXY_SSL_KEY, GIT_PROXY_SSL_CERT_PASSWORD_PROTECTED.
121123
// GIT_PROXY_SSL_CAINFO, GIT_SSL_CIPHER_LIST, GIT_HTTP_MAX_REQUESTS, GIT_CURL_FTP_NO_EPSV,
122124
#[doc(alias = "open_from_env", alias = "git2")]
125+
#[momo]
123126
pub fn open_with_environment_overrides(
124127
fallback_directory: impl Into<PathBuf>,
125128
trust_map: gix_sec::trust::Mapping<Options>,

gix/src/pathspec.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! Pathspec plumbing and abstractions
2+
use gix_macros::momo;
23
pub use gix_pathspec::*;
34

45
use crate::{bstr::BStr, AttributeStack, Pathspec, PathspecDetached, Repository};
@@ -122,6 +123,7 @@ impl<'repo> Pathspec<'repo> {
122123
alias = "matches_path",
123124
alias = "git2"
124125
)]
126+
#[momo]
125127
pub fn pattern_matching_relative_path<'a>(
126128
&mut self,
127129
relative_path: impl Into<&'a BStr>,
@@ -142,6 +144,7 @@ impl<'repo> Pathspec<'repo> {
142144

143145
/// The simplified version of [`pattern_matching_relative_path()`](Self::pattern_matching_relative_path()) which returns
144146
/// `true` if `relative_path` is included in the set of positive pathspecs, while not being excluded.
147+
#[momo]
145148
pub fn is_included<'a>(&mut self, relative_path: impl Into<&'a BStr>, is_dir: Option<bool>) -> bool {
146149
self.pattern_matching_relative_path(relative_path, is_dir)
147150
.is_some_and(|m| !m.is_excluded())
@@ -176,6 +179,7 @@ impl PathspecDetached {
176179
alias = "matches_path",
177180
alias = "git2"
178181
)]
182+
#[momo]
179183
pub fn pattern_matching_relative_path<'a>(
180184
&mut self,
181185
relative_path: impl Into<&'a BStr>,
@@ -196,6 +200,7 @@ impl PathspecDetached {
196200

197201
/// The simplified version of [`pattern_matching_relative_path()`](Self::pattern_matching_relative_path()) which returns
198202
/// `true` if `relative_path` is included in the set of positive pathspecs, while not being excluded.
203+
#[momo]
199204
pub fn is_included<'a>(&mut self, relative_path: impl Into<&'a BStr>, is_dir: Option<bool>) -> bool {
200205
self.pattern_matching_relative_path(relative_path, is_dir)
201206
.is_some_and(|m| !m.is_excluded())

gix/src/reference/edits.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
///
22
pub mod set_target_id {
3+
use gix_macros::momo;
34
use gix_ref::{transaction::PreviousValue, Target};
45

56
use crate::{bstr::BString, Reference};
@@ -28,6 +29,7 @@ pub mod set_target_id {
2829
/// If multiple reference should be changed, use [`Repository::edit_references()`][crate::Repository::edit_references()]
2930
/// or the lower level reference database instead.
3031
#[allow(clippy::result_large_err)]
32+
#[momo]
3133
pub fn set_target_id(
3234
&mut self,
3335
id: impl Into<gix_hash::ObjectId>,

0 commit comments

Comments
 (0)