Closed nirmalnirav closed 2 months ago
An option is to build your own using execute
. I'm also using merge-base in a similar way:
:execute 'Git diff ' . system('git merge-base --fork-point upstream/main')[0:-2]
The commit hash coming from merge-base has a trailing newline, which the [0:-2]
removes.
Hello @cjrh ,
it works! Thanks for the hint. :+1:
I could not find the meaning of a single dot .
between diff '
and system
in the vim help. Could you please explain/ hint me to the meaning of the dot?
Thanks!
It's just concatenation, no big mystery 😄
On Thu, 1 Aug 2024, 4:31 pm nirmalnirav, @.***> wrote:
Hello @cjrh https://github.com/cjrh , it works! Thanks for the hint. 👍 I could not find the meaning of a single dot . between diff ' and system in the vim help. Could you please explain/ hint me to the meaning of the dot? Thanks!
— Reply to this email directly, view it on GitHub https://github.com/tpope/vim-fugitive/issues/2319#issuecomment-2263227621, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADVJC234AZWLWIY2LMSLCDZPJBE5AVCNFSM6AAAAABKMXDTI2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRTGIZDONRSGE . You are receiving this because you were mentioned.Message ID: @.***>
Fugitive does provide an API for that system()
call that's a bit more robust:
:execute 'Git diff ' . FugitiveExecute(['merge-base', '--fork-point', 'upstream/main']).stdout[0]
Wonderful! Thanks for the comment! I would like to close this ticket as solved.
@nirmalnirav You can close it yourself 😄
Respected Mr. Pope, please accept my gratitude and then greetings. I am humbled that I have a chance to write you.
Problem Statement
:G diff --stat $(G merge-base --fork-point main_branch)
Error
Explanation
git merge-base --fork-point main_branch
.G diff --stat $(G some_command)
.gf
from the file list.Extension
If possible, please break the feature request in to smaller tasks along with a short pointer to the code section and assign them to me. I would gladly work on them and hence collaborate with you. I have never done any serious vim scripting and therefore would be a good learning experience.
Thank you for your time!