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#![expect(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 pub const NAME: &str = "default";
30
31 /// Load an existing SubmoduleStore
32 pub fn load(store_path: &Path) -> Self {
33 Self {
34 path: store_path.to_path_buf(),
35 }
36 }
37
38 pub fn init(store_path: &Path) -> Self {
39 Self {
40 path: store_path.to_path_buf(),
41 }
42 }
43}
44
45impl SubmoduleStore for DefaultSubmoduleStore {
46 fn name(&self) -> &str {
47 Self::NAME
48 }
49}