summaryrefslogtreecommitdiff
path: root/lib/git.zsh
AgeCommit message (Collapse)Author
2024-06-12fix(lib/git): turn off async prompt for zsh < 5.0.6Marc Cornellà
We removed this mitigation in 0c80a063 because of an assumption that the issue had been fixed, but it looks like zsh < 5.0.6 has other issues (see #12360), so we need to disable it for real. Fixes #12360
2024-04-22chore(async): reenable async prompt by default on zsh < 5.0.6 (#12358)Marc Cornellà
Fixes #12331
2024-04-17fix(git): turn off async prompt by default on zsh < 5.0.6 (#12331)Marc Cornellà
See https://github.com/ohmyzsh/ohmyzsh/issues/12331#issuecomment-2059460268
2024-04-05fix(lib/git): fix detection of function use in promptMarc Cornellà
RPS1 and RPROMPT are not equivalent, though they have the same effect. Added both to detect if `git_prompt_*` is used. Fixes #12325
2024-04-04fix(git): disable locally `ksharrays`Carlo Sala
Fixes #12321
2024-04-03feat(git): implement async completion for `git_prompt_status` (#12319)Loïc Yhuel
This is important for themes using it, since it is usually a little slower than git_prompt_info. Also two small fixes : - the handler for git_prompt_info was incorrectly named _omz_git_prompt_status - _defer_async_git_register was kept in precmd, there is no need to call it on each prompt
2024-04-03feat(git)!: enable async git prompt (now for real)Marc Cornellà
BREAKING CHANGE: the new async prompt feature will render prompt information asyncronously and degrade nicely when the calls take too long to finish, as the prompt will already be first drawn and interactive. This is enabled by default for the git prompt and themes that use it (`git_prompt_info`). If you find that it's not working for you, please open an issue if one is not already opened, and see https://github.com/ohmyzsh/ohmyzsh#disable-async-git-prompt for how to turn it off.
2024-03-09fix(async): register the git prompt async handler correctly (#12267)Marc Cornellà
This fix conditionally registers the git prompt async handler only if `git_prompt_info` is used anywhere in the prompt variables. This is done in the proper order, so that the async request is processed once the handler has been registered. This fix also passes the return value of the previous command to each of the async handlers, in case they are needed.
2024-03-07fix(git): disable temporarely async promptCarlo Sala
2024-03-07feat(async)!: implement async prompt API and apply to git prompt (#12257)Marc Cornellà
BREAKING CHANGE: the `git_prompt_info` prompt function has been reworked by default to use the new async prompt feature. If you're experiencing issues see #12257. Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2022-11-08feat(git): display tag in git-prompt when possible (#11318)Banst
Co-authored-by: Marc Cornellà <hello@mcornella.com>
2022-05-12Revert "fix(lib): don't return clean with `hide-dirty=1` in ↵Marc Cornellà
`parse_git_dirty`" (#10927)
2022-05-12fix(lib): don't return clean with `hide-dirty=1` in `parse_git_dirty` (#10897)Will LE
2022-01-03fix(lib): quote % in `git_remote_status`Marc Cornellà
2021-12-13fix(lib): %-quote git prompt functionsMarc Cornellà
2021-11-09style: use `-n` flag in `head` and `tail` commands (#10391)Kevin Burke
Co-authored-by: Marc Cornellà <hello@mcornella.com>
2021-10-09fix(lib): fix status exit code check in `git_prompt_status` (#10275)Pooya Vahidi
2021-01-16fix(lib): use -N syntax in `head` and `tail` to support Solaris (#6391)Marc Cornellà
Closes #6391 Co-authored-by: Sergey Mashkov <cy6erGn0m@gmail.com>
2021-01-02fix(lib): mark changes as MODIFIED on 'MM' in `git_prompt_status` (#9552)Seamile
In the output of `git status -sb`, 'MM' indicates there are both added and modified changes. This change marks that case as MODIFIED instead of ADDED.
2020-12-10chore!: notify breaking change in `git_prompt_info`Marc Cornellà
BREAKING CHANGE: the git config option to skip running `git_prompt_info` has changed from `oh-my-zsh.hide-status` to `oh-my-zsh.hide-info` (#9188).
2020-12-10feat(lib): show upstream branch in `git_prompt_info` (#9188)Bruno Borges
Show the remote branch the local branch is tracking if `ZSH_THEME_GIT_SHOW_UPSTREAM` is set, like so: `ZSH_THEME_GIT_SHOW_UPSTREAM=1`. Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2020-10-10lib: fix regex bug in git_prompt_statusMarc Cornellà
Fixes #9326
2020-10-09Fix performance drop of iterating over lines and other stuffMarc Cornellà
- Fix 'STASHED' key and unsupported syntax in 5.0.2 - Optimise `if` statement to make it more idiomatic.
2020-10-09git_prompt_status now uses hash lookups instead of multiple grepsBilly Conn
2020-10-09lib: hide git_prompt_status when hide-status is setMichał Dębski
Closes #4912 Closes #5137 Closes #8071
2020-07-06lib: safety fix and speed-ups for git.zsh prompt functions (#7804)Robert Estelle
2020-06-30Handle unset variables in various parts of the codebase (#8944)Patrick Moore
DISABLE_UNTRACKED_FILES_DIRTY, DISABLE_AUTO_TITLE, GIT_STATUS_IGNORE_SUBMODULES are not set Handle these variables not being set with conditional access. If the user has set -u option to report attempts to use undeclared / unassigned variable, accessing the variables needs to be conditional.
2020-02-10lib: add git function to determine repository name (#4989)Evan Chiu
Closes #4989 Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2019-11-06Fix badly resolved rebase conflictMarc Cornellà
2019-11-06Clean up ignore submodules logic in parse_git_dirtyMarc Cornellà
2019-11-06Add an option about git submodules to ignoreWang Guan
$GIT_STATUS_IGNORE_SUBMODULES can be used to specify handling of submodules. It can be: not set : ignore dirty submodules (this was default zsh behavior) "git" : do not use "--ignore-submodules" and let git choose, this obeys setting in .gitmodules other : comes into "--ignore-submodules=$GIT_STATUS_IGNORE_SUBMODULES"
2019-04-09lib: stop detecting git versions prior to 1.7.2Marc Cornellà
The 1.7.2 release was published in July 2010 [1]. It's about time to stop supporting older versions. Fixes #4583 [1] https://github.com/git/git/releases/tag/v1.7.2
2018-09-08lib: small change to git_compare_versionMarc Cornellà
Fixes #7118
2018-04-15Fix git_commits_{ahead,before} when no upstream branch is defined (#6658)Jacopo De Simoi
If @{u} is not defined, git rev-list will give an error; redirect to stderr the error and deal with this case in what follows.
2018-01-22Add match for `MM` (result of `git commit -p` on a single changed file) to ↵Kimberly Zick
git_prompt_status (#3632)
2017-11-14With zsh 5.4 a simple "local FLAGS" meant as an array must be explicitly ↵catull
declared so. This fix avoids the dreaded "parse_git_dirty:3: FLAGS: attempt to assign array value to non-array". (#6414)
2016-09-08Fix git_prompt_status() not showing ahead/behind/diverged status correctly ↵Yuichi Tanikawa
(#5388)
2016-09-05git: output nothing when no commits ahead or behindMarc Cornellà
This fixes old git_commits_ahead behavior and changes git_commits_behind to have the same behavior. Fixes #5355
2016-08-01Updated git_commits_ahead function (#5247)Steven
* Function wasn't returning correct value * Updated underlying git command * Kept echo command from previous function for backwards compatibility * Kept function consistent with git_commits_behind
2016-07-15lib/git.zsh: Added git_commits_behind function (#4450)Steven
* Added git_commits_behind function * Added 'command' to git_commits_behind function * git_commits_behind code review changes
2016-03-31Add git user profile functions for prompt displayAesop Wolf
2016-01-13Re-added $ZSH_THEME_GIT_PROMPT_EQUAL_REMOTEMichele Bologna
Re-added $ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE variable which was removed in 9f55213
2015-12-17Put `local var` declaration in its own line in lib/git.zshMarc Cornellà
In places, the local statement will override the exit code and the written command won't have the effect intended when it was written. For example, when it's not inside a git repo the exit code won't be true, but the local statement will make it true regardless. See #4708.
2015-12-14Move current_branch() from git plugin to core lib/git.zshAndrew Janke
Fixes #4085: core -> plugin dependency issue. Rename it to git_current_branch for clarity that it's git-specific. Update all plugins that were calling it to use new name. Fix variable leaks by making more variables in lib/git.zsh local. Have lib/git.zsh use [[ ]] instead of [ ] everywhere.
2015-09-23fix indentationMichele Bologna
2015-09-23Uniform git prompt equal remoteMichele Bologna
Uniform git prompt equal remote to all others prompts, setting the correct symbol (if applicable) to $git_remote_status, instead of echoing it. It also solves the problem pointed out in #3911
2015-06-15In addition to the already existing variables ZSH_THEME_GIT_PROMPT for behind,Michele Bologna
ahead and diverged remote, I added ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE.
2015-06-10Add git_prompt_behind and git_prompt_existsAdam Lindberg
This adds two new theme functions for git: * `git_prompt_behind` works in a identical fashion to `git_prompt_ahead` and will output a format variable (`ZSH_THEME_GIT_PROMPT_BEHIND`) if the branch is behind. * `git_prompt_remote` will output one format variable if the branch exists on remote (`ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS`), and another if the branch is unpublished (`ZSH_THEME_GIT_PROMPT_REMOTE_MISSING`). The old `git_prompt_ahead` has been changed. Using git log is subject to formatting in .gitconfig, which can be overridden and will break this function. Relying on rev-list is much more stable.
2015-06-10Added a possibility to display the remote branch and the number of commits ↵leif.hanack
you are ahead or behind
2014-12-14Merge pull request #3326 from DanielFGray/masterRobby Russell
ignore any grep aliases that might be defined