Skip to content

Commit

Permalink
add GITMOB_COAUTHORS_PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
jplsek committed Jun 30, 2024
1 parent 5df181c commit cff2355
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ cargo install --path .
## Differences

- The XDG config directory is used by default (`~/.config/git-coauthors`) for the configuration, falling back to `~/.git-coauthors` if it exists.
- Setting the `GITMOB_COAUTHORS_PATH` environment variable will override this behavior.
- Since I primarily use the CLI, I won't make editor plugins related to git-mob-rs.

If someone else feels like making some of these missing features, feel free to submit a PR!
Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use gix_config::Source;
use linked_hash_map::LinkedHashMap;
use serde::{Deserialize, Serialize};
use serde_json::to_string_pretty;
use std::env;
use std::error::Error;
use std::fs::File;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -146,6 +147,10 @@ impl<T: FileActions, U: ExitWithError> GitMob<T, U> {
/// This supports both xdg (prioritized) or if the config is in the home directory (like
/// git-mob).
pub fn get_coauthors_path(&self) -> PathBuf {
if let Ok(path) = env::var("GITMOB_COAUTHORS_PATH") {
return PathBuf::from(path);
}

let file_name = "git-coauthors";

// most likely on fresh install after first use
Expand Down

0 comments on commit cff2355

Please sign in to comment.