Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 2/2] completion: split __git_ps1 into a separate script

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:53

Felipe Contreras [off-list ref] writes:
And how do you propose to update the install documentation?

#    1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
#    2) Add the following line to your .bashrc/.zshrc:
#        source ~/.git-completion.sh
#
#    3) Consider changing your PS1 to also show the current branch:

1) Copy the file (e.g. ~/.git-completion.sh)
2) Copy the other file (.e.g ~/.git-prompt.sh)
3) Edit the original file (~/.git-completion.sh), modify the 'source'
command to use the other file (~/.git-prompt.sh)

And if the user doesn't care about prompt this certainly looks like overkill.
Agreed--the above would not fly.
What do we gain by this incredible user annoyance? Less maintenance
burden of __gitdir() which barely changes anyway?
If it lived in two separate projects, the pros-and-cons might be differnt
because there will be cost for coordinating changes between the projects,
but I do not think "barely changes" is a good rationale to keep duplicates
in this case, as we know both files come from the same project, and there
is no release engineering cost to coordiate changes.  The only price we
pay by not removing the duplicates at the source level is the risk of two
drifting apart without anybody noticing, and that particular risk becomes
the more likely the less often the function changes.  In other words,
"barely changes" is an argument _for_ removing duplicates.

Splitting the definition of whatever is duplicated out to a separate file,
having contrib/completion/Makefile insert it at an appropriate place in
both scripts at the build time, and driving that machinery from the
Makefile at the top-level would be one possible way forward.  For people
who download and install from the source, the "install insn" could also be
added to the generated file to avoid confusion (and for people who just
get the script(s) from their distro, the packagers would do that for
them).

You may think of a better solution to remove duplicates, of course, so I
am not married to the "have Makefile do it" approach and am open to
suggestions.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help