How can I find out what compromises diff consists of?

If I received a patch file generated with something like git diff rev^ revor even git show -p rev, how can I find out which commits will differ?

I'm not sure if this precedent applies even in git, but by noting the file path and / or version numbers in the patch header included in cvs / svn, give me the warm fuzziness that the patch I received, or created, differs from the correct source or version.

In particular, if we look at the git diff header:

diff --git a/lib/blueprint/semantic_class_names.rb b/lib/blueprint/semantic_class_names.rb
index 41bd496..c17af1d 100644
--- a/lib/blueprint/semantic_class_names.rb
+++ b/lib/blueprint/semantic_class_names.rb

I cannot find any differentiating information about commits involved in this difference. There is an index line that I can only assume is not a shortened hash hat, but rather a hash of the scattered parts of the files. This, of course, does not match the associated commit signatures.

If I parse a couple of files and decide to go to the old school with a patch fixed by email, can I quickly verify that I changed the correct files / patches before posting the corrections that I made with a quick look at the heading? I understand that the changes are not so significant in git, because they are in cvs / svn due to their distributed nature, but I am the only one who would not mind seeing at least an abbreviated signature of the commit file in the header

+3
3

, diff, blob.

, , blob, , : Git: blob?

+3

git show <rev>, ( git show -p <rev>), , , , .

$ git show rel
commit 82bf5b5df1e0308939a6e91cf4c7d2dae8088d99
Author: Brian Campbell 
Date:   Thu Mar 5 14:00:54 2009 -0500

    Update another file

diff --git a/another b/another
index 2102854..4083e0c 100644
--- a/another
+++ b/another
@@ -1 +1,3 @@
 Yet another
+
+More lines
\ No newline at end of file

, . git format-patch, , , , , , git send-email git imap-send.

htanata, , diff , blob; , , , . , , .

+1

, blob .

eg. c blob_pathset the path in the tree affected by the patch and blob_sha1is the abbreviated sha1 from the patch (that is, that immediately follows the "index" after the diff line in the patch), this short script will find which fixed this version of the file.

for h in $(git log --pretty=format:%H "$blob_path")
do
    test "$(git rev-parse "$h:$blob_path")" = "$(git rev-parse "$blob_sha1")" &&
        echo $h
done

Of course, you may need the last commit that still has this version of the file, in which case you want the parent command element to appear immediately before it in git log --pretty=format:%H "$blob_path".

0
source

Source: https://habr.com/ru/post/1705899/


All Articles