Skip to content

Commit e8948fa

Browse files
committed
Support offline mode for start-work
Sometimes the remote repo can be unavailable when a new work starts. That's why the execution of `start-work` should be continued regardless of `git pull` execution status.
1 parent 9e2acc0 commit e8948fa

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

libexec/git-elegant-start-work

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ MESSAGE
4444
local target=${2:-${MASTER}}
4545
git-verbose checkout ${target}
4646
if is-there-upstream-for ${target}; then
47-
git-verbose pull
47+
git-verbose pull || info-text "As the pull can't be completed, the current local version is used."
4848
fi
4949
git-verbose checkout -b "$1"
5050
}

tests/git-elegant-start-work.bats

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ teardown() {
2323
fake-fail "git pull"
2424
fake-pass "git rev-parse --abbrev-ref master@{upstream}"
2525
check git-elegant start-work test-feature
26-
[[ ${status} -eq 100 ]]
26+
[[ ${status} -eq 0 ]]
27+
[[ ${lines[@]} =~ "As the pull can't be completed, the current local version is used." ]]
2728
}
2829

2930
@test "'start-work': raises 45 error if work name is not set" {

0 commit comments

Comments
 (0)