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>
Junio C Hamano committed
Jun 10, 2012 at 00:26 UTC
ac3eb1c38420b356b775ed63f7291eb4054d11d9
2 files changed
+4
contrib/completion/git-completion.bash
+2
@@ -36,6 +36,8 @@ esac
36
# returns location of .git repo
37
__gitdir ()
38
{
39
+ # Note: this function is duplicated in git-prompt.sh
40
+ # When updating it, make sure you update the other one to match.
41
if [ -z "${1-}" ]; then
42
if [ -n "${__git_dir-}" ]; then
43
echo "$__git_dir"
contrib/completion/git-prompt.sh
+2
@@ -53,6 +53,8 @@
53
# returns location of .git repo
54
__gitdir ()
55
{
56
+ # Note: this function is duplicated in git-completion.bash
57
+ # When updating it, make sure you update the other one to match.
58
if [ -z "${1-}" ]; then
59
if [ -n "${__git_dir-}" ]; then
60
echo "$__git_dir"