aboutsummaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-06-10 00:26:35 -0700
committerJunio C Hamano <gitster@pobox.com>2012-06-10 00:34:38 -0700
commitac3eb1c38420b356b775ed63f7291eb4054d11d9 (patch)
tree47096d0b337de0206d507816cd51b414daf5e371 /contrib/completion
parentaf31a456b4cd38f2630ed8e556e23954f806a3cc (diff)
downloadgit-ac3eb1c38420b356b775ed63f7291eb4054d11d9.tar.gz
git-ac3eb1c38420b356b775ed63f7291eb4054d11d9.tar.xz
completion: warn people about duplicated function
The __gitdir function is duplicated between completion and prompt scripts, and these definitions should not diverge; otherwise one of them can be subtly broken depending on the order the user's shell dot-sources them. Leave a note to people who may want to touch one copy to make sure they update the other one in sync. Hopefully this line would also appear in the context of the patch to allow reviewers to notice a patch that attempts to update only one of them. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion')
-rw-r--r--contrib/completion/git-completion.bash2
-rw-r--r--contrib/completion/git-prompt.sh2
2 files changed, 4 insertions, 0 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index abf8215dd..efcd875f9 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -36,6 +36,8 @@ esac
# returns location of .git repo
__gitdir ()
{
+ # Note: this function is duplicated in git-prompt.sh
+ # When updating it, make sure you update the other one to match.
if [ -z "${1-}" ]; then
if [ -n "${__git_dir-}" ]; then
echo "$__git_dir"
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 8e2e9f30c..29b1ec9eb 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -53,6 +53,8 @@
# returns location of .git repo
__gitdir ()
{
+ # Note: this function is duplicated in git-completion.bash
+ # When updating it, make sure you update the other one to match.
if [ -z "${1-}" ]; then
if [ -n "${__git_dir-}" ]; then
echo "$__git_dir"