doc: clarify confusing git range-diff add/delete output #34656

pull l0rinc wants to merge 1 commits into bitcoin:master from l0rinc:l0rinc/range-diff-doc changing 1 files +12 −1
  1. l0rinc commented at 12:48 pm on February 23, 2026: contributor

    Problem

    Range diffs in git are useful after PR rebases, but it has an easy-to-misread failure mode: if it cannot match a commit between the old and new ranges, it will show the old commit as removed (<) and the new commit as added (>), without showing any patch contents for that commit. It can look like there were no code changes when in reality the commit was just treated as unrelated and needs full re-review.

    Example

    0git fetch upstream ff338fdb53a66ab40a36e1277e7371941fc89840 dd76338a57b9b1169ac27f7b783d6d0d4c6e38ab
    1git range-diff ff338fdb53a6...dd76338a57b9
    

    This produced output like:

    01:  0ca4295f2e = 93:  139aa4b27e bench: add on-disk `HaveInputs` benchmark
    12:  4b32181dbb <  -:  ---------- test: add `HaveInputs` call-path unit tests
    2-:  ---------- > 94:  277c57f0c5 test: add `HaveInputs` call-path unit tests
    33:  8c57687f86 ! 95:  c0c94ec986 dbwrapper: have `Read` and `Exists` reuse `ReadRaw`
    4@@ Metadata
    5## Commit message ##
    6   dbwrapper: have `Read` and `Exists` reuse `ReadRaw`
    7
    8-    `ExistsImpl` was removed since it duplicates `CDBWrapper::ReadImpl` (except that it copies the resulting string on success, but that will be needed for caching anyway).
    9+    `ExistsImpl` was removed since it duplicates `CDBWrapper::ReadImpl`.
    

    Even though the subject matches, there is no diff shown because the commits did not match - the reviewer could think that only the commit message was changed. This should be treated as unmatched rather than unchanged. If you expected a match, you can try increasing the search effort:

    0git range-diff --creation-factor=95 ff338fdb53a6...dd76338a57b9
    

    which would show for example:

     01:  0ca4295f2e = 93:  139aa4b27e bench: add on-disk `HaveInputs` benchmark
     12:  4b32181dbb ! 94:  277c57f0c5 test: add `HaveInputs` call-path unit tests
     2@@ Commit message
     3 
     4     The tests document that `HaveInputs()` consults the cache first and that a cache miss pulls from the backing view via `GetCoin()`.
     5 
     6+    Co-authored-by: Novo <eunovo9@gmail.com>
     7+
     8  ## src/test/coins_tests.cpp ##
     9 @@ src/test/coins_tests.cpp: BOOST_FIXTURE_TEST_CASE(ccoins_flush_behavior, FlushTest)
    10      }
    11  }
    12  
    13-+BOOST_AUTO_TEST_CASE(ccoins_haveinputs_cache_miss_uses_base_getcoin)
    14++BOOST_AUTO_TEST_CASE(ccoins_cache_behavior)
    

    Fix

    This PR updates doc/productivity.md to raise awareness and document this pitfall and mentions --creation-factor as a knob to try when the output seems unexpectedly empty.

  2. doc: clarify `git range-diff` add/delete output
    When `git range-diff` cannot match a commit between two versions of a branch, it shows the old commit as removed (`<`) and the new commit as added (`>`), and it does not show the patch contents.
    This output is easy to misread as "no code changes" because the diff for that commit is effectively empty.
    It really means the commits were considered unrelated and the new commit should be reviewed from scratch.
    This is analogous to rename detection in `git diff`: if similarity is too low, a rename shows up as delete+add.
    
    Example (exact SHAs from PR #34320):
        B=ff338fdb53a66ab40a36e1277e7371941fc89840; A=dd76338a57b9b1169ac27f7b783d6d0d4c6e38ab; git fetch upstream $B $A
        git range-diff 0ca4295f2e5f4443a1f8b3bae7cba0f6c054276f..$B 139aa4b27e4839291c83a04dcd1649c5595814ca..$A
    
    This produced output like:
        1:  4b32181dbb < -:  ---------- test: add `HaveInputs` call-path unit tests
        -:  ---------- > 1:  277c57f0c5 test: add `HaveInputs` call-path unit tests
    
    Even though the subject matches, the first commit had no matching diff shown.
    That should be treated as "unmatched" rather than "unchanged".
    
    If you expected a match, try increasing the creation factor so `git range-diff` searches harder:
        git range-diff --creation-factor=95 <old_range> <new_range>
    45133c589a
  3. DrahtBot added the label Docs on Feb 23, 2026
  4. DrahtBot commented at 12:49 pm on February 23, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, Sjors, rkrux, sedited

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  5. maflcko commented at 1:07 pm on February 23, 2026: member

    tested via git range-diff bitcoin-core/master --creation-factor=90 ff338fdb53a66ab40a36e1277e7371941fc89840 dd76338a57b9b1169ac27f7b783d6d0d4c6e38ab

    review ACK 45133c589a970390bc10e4db4f7d9921dbaa0832 🏦

    Signature:

    0untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
    1RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
    2trusted comment: review ACK 45133c589a970390bc10e4db4f7d9921dbaa0832 🏦
    3x7a1iYzcdWnljv0odnNtnFDZkPKh6XhY7h/esTLlBAPhR+pa4+ydd6Uz15PSYzgdzL5Iup8+fZtfSEb0wq/UBg==
    
  6. DrahtBot added the label CI failed on Feb 23, 2026
  7. Sjors commented at 3:31 pm on February 23, 2026: member

    ACK 45133c589a970390bc10e4db4f7d9921dbaa0832

    I was aware of the caveat, but didn’t know about --creation-factor. Just tried it out on a range-diff I did this morning for #34256 and it helped there.

    0PREV=a843fde N=5 && git range-diff `git merge-base --all HEAD $PREV`...$PREV HEAD~$N...HEAD --creation-factor=95
    
  8. l0rinc closed this on Feb 23, 2026

  9. l0rinc reopened this on Feb 23, 2026

  10. DrahtBot removed the label CI failed on Feb 23, 2026
  11. rkrux approved
  12. rkrux commented at 11:05 am on February 25, 2026: contributor

    crACK 45133c5

    Thanks, didn’t know about creation factor. I have faced such as issue in the past where the range-diff didn’t categorise correctly. Makes sense to highlight this gotcha here.

  13. sedited approved
  14. sedited commented at 3:47 pm on February 26, 2026: contributor
    ACK 45133c589a970390bc10e4db4f7d9921dbaa0832
  15. fanquake merged this on Feb 27, 2026
  16. fanquake closed this on Feb 27, 2026

  17. l0rinc deleted the branch on Feb 27, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-03-04 03:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me