Re: How to turn off rename detection for cherry-pick?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The reason I ask this is that we've run into a (probably practically
rare) case where cherry-pick changes a wrong file. We want to be able
to detect such cases.

Distilled from the actual repo, here is the case. Create a repo first:

    mkdir cherry-pick-carefully
    cd cherry-pick-carefully
    git init -b main .
    cat << EOF > x.txt
    1
    2
    3
    4
    5
    EOF
    git add x.txt
    git commit -m "Add x.txt"
    git checkout -b feature
    git rm x.txt
    git add x.txt
    git commit -m "Delete x.txt"
    cat << EOF > y.txt
    1
    2
    3
    4
    EOF
    git add y.txt
    git commit -m "Add y.txt, similar but not equal"
    cat << EOF > y.txt
    1
    2
    4
    EOF
    git add y.txt
    git commit -m "Slightly change y.txt"
    git checkout main

Now try to cherry-pick feature's head commit onto main:

    cd cherry-pick-carefully
    git cherry-pick feature

With a default git configuration, this should (surprisingly to many)
change x.txt instead of y.txt, which is not what the user would
expect.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux