From 926627652f4d3f122a1ae6645a11517c1043d86d Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Thu, 11 Jan 2018 16:00:05 -0500 Subject: [PATCH] [git] Breaking changes in aliases and functions Rename `gpS` (mnemonic "pretty-signature") and `glS` ("log-signature") to `gcv` ("commit-verify") and `glv` ("log-verify") respectivelly, so `v` is used to verify signatures, and `s`/`S` is used to sign. Remove `git-commit-lost` and `git-stash-dropped`, as this could be probably joined into one function that shows all lost commits, including lost stashes, and also because there seems to be many different ways to do this, as discussed in https://stackoverflow.com/q/89332/2654518. An answer worth noting is https://stackoverflow.com/a/6455586/2654518. If someone is using this, let's discuss on a new solution... Remove Oh-My-Zsh compatibility from `git-branch-current`, and delete `git_current_branch`. This compatibility was already partially broken at c1b02c0, when we also updated the gitster prompt theme. Now this function fails when in 'detached HEAD' state (is was returning the commit hash in this state), which is what we would expect from the use we make of it. Closes #244 --- modules/git/README.md | 7 ++----- modules/git/functions/git-branch-current | 3 ++- modules/git/functions/git-commit-lost | 13 ------------- modules/git/functions/git-stash-dropped | 15 --------------- modules/git/functions/git_current_branch | 10 ---------- modules/git/init.zsh | 6 ++---- 6 files changed, 6 insertions(+), 48 deletions(-) mode change 120000 => 100644 modules/git/functions/git-branch-current delete mode 100644 modules/git/functions/git-commit-lost delete mode 100644 modules/git/functions/git-stash-dropped delete mode 100644 modules/git/functions/git_current_branch diff --git a/modules/git/README.md b/modules/git/README.md index 364ef28..1ff4f68 100644 --- a/modules/git/README.md +++ b/modules/git/README.md @@ -43,8 +43,8 @@ Aliases commits. - `gcR` removes the *HEAD* commit. - `gcs` shows one or more objects (blobs, trees, tags and commits). - - `gcl` lists lost commits. - `gcS` commits with GPG signature. + - `gcv` verifies the GPG signature of commits. ### Conflict @@ -104,7 +104,7 @@ Aliases - `glG` displays the graph log with authors and dates. - `glb` displays the brief commit log. - `glc` displays the commit count for each contributor in descending order. - - `glS` displays the log verifying the GPG signature of commits. + - `glv` displays the log verifying the GPG signature of commits. ### Merge @@ -152,7 +152,6 @@ Aliases - `gsx` drops a stashed state. - `gsX` drops all the stashed states. - `gsl` lists stashed states. - - `gsL` lists dropped stashed states. - `gsd` displays changes between the stash and its original parent. - `gsp` removes and applies a single stashed state from the stash list. - `gsr` recovers a given stashed state. @@ -219,12 +218,10 @@ Functions --------- - `git-branch-current` displays the current branch. - - `git-commit-lost` lists lost commits. - `git-dir` displays the path to the Git directory. - `git-ignore-add` adds any arguments to the .gitignore in the project root. - `git-root` displays the path to the working tree root. - `git-stash-clear-interactive` asks for confirmation before clearing the stash. - - `git-stash-dropped` lists dropped stashed states. - `git-stash-recover` recovers given dropped stashed states. - `git-submodule-move` moves a submodule. - `git-submodule-remove` removes a submodule. diff --git a/modules/git/functions/git-branch-current b/modules/git/functions/git-branch-current deleted file mode 120000 index 4b844e9..0000000 --- a/modules/git/functions/git-branch-current +++ /dev/null @@ -1 +0,0 @@ -git_current_branch \ No newline at end of file diff --git a/modules/git/functions/git-branch-current b/modules/git/functions/git-branch-current new file mode 100644 index 0000000..e118d46 --- /dev/null +++ b/modules/git/functions/git-branch-current @@ -0,0 +1,2 @@ +# vim:et sts=2 sw=2 ft=zsh +command git symbolic-ref -q --short HEAD diff --git a/modules/git/functions/git-commit-lost b/modules/git/functions/git-commit-lost deleted file mode 100644 index b327ec7..0000000 --- a/modules/git/functions/git-commit-lost +++ /dev/null @@ -1,13 +0,0 @@ -if ! command git rev-parse --is-inside-work-tree >/dev/null 2>&1; then - print "${0}: not a repository work tree: ${PWD}" >&2 - return 1 -fi - -command git fsck 2> /dev/null \ - | grep "^dangling commit" \ - | awk '{print $3}' \ - | command git log \ - --date-order \ - --no-walk \ - --stdin \ - --pretty=format:${_git_log_oneline_format} diff --git a/modules/git/functions/git-stash-dropped b/modules/git/functions/git-stash-dropped deleted file mode 100644 index 2190d05..0000000 --- a/modules/git/functions/git-stash-dropped +++ /dev/null @@ -1,15 +0,0 @@ -if ! command git rev-parse --is-inside-work-tree >/dev/null 2>&1; then - print "${0}: not a repository work tree: ${PWD}" >&2 - return 1 -fi - -command git fsck --unreachable 2> /dev/null \ - | grep 'commit' \ - | awk '{print $3}' \ - | command git log \ - --pretty=format:${_git_log_oneline_format} \ - --extended-regexp \ - --grep="${1:-(WIP )?[Oo]n [^:]+:}" \ - --merges \ - --no-walk \ - --stdin diff --git a/modules/git/functions/git_current_branch b/modules/git/functions/git_current_branch deleted file mode 100644 index 40c7068..0000000 --- a/modules/git/functions/git_current_branch +++ /dev/null @@ -1,10 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -# slightly modified git_current_branch from oh-my-zsh for theme compatibility -local ref -ref=$(command git symbolic-ref -q --short HEAD 2>/dev/null) -local -i ret=${?} -if (( ret )); then - (( ret == 128 )) && return # no git repo. - ref=$(command git rev-parse --short HEAD 2>/dev/null) || return -fi -print ${ref} diff --git a/modules/git/init.zsh b/modules/git/init.zsh index dce0ccb..b8d739d 100644 --- a/modules/git/init.zsh +++ b/modules/git/init.zsh @@ -45,9 +45,8 @@ alias gcP='git cherry-pick --no-commit' alias gcr='git revert' alias gcR='git reset "HEAD^"' alias gcs='git show --pretty=format:"${_git_log_medium_format}"' -alias gcl='git-commit-lost' alias gcS='git commit -S' -alias gpS='git show --pretty=short --show-signature' +alias gcv='git verify-commit' # Conflict (C) alias gCl='git --no-pager diff --diff-filter=U --name-only' @@ -102,7 +101,7 @@ alias glg='git log --topo-order --all --graph --pretty=format:"${_git_log_onelin alias glG='git log --topo-order --all --graph --pretty=format:"${_git_log_fullgraph_format}"' alias glb='git log --topo-order --pretty=format:"${_git_log_brief_format}"' alias glc='git shortlog --summary --numbered' -alias glS='git log --topo-order --show-signature --pretty=format:"${_git_log_medium_format}"' +alias glv='git log --topo-order --show-signature --pretty=format:"${_git_log_medium_format}"' # Merge (m) alias gm='git merge' @@ -143,7 +142,6 @@ alias gsa='git stash apply' alias gsx='git stash drop' alias gsX='git-stash-clear-interactive' alias gsl='git stash list' -alias gsL='git-stash-dropped' alias gsd='git stash show --patch --stat' alias gsp='git stash pop' alias gsr='git-stash-recover'