local/bin/homesync: Properly error out when current branch has no remote
parent
36a1d04342
commit
2164a9ccac
|
@ -58,8 +58,13 @@ project_status() {
|
||||||
for i in ~/dotfiles ~/.password-store ~/personal ~/projects/* ~/.local/share/emacs/site-lisp/* "$@"; do
|
for i in ~/dotfiles ~/.password-store ~/personal ~/projects/* ~/.local/share/emacs/site-lisp/* "$@"; do
|
||||||
[ ! -d "$i/.git" ] && continue
|
[ ! -d "$i/.git" ] && continue
|
||||||
CHANGED=true
|
CHANGED=true
|
||||||
unmerged=$(git -C "$i" log --oneline origin/master..)
|
upstream=$(git -C "$i" rev-parse --abbrev-ref --symbolic-full-name @{u} 2>&1)
|
||||||
project_status "$i" "Unmerged commits" "$unmerged"
|
if [ $? -eq 0 ]; then
|
||||||
|
unmerged=$(git -C "$i" log --oneline "$upstream"..)
|
||||||
|
project_status "$i" "Unmerged commits" "$unmerged"
|
||||||
|
else
|
||||||
|
project_status "$i" "Unmerged commits" "$upstream"
|
||||||
|
fi
|
||||||
project_status "$i" "Unstaged files" "$(git -C "$i" diff --name-only)"
|
project_status "$i" "Unstaged files" "$(git -C "$i" diff --name-only)"
|
||||||
project_status "$i" "Staged files" "$(git -C "$i" diff --name-only --cached)"
|
project_status "$i" "Staged files" "$(git -C "$i" diff --name-only --cached)"
|
||||||
if $OPT_UPDATE && [ -n "$unmerged" ]; then
|
if $OPT_UPDATE && [ -n "$unmerged" ]; then
|
||||||
|
|
Loading…
Reference in New Issue