From 56675a7f7eb17d9c3bc59c8ebd0be022f9ae2bac Mon Sep 17 00:00:00 2001 From: David O'Trakoun Date: Wed, 16 Aug 2017 14:17:56 -0400 Subject: [PATCH] update with notes --- README.md | 3 ++- git-my | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6bcc3f7..a9db5f7 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Here's a screenshot: ## Installation +- Requires BASH 4+ - Add the `git-my` file somewhere in your path, e.g. `/usr/local/bin/` ### zplug installation @@ -58,5 +59,5 @@ merged into `origin/qa`. ---- -Copyright (c) 2015 David O'Trakoun +Copyright (c) 2017 David O'Trakoun diff --git a/git-my b/git-my index 1d9fdac..90689cc 100755 --- a/git-my +++ b/git-my @@ -1,18 +1,19 @@ #!/usr/bin/env bash -# git-my v1.1.1 +# git-my v1.1.2 # # Lists a user's remote branches and shows if it was merged -# and/or available locally +# and/or available locally. # -# Copyright (c) 2015 David O'Trakoun +# Copyright (c) 2017 David O'Trakoun +# +# Requires: +# bash 4+ for readarray # # Usage: # git my # -set -eu - # is_repository # # Exits with error if not a git repository @@ -233,7 +234,17 @@ main() { local remote_ref=${remote#*/} git_user=$(git config --get user.name) + if [ -z "$git_user" ]; then + echo "ERROR: user.name is not set in git config" + exit 1 + fi + git_remote=$(git config --get "remote.${remote_name}.url") + if [ -z "$git_remote" ]; then + echo "ERROR: remote.${remote_name}.url is not set" + exit 1 + fi + everyones_remotes=$(get_everyones_remotes "$remote_name") my_remotes=$(filter_mine "$git_user" "$everyones_remotes") merged_remote_branches=$(get_merged_remote_branches "$remote_name/$remote_ref")