Skip to content

Commit

Permalink
Avoid adding the BRANCHOUT_HOME property to the Branchoutfile:
Browse files Browse the repository at this point in the history
the home is related to the user and not the branchout project itself so it should never be stored

fixes issue #27
  • Loading branch information
stickycode committed Sep 22, 2020
1 parent f851e30 commit 4e3c7ae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 15 additions & 1 deletion bats/branchout.bats
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ load helper
assert_success_file all/frog-aleph
}

@test "branchout add" {
@test "branchout init add to new branchout" {
mkdir -p target/tests/add
cd target/tests/add
HOME=${BUILD_DIRECTORY}
Expand All @@ -92,6 +92,20 @@ gitty"
assert_success_file_sort status/two-no-clone
}

@test "branchout init only sets url and name" {
mkdir -p target/tests/init-branchoutfile
cd target/tests/init-branchoutfile
HOME=${BUILD_DIRECTORY}
git init
run branchout-init <<< "brname
gitty"
assert_success
run branchout status
assert_error "No projects to show, try branchout add <project-name>"
assert_equal "BRANCHOUT_NAME=brname
BRANCHOUT_GIT_BASEURL=gitty" "$(cat Branchoutfile)"
}

@test "branchout add no params should error" {
example add-no-parameters
run branchout add
Expand Down
6 changes: 4 additions & 2 deletions branchout-init
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ function branchout_init_name() {
DEFAULT_BRANCHOUT_NAME="$(basename "${PWD}")"
printf "Enter branchout name [%s]: " "${DEFAULT_BRANCHOUT_NAME}"
read -r BRANCHOUT_NAME
test -z "${BRANCHOUT_NAME}" && BRANCHOUT_NAME="$(basename "${PWD}")" && echo
echo "BRANCHOUT_HOME=\"${HOME}/branchout/${BRANCHOUT_NAME}\"" >> ${BRANCHOUT_FILE}
if test -z "${BRANCHOUT_NAME}"; then
BRANCHOUT_NAME="${DEFAULT_BRANCHOUT_NAME}"
echo
fi
}

function branchout_init_baseurl() {
Expand Down

0 comments on commit 4e3c7ae

Please sign in to comment.