From 4018afbdb583517277a0f1f7d990fa4c2a04923a Mon Sep 17 00:00:00 2001 From: Jannis Pohlmann Date: Wed, 29 Aug 2012 11:07:11 +0000 Subject: Make "morph show-system-branch" anywhere in a workspace, if possible There are mainly three situations to deal with: 1. We are outside a workspace and cannot deduce the system branch. 2. We are inside a workspace and inside a branch. We can detect this by walking up from the working directory towards the workspace. If we find a .morph-system-branch in one of the parent directories, we know the branch name. If we don't find one, something is wrong. 3. We are inside a workspace but outside a branch (or partially into a branch, e.g. in foo/ where the branch is foo/bar). We can deduce the branch if we recurse into subdirectories to find a .morph-system-branch directory. Care needs to be taken to not recurse infinitely. We may also not recurse if there are multiple subdirectories as these could belong to two different branches. This commit makes "morph show-system-branch" work in all of the above scenarios. It also adds tests for all of them. --- tests.branching/show-system-branch-fails-when-branch-is-ambiguous.exit | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests.branching/show-system-branch-fails-when-branch-is-ambiguous.exit (limited to 'tests.branching/show-system-branch-fails-when-branch-is-ambiguous.exit') diff --git a/tests.branching/show-system-branch-fails-when-branch-is-ambiguous.exit b/tests.branching/show-system-branch-fails-when-branch-is-ambiguous.exit new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/tests.branching/show-system-branch-fails-when-branch-is-ambiguous.exit @@ -0,0 +1 @@ +1 -- cgit v1.2.1