Created
November 5, 2016 08:40
-
-
Save max630/7bd073658dea357d16fdcf6c1ff6cfca to your computer and use it in GitHub Desktop.
pr3436 vs submodules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
mkdir -p /tmp/pr3436/sub_origin | |
cd /tmp/pr3436/sub_origin | |
git init /tmp/pr3436/sub_origin | |
mkdir subdir | |
seq 1 10 >subdir/f | |
git add subdir/f | |
git commit -m 'subdir/f' -q | |
mkdir -p /tmp/pr3436/super_main | |
cd /tmp/pr3436/super_main | |
git init /tmp/pr3436/super_main | |
git submodule add /tmp/pr3436/sub_origin sub | |
cd sub | |
git worktree add -B master2 /tmp/pr3436/sub_worktree master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//// rest of the file | |
void test_worktree_worktree__submodule_worktree_open_as_repo(void) | |
{ | |
git_buf repo_path = GIT_BUF_INIT; | |
git_repository *repo; | |
cl_git_pass(git_repository_discover(&repo_path, "/tmp/pr3436/sub_worktree/subdir", 1, NULL)); | |
fprintf(stderr, "discovered: %s\n", repo_path.ptr); | |
cl_git_pass(git_repository_open(&repo, repo_path.ptr)); | |
fprintf(stderr, "worktree: %s\n", git_repository_workdir(repo)); | |
cl_assert_equal_s(git_repository_workdir(repo), "/tmp/pr3436/sub_worktree"); | |
git_repository_free(repo); | |
git_buf_free(&repo_path); | |
} | |
//// rest of the file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment