MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / handle_gitignore

Function handle_gitignore

src/commands.rs:1128–1158  ·  view source on GitHub ↗
(
    path: Option<String>,
    action: Option<String>,
)

Source from the content-addressed store, hash-verified

1126}
1127
1128pub(crate) fn handle_gitignore(
1129 path: Option<String>,
1130 action: Option<String>,
1131) -> tracedecay::errors::Result<()> {
1132 let project_path = tracedecay::config::resolve_path(path);
1133 let mut config = tracedecay::config::load_config(&project_path)?;
1134 match action.as_deref() {
1135 Some("on") => {
1136 config.git_ignore = true;
1137 tracedecay::config::save_config(&project_path, &config)?;
1138 eprintln!("gitignore enabled — .gitignore rules will be respected during indexing.");
1139 eprintln!("Run `tracedecay sync` to re-index with the new setting.");
1140 }
1141 Some("off") => {
1142 config.git_ignore = false;
1143 tracedecay::config::save_config(&project_path, &config)?;
1144 eprintln!("gitignore disabled — .gitignore rules will be ignored during indexing.");
1145 eprintln!("Run `tracedecay sync` to re-index with the new setting.");
1146 }
1147 Some(other) => {
1148 return Err(tracedecay::errors::TraceDecayError::Config {
1149 message: format!("unknown action '{other}': expected 'on' or 'off'"),
1150 });
1151 }
1152 None => {
1153 let status = if config.git_ignore { "on" } else { "off" };
1154 eprintln!("gitignore: {status}");
1155 }
1156 }
1157 Ok(())
1158}
1159
1160pub(crate) async fn handle_bench(
1161 queries: Option<String>,

Callers 1

dispatch_commandFunction · 0.85

Calls 3

resolve_pathFunction · 0.85
load_configFunction · 0.85
save_configFunction · 0.85

Tested by

no test coverage detected