I am new to patch tool. I have some issue in patch tool. Please let me know whether this is a bug or I am doing the wrong steps. Let me explain the steps what I do.
1. I have a diff file (full_diff.txt) with 5 hunks of code to be patched to a file sample.txt
2. I have copied the first hunk of code to another file named first_hunk_diff.txt 3. I have copied the second hunk of code to one more file named second_hunk_diff.txt 4. I ran patch -N -b -s < first_hunk_diff.txt
The patch applied. 5. Now I am trying to apply the full_diff.txt file to sample.txt file using patch command. patch -N -b -s < full_diff.txt It is failing with the below message. Reversed (or previously applied) patch detected! Skipping patch.
5 out of 5 hunks ignored -- saving rejects to file sample.txt.rej
6. I have reversed the changes applied to sample.txt to be clean. 7. Now I ran patch -N -b -s < second_hunk_diff.txt The patch applied.
8. Now I am again applying the full_diff.txt to sample.txt using patch command. patch -N -b -s < full_diff.txt It has failed with the below error. File to patch: sample.txt 1 out of 5 hunks FAILED -- saving rejects to file sample.rej
So What I guess is that when the first hunk of code is applied already it is totally skipping the patch. But when the second hunk of code is applied already it is not skipping the entire diff changes to be applied. I guess there is some issue with the patch tool.
Please let me know if this is kind of a bug. Let me know if my explanation makes you clear.