summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-12-27 10:58:20 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-12-27 10:58:20 -0700
commitdeae758c243fb7e0c163b32fbddd3ed3038de132 (patch)
tree1d1eb8a84f4ba2f208e9be7749b3320173b878b6 /lib-src
parent9cde57fa58b70cf5d9233531edc08de5c93308fb (diff)
downloaddotfiles-deae758c243fb7e0c163b32fbddd3ed3038de132.tar.gz
check for detached HEADs in 'mr status', drop two old TODOs
Additionally, don't look for branches with unpushed commits in linked working trees. This avoids duplication in 'mr status' output for multiple repos.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/mr/config17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib-src/mr/config b/lib-src/mr/config
index 6a8a8743..e5622594 100644
--- a/lib-src/mr/config
+++ b/lib-src/mr/config
@@ -23,6 +23,21 @@ git_update = git pull-safe "$@"
# Sometimes will want to redefine for a repository to include --no-tags.
git_push = git push-all "$@"
+# Look for branches with unpushed commits in only the main working tree, but
+# look for loose commits on a possibly-detached HEAD in all working trees.
+# Thus, we assume that for each linked working tree registered with myrepos,
+# its main working tree is also registered (we don't assume the converse).
+git_status =
+ git status --short "$@" ||:
+ if [ ! -h .git -a -d .git ]; then
+ git --no-pager log HEAD --branches --not --remotes \
+ --simplify-by-decoration --decorate --oneline ||:
+ git --no-pager stash list
+ else
+ git --no-pager log HEAD --not --branches --remotes \
+ --simplify-by-decoration --decorate --oneline ||:
+ fi
+
# Custom actions to be configured repository-by-repository.
sync = :
autoci = :
@@ -86,7 +101,7 @@ lib =
mine() {
workstation || on spwhitton@athena spwhitton@erebus
}
- # myrepos git_status assumes a separate registration for each worktree.
+ #
git_worktree_checkout () {
local repo=$1; shift
local i=0