~razzi/fish-functions

bccdbda753e3622c114b30404239250b48084fe4 — Razzi Abuissa 2 months ago b43394f
Make sync-repo fail fast if repo is not git repository
1 files changed, 4 insertions(+), 1 deletions(-)

M functions/sync-repo.fish
M functions/sync-repo.fish => functions/sync-repo.fish +4 -1
@@ 1,8 1,11 @@
function sync-repo --argument repo
    set repo_branch (git -C "$repo" current)
    set repo_branch (git -C "$repo" current) || return 1

    git -C "$repo" status -sb
    git -C "$repo" pull origin $repo_branch

    set commits_behind (git -C "$repo" rev-list --count origin/$repo_branch..HEAD)

    and if test $commits_behind -gt 0
        git -C "$repo" push
    end