问题
In command line Git, the show
, diff
and log
commands have got an option to --find-copies-harder
.
Is there a way I can tell (or patch) gitk
to use this, too? I need this from time to time, and my projects are small enough such that I don't care about the reduced performance.
(I don't want to craft the history to force copy detection any more.)
I noticed that the --find-copies-harder
appears within the gitk code, but I don't understand why.
So I have tried the command line gitk --all --find-copies-harder
, but it didn't work: In a commit with a new file copied from another versioned file, gitk still did not display the fact that this file was copied.
Update: Editing the view by entering --find-copies-harder
into the field Additional arguments to git log:
also has no effect: A copied (and slightly modified) file is still not shown as copied, while in the command line git show --find-copies-harder
it is.
回答1:
That does not seem supported without patching somehow the gitk source code itself.
For example, there was in the Git mailing list a similar request in Feb. 2020
As of commit c1a63459ed73 ("
gitk
: Preserve window dimensions on exit when not using ttk themes", 2019-12-15, Git v2.29.0-rc0),gitk
seems to lack two features that I consider "killer" ones, for reviewing patches (including my own patches, of course):
- support for the "
--function-context
" ("-W
") option,- support for the "
-O<orderfile>
" (aka "diff.orderFile
") setting.These flags are in fact mentioned in the
gitk
source code, going back to historical commit ee66e089c1d4 ("gitk
: Make updates go faster", 2008-05-09, Git v1.5.6-rc0).The options are stashed in
vdflags($n)
, and then summarily ignored.
A comment says, "These request or affect diff output, which we don't want", and I don't understand why; I would very much like them, please :)Could someone please write
gitk
patches for honoring "diff.orderFile
" and "--function-context
"?
来源:https://stackoverflow.com/questions/63939606/how-to-add-better-copy-detection-to-gitk