diffcore: add a pickaxe option to find a specific blob
Sometimes users are given a hash of an object and they want to identify it further (ex.: Use verify-pack to find the largest blobs, but what are these? or [1]) One might be tempted to extend git-describe to also work with blobs, such that `git describe <blob-id>` gives a description as '<commit-ish>:<path>'. This was implemented at [2]; as seen by the sheer number of responses (>110), it turns out this is tricky to get right. The hard part to get right is picking the correct 'commit-ish' as that could be the commit that (re-)introduced the blob or the blob that removed the blob; the blob could exist in different branches. Junio hinted at a different approach of solving this problem, which this patch implements. Teach the diff machinery another flag for restricting the information to what is shown. For example: $ ./git log --oneline --find-object=v2.0.0:Makefileb2feb64309
Revert the whole "ask curl-config" topic for now47fbfded53
i18n: only extract comments marked with "TRANSLATORS:" we observe that the Makefile as shipped with 2.0 was appeared in v1.9.2-471-g47fbfded53 and in v2.0.0-rc1-5-gb2feb6430b. The reason why these commits both occur prior to v2.0.0 are evil merges that are not found using this new mechanism. [1] https://stackoverflow.com/questions/223678/which-commit-has-this-blob [2] https://public-inbox.org/git/20171028004419.10139-1-sbeller@google.com/ Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
cf63051ada
commit
15af58c1ad
@ -492,6 +492,15 @@ occurrences of that string did not change).
|
||||
See the 'pickaxe' entry in linkgit:gitdiffcore[7] for more
|
||||
information.
|
||||
|
||||
--find-object=<object-id>::
|
||||
Look for differences that change the number of occurrences of
|
||||
the specified object. Similar to `-S`, just the argument is different
|
||||
in that it doesn't search for a specific string but for a specific
|
||||
object id.
|
||||
+
|
||||
The object can be a blob or a submodule commit. It implies the `-t` option in
|
||||
`git-log` to also find trees.
|
||||
|
||||
--pickaxe-all::
|
||||
When `-S` or `-G` finds a change, show all the changes in that
|
||||
changeset, not just the files that contain the change
|
||||
@ -500,6 +509,7 @@ information.
|
||||
--pickaxe-regex::
|
||||
Treat the <string> given to `-S` as an extended POSIX regular
|
||||
expression to match.
|
||||
|
||||
endif::git-format-patch[]
|
||||
|
||||
-O<orderfile>::
|
||||
|
Reference in New Issue
Block a user