1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-19 01:16:08 +02:00
git/contrib
D. Ben Knoble 3c20acdf46 completion: zsh: stop leaking local cache variable
Completing commands like "git rebase" in one repository will leak the
local __git_repo_path into the shell's environment so that completing
commands after changing to a different repository will give the old
repository's references (or none at all).

The bug report on the mailing list [1] suggests one simple way to observe
this yourself:

Enter the following commands from some directory:
  mkdir a b b/c
  for d (a b); git -C $d init && git -C $d commit --allow-empty -m init
  cd a
  git branch foo
  pushd ../b/c
  git branch bar

Now type these:
  git rebase <TAB>… # completion for bar available; C-c to abort
  declare -p __git_repo_path # outputs /path/to/b/.git
  popd
  git branch # outputs foo, main
  git rebase <TAB>… # completion candidates are bar, main!

Ideally, the last typed <TAB> should be yielding foo, main.

Commit beb6ee7163 (completion: extract repository discovery from
__gitdir(), 2017-02-03) anticipated this problem by marking
__git_repo_path as local in __git_main and __gitk_main for Bash
completion but did not give the same mark to _git for Zsh completion.
Thus make __git_repo_path local for Zsh completion, too.

[1]: https://lore.kernel.org/git/CALnO6CBv3+e2WL6n6Mh7ZZHCX2Ni8GpvM4a-bQYxNqjmgZdwdg@mail.gmail.com/

Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-04-30 15:24:56 -07:00
..
buildsystems Merge branch 'js/doc-unit-tests-with-cmake' 2023-12-09 16:37:47 -08:00
coccinelle use xstrncmpz() 2024-02-12 09:32:41 -08:00
completion completion: zsh: stop leaking local cache variable 2024-04-30 15:24:56 -07:00
contacts
credential osxkeychain: store new attributes 2024-04-01 15:38:20 -07:00
diff-highlight perl: bump the required Perl version to 5.8.1 from 5.8.0 2023-11-17 07:26:32 +09:00
emacs git{,-blame}.el: remove old bitrotting Emacs code 2018-04-16 17:25:49 +09:00
examples Merge branch 'bw/c-plus-plus' into ds/lazy-load-trees 2018-04-11 10:46:32 +09:00
fast-import import-tars: ignore the global PAX header 2020-03-24 14:39:47 -07:00
git-jump git-jump: admit to passing merge mode args to ls-files 2023-10-05 12:55:38 -07:00
git-shell-commands
hooks multimail: stop shipping a copy 2021-06-11 13:35:19 +09:00
long-running-filter
mw-to-git Merge branch 'tz/send-email-negatable-options' into maint-2.43 2024-02-08 16:22:01 -08:00
persistent-https
remote-helpers
stats
subtree contrib/subtree/t: avoid redundant use of cat 2024-03-16 11:08:55 -07:00
thunderbird-patch-inline
update-unicode unicode_width.h: rename to use dash in file name 2018-04-11 18:11:00 +09:00
vscode path: remove mksnpath() 2024-04-05 09:49:38 -07:00
workdir refs: introduce reftable backend 2024-02-07 08:28:37 -08:00
README doc: fix some typos, grammar and wording issues 2023-10-05 12:55:38 -07:00
coverage-diff.sh contrib/coverage-diff: avoid redundant pipelines 2024-03-16 11:08:57 -07:00
git-resurrect.sh contrib/git-resurrect.sh: use hash-agnostic OID pattern 2020-10-08 11:48:56 -07:00
remotes2config.sh
rerere-train.sh contrib/rerere-train: avoid useless gpg sign in training 2022-07-19 11:24:08 -07:00

Contributed Software

Although these pieces are available as part of the official git
source tree, they are in somewhat different status.  The
intention is to keep interesting tools around git here, maybe
even experimental ones, to give users an easier access to them,
and to give tools wider exposure, so that they can be improved
faster.

I am not expecting to touch these myself that much.  As far as
my day-to-day operation is concerned, these subdirectories are
owned by their respective primary authors.  I am willing to help
if users of these components and the contrib/ subtree "owners"
have technical/design issues to resolve, but the initiative to
fix and/or enhance things _must_ be on the side of the subtree
owners.  IOW, I won't be actively looking for bugs and rooms for
enhancements in them as the git maintainer -- I may only do so
just as one of the users when I want to scratch my own itch.  If
you have patches to things in contrib/ area, the patch should be
first sent to the primary author, and then the primary author
should ack and forward it to me (git pull request is nicer).
This is the same way as how I have been treating gitk, and to a
lesser degree various foreign SCM interfaces, so you know the
drill.

I expect things that start their life in the contrib/ area
to graduate out of contrib/ once they mature, either by becoming
projects on their own, or moving to the toplevel directory.  On
the other hand, I expect I'll be proposing removal of disused
and inactive ones from time to time.

If you have new things to add to this area, please first propose
it on the git mailing list, and after a list discussion proves
there is general interest (it does not have to be a
list-wide consensus for a tool targeted to a relatively narrow
audience -- for example I do not work with projects whose
upstream is svn, so I have no use for git-svn myself, but it is
of general interest for people who need to interoperate with SVN
repositories in a way git-svn works better than git-svnimport),
submit a patch to create a subdirectory of contrib/ and put your
stuff there.

-jc