just playing with tangled
at diffedit3 65 lines 1.8 kB view raw
1// Copyright 2020 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 15use crate::common::TestEnvironment; 16 17#[test] 18fn test_gitsubmodule_print_gitmodules() { 19 let test_env = TestEnvironment::default(); 20 let workspace_root = test_env.env_root().join("repo"); 21 git2::Repository::init(&workspace_root).unwrap(); 22 test_env.jj_cmd_ok(&workspace_root, &["init", "--git-repo", "."]); 23 24 std::fs::write( 25 workspace_root.join(".gitmodules"), 26 " 27[submodule \"old\"] 28 path = old 29 url = https://github.com/old/old.git 30", 31 ) 32 .unwrap(); 33 34 test_env.jj_cmd_ok(&workspace_root, &["new"]); 35 36 std::fs::write( 37 workspace_root.join(".gitmodules"), 38 " 39[submodule \"new\"] 40 path = new 41 url = https://github.com/new/new.git 42", 43 ) 44 .unwrap(); 45 46 let stdout = test_env.jj_cmd_success( 47 &workspace_root, 48 &["git", "submodule", "print-gitmodules", "-r", "@-"], 49 ); 50 insta::assert_snapshot!(stdout, @r###" 51 name:old 52 url:https://github.com/old/old.git 53 path:old 54 55 56 "###); 57 58 let stdout = 59 test_env.jj_cmd_success(&workspace_root, &["git", "submodule", "print-gitmodules"]); 60 insta::assert_snapshot!(stdout, @r###" 61 name:new 62 url:https://github.com/new/new.git 63 path:new 64 "###); 65}