Commit 4916c7c9 authored by Brad King's avatar Brad King

Merge topic 'submodule-custom-name'

8a26dd5c prepare: submodule directories are as their name, not path
289bece4 Merge branch 'submodule-add-renamed' into submodule-custom-name
d3403269 submodule: add at the root commit with a custom name
Acked-by: Brad King's avatarBrad King <>
Merge-request: !53
parents 4d3d3eb7 8a26dd5c
# v3.1.1 (unreleased)
* Submodules which have different names and paths are now properly handled.
# v3.1.0
* Added support for "update merges". This is equivalent to using the `ours`
......@@ -379,10 +379,7 @@ impl PreparingGitWorkArea {
let gitmoduledir = self.context.gitdir().join("modules");
.filter(|&(_, ref config)| {
.map_or(false, |path| gitmoduledir.join(path).exists())
.filter(|&(ref name, _)| gitmoduledir.join(name).exists())
......@@ -139,6 +139,7 @@ static ARBITRARY_COMMIT: &'static str = "9266430a205bc43fcb669a9b4825f2c69d36c3d
// These commits contain a submodule for testing merging and related tasks with them.
static BASE_COMMIT: &'static str = "6787f648d93d32e70aea9e94c85914422940a6c0";
static SUBMODULE_ADD_CUSTOM_NAME: &'static str = "d340326994009b57e70e0fc90730ba668d90dab4";
static SUBMODULE_UPDATE_COMMIT: &'static str = "1d1ac896e2908685d6c20f78821add835cb110e8";
static SUBMODULE_REWIND_COMMIT: &'static str = "6995e3989758531fdbd988ece628e7307ab59266";
static SUBMODULE_BRANCH1_COMMIT: &'static str = "6e8ae702722e39626ac686929234eea0dc3d48de";
......@@ -423,6 +424,36 @@ fn test_work_area_setup_submodule() {
fn test_work_area_setup_submodule_custom_name() {
let tempdir = test_workspace_dir("test_work_area_setup_submodule_custom_name");
let commit = CommitId::new(SUBMODULE_ADD_CUSTOM_NAME);
let ctx = git_context_submodule(tempdir.path(), &commit);
let workarea = ctx.prepare(&commit).unwrap();
check_workarea(&workarea, &commit);
let submodule_config = workarea.submodule_config()
.map(|(name, config)| {
.map(|(key, value)| (key.as_str(), value.as_str()))
.sorted_by(|ref a, ref b| Ord::cmp(&a.0, &b.0)))
.sorted_by(|ref a, ref b| Ord::cmp(&a.0, &b.0));
("path", "submodule"),
("url", ""),
fn test_setup_merge() {
let tempdir = test_workspace_dir("test_setup_merge");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment