From e8948fa4f778c513a82c5deef62c651a929ae027 Mon Sep 17 00:00:00 2001 From: Dmytro Serdiuk Date: Thu, 12 Mar 2020 17:10:47 +0200 Subject: [PATCH] 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. --- libexec/git-elegant-start-work | 2 +- tests/git-elegant-start-work.bats | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libexec/git-elegant-start-work b/libexec/git-elegant-start-work index de0fe53..29408ab 100644 --- a/libexec/git-elegant-start-work +++ b/libexec/git-elegant-start-work @@ -44,7 +44,7 @@ MESSAGE local target=${2:-${MASTER}} git-verbose checkout ${target} if is-there-upstream-for ${target}; then - git-verbose pull + git-verbose pull || info-text "As the pull can't be completed, the current local version is used." fi git-verbose checkout -b "$1" } diff --git a/tests/git-elegant-start-work.bats b/tests/git-elegant-start-work.bats index 0292bf8..67573e5 100644 --- a/tests/git-elegant-start-work.bats +++ b/tests/git-elegant-start-work.bats @@ -23,7 +23,8 @@ teardown() { fake-fail "git pull" fake-pass "git rev-parse --abbrev-ref master@{upstream}" check git-elegant start-work test-feature - [[ ${status} -eq 100 ]] + [[ ${status} -eq 0 ]] + [[ ${lines[@]} =~ "As the pull can't be completed, the current local version is used." ]] } @test "'start-work': raises 45 error if work name is not set" {