jj_lib/
default_submodule_store.rs

1// Copyright 2023 The Jujutsu Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#![allow(missing_docs)]
16
17use std::path::Path;
18use std::path::PathBuf;
19
20use crate::submodule_store::SubmoduleStore;
21
22#[derive(Debug)]
23pub struct DefaultSubmoduleStore {
24    #[expect(dead_code)]
25    path: PathBuf,
26}
27
28impl DefaultSubmoduleStore {
29    /// Load an existing SubmoduleStore
30    pub fn load(store_path: &Path) -> Self {
31        DefaultSubmoduleStore {
32            path: store_path.to_path_buf(),
33        }
34    }
35
36    pub fn init(store_path: &Path) -> Self {
37        DefaultSubmoduleStore {
38            path: store_path.to_path_buf(),
39        }
40    }
41
42    pub fn name() -> &'static str {
43        "default"
44    }
45}
46
47impl SubmoduleStore for DefaultSubmoduleStore {
48    fn name(&self) -> &str {
49        Self::name()
50    }
51}