diff options
author | Gregory Herrero <gregory.herrero@oracle.com> | 2019-11-07 14:10:00 +0100 |
---|---|---|
committer | Gregory Herrero <gregory.herrero@oracle.com> | 2019-11-28 14:17:50 +0100 |
commit | ece5bb5e7d6e35e50096bac3d7bf17342daaec77 (patch) | |
tree | 27f42b0b9f8fd8ac067bbfb2b780f4e72d3bae9a /tests/patch/patch_common.h | |
parent | 048e94adbba3c21b9ad739640cce11a8b387df48 (diff) | |
download | libgit2-ece5bb5e7d6e35e50096bac3d7bf17342daaec77.tar.gz |
diff: make patchid computation work with all types of commits.
Current implementation of patchid is not computing a correct patchid
when given a patch where, for example, a new file is added or removed.
Some more corner cases need to be handled to have same behavior as git
patch-id command.
Add some more tests to cover those corner cases.
Signed-off-by: Gregory Herrero <gregory.herrero@oracle.com>
Diffstat (limited to 'tests/patch/patch_common.h')
-rw-r--r-- | tests/patch/patch_common.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/patch/patch_common.h b/tests/patch/patch_common.h index 1c6ad7ea8..660168551 100644 --- a/tests/patch/patch_common.h +++ b/tests/patch/patch_common.h @@ -385,6 +385,38 @@ "@@ -9,0 +10 @@ below it!\n" \ "+insert at end\n" +#define PATCH_DELETED_FILE_2_HUNKS \ + "diff --git a/a b/a\n" \ + "index 7f129fd..af431f2 100644\n" \ + "--- a/a\n" \ + "+++ b/a\n" \ + "@@ -1 +1 @@\n" \ + "-a contents 2\n" \ + "+a contents\n" \ + "diff --git a/c/d b/c/d\n" \ + "deleted file mode 100644\n" \ + "index 297efb8..0000000\n" \ + "--- a/c/d\n" \ + "+++ /dev/null\n" \ + "@@ -1 +0,0 @@\n" \ + "-c/d contents\n" + +#define PATCH_DELETED_FILE_2_HUNKS_SHUFFLED \ + "diff --git a/c/d b/c/d\n" \ + "deleted file mode 100644\n" \ + "index 297efb8..0000000\n" \ + "--- a/c/d\n" \ + "+++ /dev/null\n" \ + "@@ -1 +0,0 @@\n" \ + "-c/d contents\n" \ + "diff --git a/a b/a\n" \ + "index 7f129fd..af431f2 100644\n" \ + "--- a/a\n" \ + "+++ b/a\n" \ + "@@ -1 +1 @@\n" \ + "-a contents 2\n" \ + "+a contents\n" + #define PATCH_SIMPLE_COMMIT \ "commit 15e119375018fba121cf58e02a9f17fe22df0df8\n" \ "Author: Edward Thomson <ethomson@edwardthomson.com>\n" \ |