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
//! Git repository detection helpers.
//!
//! Consumed by `nb-api` directly and by downstream tools (e.g.,
//! `nb-mcp-server`'s `paths.rs`) via the published crate.
use PathBuf;
/// Derive the notebook name from the current Git repository.
///
/// Returns the directory name of the master repository (not the worktree).
/// Used as a fallback when no explicit notebook name is configured.
/// Run `git rev-parse` with the given arguments and return the output as a path.
///
/// Returns `None` if git is not available, the command fails, or the output is empty.