summaryrefslogtreecommitdiff
path: root/t/t4126-apply-empty.sh
AgeCommit message (Collapse)AuthorFilesLines
2008-06-13t4126: fix test that happened to work due to timingLibravatar Junio C Hamano1-4/+0
The test did "reset --hard" (where the HEAD commit has an empty blob at path "empty") followed by "> empty", expecting that the index does not notice the file _changed_ since git wrote it out upon "reset" if the redirection is done quickly enough. There was no need to do the emptying, and it gave a wrong result if "reset --hard" happened on time T and then ">empty" happened on the next second T+1. This fixes it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-17builtin-apply: do not declare patch is creation when we do not know itLibravatar Junio C Hamano1-0/+61
When we see no context nor deleted line in the patch, we used to declare that the patch creates a new file. But some people create an empty file and then apply a patch to it. Similarly, a patch that delete everything is not a deletion patch either. This commit corrects these two issues. Together with the previous commit, it allows a diff between an empty file and a line-ful file to be treated as both creation patch and "add stuff to an existing empty file", depending on the context. A new test t4126 demonstrates the fix. Signed-off-by: Junio C Hamano <gitster@pobox.com>