Title: Support `git patch-id` to compare the changes in different diffs · Issue #4270 · libgit2/libgit2 · GitHub
Open Graph Title: Support `git patch-id` to compare the changes in different diffs · Issue #4270 · libgit2/libgit2
X Title: Support `git patch-id` to compare the changes in different diffs · Issue #4270 · libgit2/libgit2
Description: (Context: I asked about whether this feature exists in the libgit2 slack channel, and @ethomson mentioned I should create an issue for it here.) I'm looking for a way to compare two diffs to see if they modify precisely the same lines. W...
Open Graph Description: (Context: I asked about whether this feature exists in the libgit2 slack channel, and @ethomson mentioned I should create an issue for it here.) I'm looking for a way to compare two diffs to see if...
X Description: (Context: I asked about whether this feature exists in the libgit2 slack channel, and @ethomson mentioned I should create an issue for it here.) I'm looking for a way to compare two diffs to se...
Opengraph URL: https://github.com/libgit2/libgit2/issues/4270
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support `git patch-id` to compare the changes in different diffs","articleBody":"(Context: I asked about whether this feature exists in the libgit2 slack channel, and @ethomson mentioned I should create an issue for it here.)\r\n\r\nI'm looking for a way to compare two diffs to see if they modify precisely the same lines. When using git from the command line I would do this with `git patch-id`, but I don't think there is a way to determine something like a `patch-id` with libgit2.\r\n\r\n---\r\n\r\nExample of a scenario where `git patch-id` is useful on the command line:\r\n\r\n1. Start from `master` with an existing file called `foo.txt`.\r\n1. Create a branch `branchA` from master and make a commit `aaaaaaa` that modifies `foo.txt`.\r\n1. Create a branch `branchB` from master and make a commit `bbbbbbb` that modifies a different part of `foo.txt`.\r\n1. Cherry-pick commit `aaaaaaa` onto `branchB`.\r\n\r\n`git diff branchB^ branchB` and `git diff master branchA` print out the \"same\" diff (they make the same changes to the same lines), but the textual output of the commands is different, because the diff output includes the line `index something..somethingElse` at the top. (I'm not sure exactly what this line means, but I think it's related to the state of the file at the base of the diff.)\r\n\r\nTo accurately compare the two, you can pipe both diff outputs to `git patch-id` before comparing them, i.e. compare `git diff branchB^ branchB | git patch-id` and `git diff master branchA | git patch-id`. `git patch-id` effectively hashes only the changed lines in a diff, and strips out the other metadata, so it allows diffs to be compared based on whether they make the same changes to the same lines.","author":{"url":"https://github.com/not-an-aardvark","@type":"Person","name":"not-an-aardvark"},"datePublished":"2017-06-14T08:57:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/4270/libgit2/issues/4270"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:acc0eeb4-06a6-686a-1070-41af8fa2148c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D9DC:283692:1011EF2:1095835:6A5DDA1C |
| html-safe-nonce | 6f8a2192f7a82d39fdd395d47d6dce1ee4154d31f33e420125aaf74678a132eb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOURDOjI4MzY5MjoxMDExRUYyOjEwOTU4MzU6NkE1RERBMUMiLCJ2aXNpdG9yX2lkIjoiODI5NTUyMTIwNDE4ODMzODcxNiIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9 |
| visitor-hmac | 3467b76dfc8ec6a91a78aab2dc2811817d5cf980effcf492604b3d25a08d65c3 |
| hovercard-subject-tag | issue:235808798 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/libgit2/libgit2/4270/issue_layout |
| twitter:image | https://opengraph.githubassets.com/89647446c2c5666a35d6643e69fab41932c097d24cf17325c4b7de1f302e1a6a/libgit2/libgit2/issues/4270 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/89647446c2c5666a35d6643e69fab41932c097d24cf17325c4b7de1f302e1a6a/libgit2/libgit2/issues/4270 |
| og:image:alt | (Context: I asked about whether this feature exists in the libgit2 slack channel, and @ethomson mentioned I should create an issue for it here.) I'm looking for a way to compare two diffs to see if... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | not-an-aardvark |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/libgit2/libgit2 git https://github.com/libgit2/libgit2.git |
| octolytics-dimension-user_id | 394745 |
| octolytics-dimension-user_login | libgit2 |
| octolytics-dimension-repository_id | 901662 |
| octolytics-dimension-repository_nwo | libgit2/libgit2 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 901662 |
| octolytics-dimension-repository_network_root_nwo | libgit2/libgit2 |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width