Comparar commits
2610 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 7ba57df6f7 | |||
| 5c2f4d939a | |||
| 6c9c7b6d92 | |||
| 210dd61d2a | |||
| aa302cb935 | |||
| 994e856ccd | |||
| 808f7e6ed3 | |||
| 22f7bc8f26 | |||
| ab0b2cf12e | |||
| 599a2ad021 | |||
| db649798ef | |||
| 4f8f8c43a4 | |||
| 4491a9302b | |||
| ce138b56c0 | |||
| 8f8c0cbf45 | |||
| 7e04d85e1e | |||
| 136836e615 | |||
| 82882624ce | |||
| c03e849089 | |||
| 25f98e223f | |||
| c2290ab8b4 | |||
| 9c39587d6e | |||
| 972aa75f3e | |||
| 1d1e4b33d4 | |||
| 79a61d47b2 | |||
| 26c9e7cfa9 | |||
| 28f9f22614 | |||
| 69caf6c98f | |||
| 51f1bb896c | |||
| 0fd834004e | |||
| d2654cb70c | |||
| 268553cda9 | |||
| 64a61d86d4 | |||
| 216a9e11c0 | |||
| 04373d2d9d | |||
| 9a2e768882 | |||
| d13d0543b9 | |||
| 6178294537 | |||
| 4871a7a06d | |||
| fe23d82e23 | |||
| d6e94b1105 | |||
| f0a2b17914 | |||
| ab2252f80f | |||
| f1cf8711a8 | |||
| d7cfb757d6 | |||
| ea2113e753 | |||
| 05f4604005 | |||
| 71b2400dbc | |||
| 1de46330d7 | |||
| de4e24582d | |||
| dffb0b35e7 | |||
| d8ec4573ec | |||
| 09a6e9a42e | |||
| 57fe9c6903 | |||
| cf3e1a9b6d | |||
| 4629905b65 | |||
| d4e8de60ce | |||
| 3237636206 | |||
| 934fe1c6d0 | |||
| 9aff1476d4 | |||
| 084d310366 | |||
| d122d18a34 | |||
| 6fb3dea9cd | |||
| ceb2a3857d | |||
| ab80da4363 | |||
| 19545e1113 | |||
| 88603e2771 | |||
| 5f323cc67c | |||
| 39d15d6087 | |||
| eaba8ef016 | |||
| 6cc4cf87b9 | |||
| c6a914a6e1 | |||
| 32af574206 | |||
| 552ab150cb | |||
| 2698925d10 | |||
| 13b1632dfc | |||
| de204b0321 | |||
| def07344e9 | |||
| 4ef3f39a7b | |||
| 2bf26e8db5 | |||
| 24b3b664dc | |||
| 2352829b28 | |||
| 3ca34dad40 | |||
| 15dc6442d0 | |||
| d775038f8d | |||
| 3829970a09 | |||
| 633306e6bf | |||
| 7d58008ed3 | |||
| bc9e32a3cf | |||
| a98791ebd0 | |||
| a72e1813e9 | |||
| fe9ffbeb12 | |||
| e61992c1f6 | |||
| 612332cd9f | |||
| 40d81ca22c | |||
| faf02460f5 | |||
| f010e8a888 | |||
| 712e9c7203 | |||
| 128a030880 | |||
| 907c3245a9 | |||
| da7cbeddc7 | |||
| 8b55c4981d | |||
| b7a59748c4 | |||
| b49de61402 | |||
| c38edbfe0b | |||
| 557ada7c81 | |||
| 236ec6fc3b | |||
| 35890588ca | |||
| c6c0ecbb37 | |||
| 1fdbf4612c | |||
| 948fa3a91c | |||
| a624d52f42 | |||
| 2b50f2409e | |||
| 0b11ce64a2 | |||
| f70c6928cd | |||
| cbb6d58d1b | |||
| 4dc2e48e8c | |||
| 7385bd97c6 | |||
| 063078cd34 | |||
| 789b8a2987 | |||
| 53ea135799 | |||
| 32242687bd | |||
| 3aca556827 | |||
| 372a64bd5d | |||
| 3f83d42afc | |||
| 8bf877e400 | |||
| 29f45b787b | |||
| 68491a512d | |||
| bd72f245b1 | |||
| 4ef5082887 | |||
| 27822fb37c | |||
| be803bf122 | |||
| db29a1b6a2 | |||
| 25d4bb8d6c | |||
| 8cc47a2069 | |||
| c825e20f62 | |||
| 69eace6292 | |||
| 2284435551 | |||
| 1252b94fcb | |||
| 8d0afc087f | |||
| f789c7e2df | |||
| 80bbd035db | |||
| 0397df2f4d | |||
| cd8796b561 | |||
| 68103601e6 | |||
| c278ead451 | |||
| c44e9b6308 | |||
| 1c37537d19 | |||
| 684dec4b24 | |||
| 30f72c1519 | |||
| 69733a8f7a | |||
| b9261a33be | |||
| e1a78d1f0f | |||
| c7de0ba3bc | |||
| 16cce1efb1 | |||
| b3025a4dfc | |||
| 11a1a27dbd | |||
| e76fe439ba | |||
| cc8513afdf | |||
| c17f5bd41e | |||
| 2d9ef9aad6 | |||
| f7bb8aab9e | |||
| c5c1980c9a | |||
| f234b8fa27 | |||
| 778e3bbd67 | |||
| 5d8d5da602 | |||
| fe449e31e3 | |||
| 617f0ae79a | |||
| cf3de0e8dc | |||
| 173c47f780 | |||
| 77e12e3658 | |||
| 8db9551700 | |||
| ece0c76158 | |||
| 8881847c61 | |||
| 4254efd49e | |||
| 6968075d38 | |||
| 3cb29e1d5c | |||
| e632b091f9 | |||
| afa92e51f6 | |||
| d746c7566c | |||
| 0a075c6934 | |||
| cef3b7d634 | |||
| c31ba651cf | |||
| d4d3426b4e | |||
| 89e3d2efec | |||
| c2326d096b | |||
| 18146346f6 | |||
| 519c514092 | |||
| 4187615fa7 | |||
| d98ea0180c | |||
| 226a4bf391 | |||
| a689a5906e | |||
| 18370bb663 | |||
| 1465736974 | |||
| 3907344fef | |||
| 7c414d47cb | |||
| bc74be531d | |||
| 592b0886b2 | |||
| 1685d62cae | |||
| e705e3e045 | |||
| 0bb7d3ba09 | |||
| 8e92499ebb | |||
| 62e0274ff6 | |||
| fe4c4e9751 | |||
| baa03f5587 | |||
| 214d73d812 | |||
| 8c6fe7a540 | |||
| 164d5591a0 | |||
| 85cb7c88fa | |||
| 4ccbd03daf | |||
| 3df33a7367 | |||
| 13b592d1f3 | |||
| ab8df8dcde | |||
| 2b25d433c7 | |||
| 1ba8218743 | |||
| 17cf2bd1c8 | |||
| 1746bc8797 | |||
| 635f09b741 | |||
| ee0443e40c | |||
| d02e9172da | |||
| bc55ee6bd2 | |||
| 76be95bd6c | |||
| e43e8d156e | |||
| 2aca31988f | |||
| c937827582 | |||
| c52cf836cd | |||
| 0924ad586f | |||
| abdce2df04 | |||
| 3f8c120ad0 | |||
| 365e5e8413 | |||
| 90e53ad3e2 | |||
| 4a67bfcf15 | |||
| 2410ea0d5b | |||
| 17cecda23e | |||
| 9d733a2da9 | |||
| 6bbcc58542 | |||
| 1a76e3dc9d | |||
| ff70ae633d | |||
| d1f372e439 | |||
| 041f52aaaa | |||
| 270d17814e | |||
| 16095c8086 | |||
| 94e2dbbc2c | |||
| 12580bce83 | |||
| 753b11cf15 | |||
| 0fee962faa | |||
| ed1f51b987 | |||
| f1bdcaedc1 | |||
| 2efbe9ce4e | |||
| 3366c4d6a5 | |||
| acb69a4221 | |||
| b3b501ef07 | |||
| e34d8e4c42 | |||
| adebae6c47 | |||
| 4ae0d8af9f | |||
| 651bbaa3ce | |||
| 0448ba5ceb | |||
| 6d70bf9106 | |||
| 857629e07e | |||
| 18c5c788d7 | |||
| a8e7a9a091 | |||
| 59097ddf96 | |||
| 433beac9aa | |||
| c7f6e87132 | |||
| 64e2fee975 | |||
| df35cb0756 | |||
| 0e6a3c52ad | |||
| b786bcc774 | |||
| 6cb13e843c | |||
| 7e76721712 | |||
| 23df564189 | |||
| 0c17ed9c33 | |||
| cde9ae02fe | |||
| 77017c2cd3 | |||
| 7615d54337 | |||
| 6b591b121d | |||
| 268edf16d8 | |||
| 01f220fb1b | |||
| 53a92751e6 | |||
| b66431e3a6 | |||
| 5a9e45f9d8 | |||
| 8561bb34a8 | |||
| d55c09c9d3 | |||
| f4300b8cab | |||
| f3f9c2c921 | |||
| 33dca9315c | |||
| c596514d11 | |||
| 390b03647e | |||
| 5b00cf1701 | |||
| 95e69ad858 | |||
| ef0363e8ff | |||
| a62cd0f16a | |||
| f340828506 | |||
| 8b0a68dd4a | |||
| 1049a677bf | |||
| d2bc415042 | |||
| b439e6239d | |||
| b999c71ad6 | |||
| 9f31f9a76b | |||
| 7fe356b649 | |||
| b5aa0b900c | |||
| cd4622fbeb | |||
| 89192c2ee2 | |||
| b5b408d134 | |||
| b08f320ed5 | |||
| 4c7025ae81 | |||
| 554af1becb | |||
| 6d49e0fd57 | |||
| 31d872fbfe | |||
| b842a727ee | |||
| 0851b4d011 | |||
| 8a7c57994d | |||
| 6480e956af | |||
| 9c95a4751b | |||
| d283834978 | |||
| 66b490b5da | |||
| 0d252ab9fd | |||
| 3e8de2d22d | |||
| 52aee1d050 | |||
| ff9dc2c5af | |||
| 3b8cdb58e2 | |||
| bd14aeee17 | |||
| e434f7c0a9 | |||
| 837e3000d3 | |||
| e1c2aa0da1 | |||
| e7aac2ef6e | |||
| f9545acde6 | |||
| 45ce8e1d63 | |||
| bdbec54f24 | |||
| 1df48d1725 | |||
| 6c0f4c09d9 | |||
| f45ce3a7ee | |||
| dc6e624eda | |||
| e67676b01c | |||
| f37ae7e4e7 | |||
| f913f6a8d5 | |||
| 20991381bd | |||
| 6930fe0eff | |||
| f3b50eed3b | |||
| a4217909c0 | |||
| 5b7c4686f9 | |||
| 86c8343107 | |||
| 6b6ce03c72 | |||
| a7ee5985db | |||
| be354f78a6 | |||
| ab75f6f635 | |||
| d6513e9aa9 | |||
| afac77ddfd | |||
| fcd0b6839b | |||
| 32c2548442 | |||
| 1cf02c22a7 | |||
| 34e5594a2d | |||
| 46eac52dbf | |||
| 915a737797 | |||
| d227d8794d | |||
| ad888b3250 | |||
| 5350a67990 | |||
| c02be2330c | |||
| cf936a8a02 | |||
| 0b07d276b9 | |||
| 6879f0d0ac | |||
| d31d18360b | |||
| aeee3c9ade | |||
| dae28d2222 | |||
| f81f95e830 | |||
| 41611f826a | |||
| 4eac57c31c | |||
| 2a7f03761d | |||
| 264f7e1a74 | |||
| 94227889f1 | |||
| 34114a9620 | |||
| b562b3cf72 | |||
| 3938d143a1 | |||
| 95418566ef | |||
| 622b877663 | |||
| 503ff13eb3 | |||
| 2792f0d835 | |||
| 82cb2aa124 | |||
| ba08123abc | |||
| 93d6a80bc6 | |||
| fd78c2a709 | |||
| fb7080c39a | |||
| cc591e18b0 | |||
| 7e6979236e | |||
| e72c48607b | |||
| 3e91334c82 | |||
| 593e8c0e14 | |||
| f8bc5ce648 | |||
| 29f10e71ce | |||
| 84340782ff | |||
| 674946d180 | |||
| abf4a6501a | |||
| ee0d073cd2 | |||
| 2d583d6ea0 | |||
| e46af10631 | |||
| 0328c77be1 | |||
| 5c2aaf9849 | |||
| eab21e19f6 | |||
| 266548d75c | |||
| 4731c1f3f0 | |||
| d6cd51399d | |||
| 7eff25e180 | |||
| ab53e2ffda | |||
| e23357cf13 | |||
| d5808e1164 | |||
| f47fa21fe9 | |||
| 478c617e60 | |||
| 4449758135 | |||
| 7163d8dc71 | |||
| 128f7b851a | |||
| 90bc5f58f7 | |||
| c89328fa14 | |||
| af655b3674 | |||
| 5875c814df | |||
| fcaa952973 | |||
| 65c02328b3 | |||
| d629468cd1 | |||
| 0cdb477b3f | |||
| ed4f4a699b | |||
| fc7b8b4bf1 | |||
| 22b7ae2136 | |||
| 032d865c92 | |||
| c48c716eb0 | |||
| e98219d2c5 | |||
| 519e090a7a | |||
| 4e0f37281b | |||
| e6750de14d | |||
| 5380a342d5 | |||
| 44e73200ff | |||
| 48b4c62696 | |||
| b9accadb70 | |||
| e358c67da5 | |||
| 1764677b7d | |||
| 264ddbe183 | |||
| d8ba422178 | |||
| 95f43917a4 | |||
| e0f806f0fb | |||
| 01a7b5fbc6 | |||
| c86b8198d9 | |||
| 3771bda471 | |||
| 1178d844d0 | |||
| aa9577db67 | |||
| 7af474cbc6 | |||
| 7f6de430c0 | |||
| bc2d0ff0cc | |||
| 645aa65e9b | |||
| 2ae494999c | |||
| 2826d50cbb | |||
| 8c4bddac9f | |||
| 2a7d35cc39 | |||
| 8389698958 | |||
| 289b270c85 | |||
| 8661290c6a | |||
| 84a8f11fc9 | |||
| ad1b530d32 | |||
| 65e322824b | |||
| 3f5bee7e4c | |||
| bff57e53f0 | |||
| 8280b3a3ff | |||
| 7dd52995d0 | |||
| e8bf433c68 | |||
| 12b5c43d85 | |||
| b42cc6f683 | |||
| a1d6ae010e | |||
| cd1c88a1b5 | |||
| 5d245f403f | |||
| 91f18df917 | |||
| f3b3c291b9 | |||
| 6bcd6240ce | |||
| 5df5a679ac | |||
| 6dc2db25da | |||
| 7d33e1302a | |||
| 2edb5b5496 | |||
| 3ba7d68d4a | |||
| da58bd5609 | |||
| e8c0f46afb | |||
| 772a99012d | |||
| f408406ef0 | |||
| 1fa319a8f3 | |||
| a0aefe21c8 | |||
| d6be29dbdc | |||
| 52ffa2d8c0 | |||
| 5ca4e8006e | |||
| 75cfddebcd | |||
| 1bc4b4ef32 | |||
| ff7c639b64 | |||
| 77172800a8 | |||
| 6615e0f2db | |||
| 0f562330cf | |||
| 42a8a1ff61 | |||
| 29c0f0c115 | |||
| dc33168ecc | |||
| 1e26bb533a | |||
| 021fbc533f | |||
| bc6daaeac2 | |||
| d60c255703 | |||
| 2d9ba937fb | |||
| 9cdc6122b3 | |||
| 3374074940 | |||
| 4f65cb099a | |||
| 0e52a3bcee | |||
| ed3a4a33e2 | |||
| 3e0658fe30 | |||
| f35724daa9 | |||
| 58fd786fda | |||
| bf41c77d80 | |||
| d8de321074 | |||
| d77705a039 | |||
| 27d9da15dc | |||
| a192842dc0 | |||
| 400aa93bf3 | |||
| 86952ff85e | |||
| bab9bd7550 | |||
| 87e60bd0eb | |||
| 711d20ea14 | |||
| a0a0036727 | |||
| 15f6a33c4b | |||
| 10f92836e6 | |||
| 54558c863d | |||
| e25aece700 | |||
| bfdad19911 | |||
| d112089152 | |||
| 6c91d8bea6 | |||
| 7edebc6dd2 | |||
| 76649ba268 | |||
| 2ae95bdf2b | |||
| 1548ef10b0 | |||
| 835cd70ded | |||
| 5a8444579c | |||
| dc4012ea7c | |||
| 17007e6154 | |||
| 82013b1970 | |||
| 7cf4063d9e | |||
| d1cf839e53 | |||
| f47164a2e6 | |||
| bdb641ec94 | |||
| 341a327ea0 | |||
| 3d53a6ecf8 | |||
| eede4a386f | |||
| 437137783c | |||
| b96597b089 | |||
| eeb2782700 | |||
| 0f4ad0bbf5 | |||
| 750e4a1cca | |||
| e5b8aa57d7 | |||
| 0723514fea | |||
| c298e1b3ee | |||
| 91e5d171b7 | |||
| 28f47e8248 | |||
| f870dc7b72 | |||
| 04c5e9fa42 | |||
| 65b08e2914 | |||
| ed19b9e032 | |||
| e72b5a55a0 | |||
| 5281507483 | |||
| abf7303d6e | |||
| 775f29564a | |||
| 7e33a3e12f | |||
| 5538b2910d | |||
| c7c7988ae6 | |||
| 454106a22b | |||
| 43c1d7f8aa | |||
| 1156018c0d | |||
| e00e87a845 | |||
| 2b29212d0f | |||
| 7390d908bd | |||
| a98308a7a4 | |||
| 3b263eb961 | |||
| c6d5c143cf | |||
| 6d0f303cd5 | |||
| 327f16fa03 | |||
| a4ee1eb785 | |||
| fc52ee518e | |||
| b3e0ea6d33 | |||
| dc53f387a6 | |||
| 11dfe7b649 | |||
| 1ce861c000 | |||
| 0c8f200d45 | |||
| c63536c682 | |||
| 7516cebb40 | |||
| e82a7f57fe | |||
| bcc16fbefe | |||
| a57c5c7c93 | |||
| f7db59ea7c | |||
| 4f348dcd19 | |||
| a3d896f456 | |||
| 9ad65e6e46 | |||
| 790c9714c7 | |||
| 68074be9d6 | |||
| 4c2a40808b | |||
| 8dbac6a34f | |||
| 6bd8213093 | |||
| 0b0af2296f | |||
| 2c7d49f7a8 | |||
| dc89b0569a | |||
| ff5ea00b00 | |||
| 1894901930 | |||
| 135a285596 | |||
| 32e229b162 | |||
| 3102ac403b | |||
| 0f16b54d8e | |||
| 8fc1e34a74 | |||
| af2b775a4a | |||
| e9bf2fe161 | |||
| 3709a0b7e1 | |||
| c651cdc356 | |||
| db9d92041f | |||
| b474a818aa | |||
| cea521a737 | |||
| b89eb07c6e | |||
| 7f6e5e2e52 | |||
| 4fdaf6dead | |||
| dea0e08d93 | |||
| fca1c13d03 | |||
| 3029137cb8 | |||
| c7c9a2496a | |||
| f40a7105bc | |||
| 00313c747a | |||
| 2ffd187094 | |||
| 6f519b0456 | |||
| cb2bf796fa | |||
| bbde993e81 | |||
| 9088ecca16 | |||
| 9a99af2281 | |||
| 70bb40ce2f | |||
| 9fea9ea756 | |||
| dc46960e6c | |||
| 7a04b22375 | |||
| d5526515f1 | |||
| 8aeedb8971 | |||
| 9fe7bfb898 | |||
| 7313407d04 | |||
| 42d70f888e | |||
| 881efc8e8f | |||
| 71c86381df | |||
| efdb750334 | |||
| 5afd8d8bd3 | |||
| 6f21ea930a | |||
| af14f57962 | |||
| e9b8f71997 | |||
| 2f8c45aec4 | |||
| eaf5b8bc8e | |||
| efb2cfab9f | |||
| 320328777e | |||
| 21f965f284 | |||
| 5c36064afc | |||
| 01b583957e | |||
| 7ccf2390a7 | |||
| feab9862ac | |||
| f85f95e792 | |||
| d658e7c490 | |||
| 520e510aab | |||
| 769834e1a6 | |||
| 42d06d6281 | |||
| 0d6028976b | |||
| 69f7af7c63 | |||
| abbada47da | |||
| e7679d8320 | |||
| d3807fd908 | |||
| 5adf74794b | |||
| 73c2e94a32 | |||
| 66000a6769 | |||
| 09b15bab9b | |||
| 0ed88c474a | |||
| c40a312e73 | |||
| 3d1ca5abb1 | |||
| f63866b2a2 | |||
| 7dec3866cf | |||
| 06a5234d10 | |||
| a109a3317e | |||
| 9f4fc49790 | |||
| 6c8063b26a | |||
| 36ddbe99a1 | |||
| 47e5c0df16 | |||
| 86635c4543 | |||
| 855549d677 | |||
| d58ec4d3f6 | |||
| 879cc31261 | |||
| 56fea45505 | |||
| 5e7656489d | |||
| a816423037 | |||
| f3a500923c | |||
| 7f0947ef9b | |||
| f90530f593 | |||
| 3683f7e097 | |||
| 98310e8d7a | |||
| 8c9aad9e34 | |||
| 2b6a4365ac | |||
| 94c1ed4c28 | |||
| c1a1633593 | |||
| a6c37ff276 | |||
| 495b218c7f | |||
| d224f3c5bd | |||
| be309aba69 | |||
| 2b3d3d9cf5 | |||
| 681969439d | |||
| f9be1f3493 | |||
| a2efd40798 | |||
| 94e7011413 | |||
| 1aca554ae3 | |||
| eefc18202f | |||
| 70e414b279 | |||
| e629088ec3 | |||
| 9431a8c3ac | |||
| 9e7a9e6210 | |||
| c36fc467e6 | |||
| 0c7701dc57 | |||
| 2dbbce31d6 | |||
| d18ccc168f | |||
| cc5ae002a2 | |||
| 06886f98d4 | |||
| 5e072e94e8 | |||
| 9e4ef708e4 | |||
| da0af11bbb | |||
| 04b8ab1b87 | |||
| 7988e3ead9 | |||
| b51aea98b4 | |||
| 91cb03a43c | |||
| 9977f4efab | |||
| 7928f075b5 | |||
| 79bc23f83a | |||
| b201dbb698 | |||
| 11004c20e6 | |||
| 3a54d0b8a9 | |||
| 24d5fdd6eb | |||
| 75eb321272 | |||
| ef8f630ad5 | |||
| 5c51060dca | |||
| ec13dea5e6 | |||
| affd4a481f | |||
| eafad9a5c4 | |||
| 454656a91c | |||
| a5c3ca9e8e | |||
| 4db152b2d7 | |||
| 43a2096852 | |||
| f76ab1ebe6 | |||
| 04392c562e | |||
| a4470f9b6d | |||
| db85792c59 | |||
| 92f071de93 | |||
| ee046f1c25 | |||
| 2135de059f | |||
| 3cad4ae118 | |||
| 69b8b7989a | |||
| 3c02b28c11 | |||
| 9e7510deea | |||
| e259df1d0a | |||
| 941a3d8bf8 | |||
| 970227e082 | |||
| c42b018915 | |||
| c7553e032e | |||
| 3e10fac5d0 | |||
| b15f0b0805 | |||
| fa3c636494 | |||
| b91487c60f | |||
| 8ad695e89f | |||
| 0f5c68971c | |||
| 3373549e56 | |||
| 608fcbd0a1 | |||
| 1470ae73e7 | |||
| b0f51eaca6 | |||
| 715210944e | |||
| a4f35a8452 | |||
| 5a691a1b1e | |||
| 73a755f29b | |||
| fe7f36ad7f | |||
| 36e41ecae6 | |||
| 367e532578 | |||
| ce71cf7703 | |||
| e19c0e4f87 | |||
| 60881e2ecd | |||
| f8fb803e52 | |||
| 19411d3d3d | |||
| c1ebf8ae1a | |||
| f8f059d3fe | |||
| 17a83933d4 | |||
| 326c1332bf | |||
| c6d4942295 | |||
| 9a08ea10cc | |||
| aace41032e | |||
| b1e8a45fbe | |||
| 0cc86b024d | |||
| d4142db847 | |||
| 30b67af51a | |||
| be595a62b7 | |||
| f64724eda0 | |||
| fe532b9dd5 | |||
| 40dd8275d2 | |||
| 40b654048b | |||
| 53f98951ea | |||
| 88a3a82a21 | |||
| bb5e18d981 | |||
| 7bc905d352 | |||
| ba60324426 | |||
| a731e4a9b5 | |||
| ed4d12bfcb | |||
| 0c44769740 | |||
| 8c774a204d | |||
| 9919387904 | |||
| 13d57f56f6 | |||
| 56731927ee | |||
| b21db90456 | |||
| 55e0f91bcc | |||
| 0eaec66ba6 | |||
| 7c4f373d2a | |||
| 60e08de077 | |||
| a081c47efa | |||
| b015b8bd2b | |||
| 2bd95a2b57 | |||
| ea7ff135ee | |||
| e84e13fe37 | |||
| 617af68aeb | |||
| 6690598024 | |||
| 54de539b8b | |||
| 684778b666 | |||
| e89ee8ff3c | |||
| 50ba01e22d | |||
| 462bd77ad5 | |||
| 0cdbfed7ab | |||
| ddfae74ba4 | |||
| 45f96ab67f | |||
| 5170478f19 | |||
| 6b08d18f4b | |||
| 7aa6c1c08e | |||
| 623a58fb47 | |||
| b6c543734a | |||
| 6ae858d35c | |||
| 47410c54e5 | |||
| e430002951 | |||
| 0fa5ca3782 | |||
| 6bbea1bbf2 | |||
| a00fe91fca | |||
| 22d77af409 | |||
| e2a18e3487 | |||
| 7bb6a7c1e8 | |||
| 2937404227 | |||
| a3b7df7b25 | |||
| 6edcb553e8 | |||
| ce1c1e1f88 | |||
| fa0a35741a | |||
| cf4c2b5768 | |||
| 0dd823aa38 | |||
| b9b8101676 | |||
| d1917fb986 | |||
| e1442efef3 | |||
| 20b53313af | |||
| 15baa08ca2 | |||
| 7daeb6c633 | |||
| a267b67337 | |||
| 70ac47b8a8 | |||
| 61d9f957ea | |||
| c0149100bb | |||
| 1b896d8b30 | |||
| 20c0b76329 | |||
| f715a6fca2 | |||
| 8849eb1186 | |||
| 95d5bff6ba | |||
| 1d9449838f | |||
| b5bd7160d2 | |||
| ce4cb0db80 | |||
| 603868a8c9 | |||
| 7716441bbd | |||
| b5c805f0e9 | |||
| 6f54250ee5 | |||
| 2746d72731 | |||
| 7f083acdc4 | |||
| 681bc18248 | |||
| 23ce97a358 | |||
| 26bfd95289 | |||
| 51cd8cc977 | |||
| 571c953e51 | |||
| d65b3608ba | |||
| 14db63df3c | |||
| ed95c0d555 | |||
| 8deaeed6b7 | |||
| 05df25b8f4 | |||
| 9a5fc6ebe8 | |||
| d671345ab3 | |||
| 9ecfe91729 | |||
| fa571717d4 | |||
| 262a7d549e | |||
| 860dd76d0d | |||
| 484c16da42 | |||
| 9552ebf4c2 | |||
| 732c846cfc | |||
| a518af71ea | |||
| ca8a99bcfb | |||
| d1a5add3ea | |||
| 055e4d96e8 | |||
| ce20bba792 | |||
| 80a55bb69a | |||
| 32bdffa7eb | |||
| 07e8ee35d9 | |||
| 25b8da0a76 | |||
| 63bfca3d09 | |||
| 37b1d4e77d | |||
| d4e5050fc2 | |||
| 0cd27eac50 | |||
| 7fa67d4a21 | |||
| 493f02951f | |||
| 82597aa636 | |||
| 76384747a1 | |||
| e85e30c1f7 | |||
| 25eb893837 | |||
| b6b48513de | |||
| e9a22192f7 | |||
| 1fe576752b | |||
| 4277271992 | |||
| 6622e7369d | |||
| d2bd937f36 | |||
| ff1f9b98d2 | |||
| 0c85b40789 | |||
| b4104c0136 | |||
| fb712cf9c1 | |||
| 061b285aeb | |||
| 9841df732f | |||
| 9f94d1b6b4 | |||
| 5b2b699618 | |||
| 7c04662d7d | |||
| 4746ac82c3 | |||
| a223439eb8 | |||
| 6e50b5c005 | |||
| 213524e893 | |||
| be020fad39 | |||
| 2308533235 | |||
| 009b50557c | |||
| 8668dd67ac | |||
| e7df1f1f3d | |||
| 6b81eebb02 | |||
| c4cfc0cff6 | |||
| d3cbd937fb | |||
| 102068f9e5 | |||
| 0901e1a34c | |||
| 6abe6e7539 | |||
| f6cb33b2ea | |||
| 1dc49cfc70 | |||
| f49ec5fac8 | |||
| ab466b60c8 | |||
| d2e5c55bbf | |||
| 127e38a0b5 | |||
| b68978ecb3 | |||
| a381e36779 | |||
| a5a6af7ef6 | |||
| 31ffe5e060 | |||
| 61f8878e05 | |||
| 9b44b15f3b | |||
| 530965ac7e | |||
| 42e1595bd7 | |||
| e7c08d1202 | |||
| 61b5160d81 | |||
| b58fcc5395 | |||
| d4b146d080 | |||
| f65fbdf7ae | |||
| 8008985120 | |||
| f23cb1aa79 | |||
| 0caf6b5a2e | |||
| d401f7cd19 | |||
| 21bf03320e | |||
| ecc65ff233 | |||
| 26094a5405 | |||
| 40d49373d3 | |||
| 501acbc9c8 | |||
| cf6b2f8efd | |||
| 4faf48233b | |||
| bf6e0752f8 | |||
| 6e012ed24f | |||
| 1254561724 | |||
| 60fcb97a3e | |||
| 5459f1e9db | |||
| 0ad96ca7da | |||
| 8be54136ed | |||
| 7cb6801ce8 | |||
| 177ac5687f | |||
| 1301eb0fa4 | |||
| 62caaf01d7 | |||
| 160c9b9d8e | |||
| c8891c1008 | |||
| 153668db56 | |||
| 276c6c1725 | |||
| 5859ae6ba7 | |||
| 1594231b4f | |||
| f9acde8c55 | |||
| 6bdfe65bf2 | |||
| 5fd6c1c5ab | |||
| bab80e0089 | |||
| be2cfb3252 | |||
| 49bc53c6d2 | |||
| 067bbb966d | |||
| 75508fe9e8 | |||
| 49afce5f68 | |||
| 6260d350ac | |||
| 26c89f71b2 | |||
| 2d14f6e768 | |||
| b27cd33116 | |||
| f0448ba231 | |||
| acf5e21f50 | |||
| d1ca0a8f8f | |||
| e7b35d27e7 | |||
| 02e3f4cd9c | |||
| 8487536280 | |||
| 84753e55a7 | |||
| 0c96b30053 | |||
| 27bd476b12 | |||
| ed69dc12ab | |||
| e05b443a69 | |||
| a4455d2c5f | |||
| 8f17889f7f | |||
| a965cb684c | |||
| f713429674 | |||
| 392ffce8c7 | |||
| d7a238b5ec | |||
| 92ec78cd8a | |||
| 889ccdb58d | |||
| a29015551c | |||
| 83e6a4a57e | |||
| 001183245e | |||
| 09ab319328 | |||
| 76e7161608 | |||
| bc854afead | |||
| 1e0b734734 | |||
| 848ce7936f | |||
| d76d0a030f | |||
| e2af4c964d | |||
| 4527d8bd51 | |||
| a17a282b03 | |||
| 2c050522cd | |||
| c98e7cab4b | |||
| 4b49562949 | |||
| efb388ded4 | |||
| 08e9f19644 | |||
| 3b35a4b63b | |||
| b3b7f1ea97 | |||
| 075018d03d | |||
| ae7dce4575 | |||
| 3b0748fe44 | |||
| 2b49a04227 | |||
| 097ee9f2a9 | |||
| ee12977a9f | |||
| e2821cbea8 | |||
| e9f9c6e777 | |||
| 95d4391680 | |||
| f65a2826f2 | |||
| 94a8c44d39 | |||
| 16f8402d36 | |||
| 04d4085759 | |||
| a75896c85b | |||
| d397bd5c4f | |||
| 61675c2e77 | |||
| 718175eb34 | |||
| 8a3ee0515c | |||
| aefb84cdeb | |||
| 5aac826ec1 | |||
| aa86362a0a | |||
| 6104927cb6 | |||
| 74c889062b | |||
| 7b2539c4f4 | |||
| 851febd495 | |||
| a12abd7377 | |||
| 2f54cb4c22 | |||
| 81f7354fb5 | |||
| f8c20e1659 | |||
| 56394f6d8d | |||
| e0e6d96c84 | |||
| f41b558fe5 | |||
| 5507febe09 | |||
| b8ee3187ec | |||
| f74842cd4c | |||
| 2e61201f86 | |||
| 4108d572b8 | |||
| 423b133e75 | |||
| eb25d2e6a8 | |||
| eae06b62bc | |||
| 49aeef99b6 | |||
| 8e37d2ada6 | |||
| 7513fe9c69 | |||
| 34d3091fc9 | |||
| 992f520698 | |||
| b23e1d3d52 | |||
| dd53539799 | |||
| 93b1ce53c0 | |||
| e70d6d1f8f | |||
| c34db290e4 | |||
| 9d2b7875b9 | |||
| 1f025817f1 | |||
| 38d4e3a097 | |||
| c03d44da00 | |||
| 537c507efe | |||
| 0fbd08f1ab | |||
| 0f469a3269 | |||
| 9713bc8c02 | |||
| 7f0b2c54f3 | |||
| e9fd61a1ea | |||
| 33c95d1a58 | |||
| c5aa670569 | |||
| 533b11f991 | |||
| ebb68c3386 | |||
| e9a4d9cafe | |||
| bb114932ea | |||
| 3b87c5d84b | |||
| 30b635527c | |||
| 77963aaf88 | |||
| 02d5ca78d5 | |||
| e99fe93029 | |||
| 548021dd40 | |||
| 0f528c4811 | |||
| c876876d5e | |||
| 7dde2fec55 | |||
| 49cf92c2a2 | |||
| 60319c30ac | |||
| 191e8ab240 | |||
| b4dec8ccbb | |||
| 7d28edc116 | |||
| 4d314f99ac | |||
| 1d146640e5 | |||
| b4c95d4fc9 | |||
| d9c258f27e | |||
| 4a56cc3693 | |||
| 8b149ff827 | |||
| f3145e671a | |||
| d3cb001d65 | |||
| 16da9b0506 | |||
| d7914d2c54 | |||
| 9849c62d80 | |||
| 3c630fb7f4 | |||
| 55f0b6a1f8 | |||
| 1b21fdda3b | |||
| c17d6ba487 | |||
| c6ff7e8934 | |||
| 1895e8143d | |||
| 5c74a02688 | |||
| 2f900e11ed | |||
| 1123ca4bc1 | |||
| 4973c2afc6 | |||
| 502e3ceb3b | |||
| 32b40fe1ad | |||
| 9a12b170f6 | |||
| 9f4b594bd0 | |||
| ea7a8c9670 | |||
| 113dac6e2b | |||
| 642427d015 | |||
| 26dad65c8d | |||
| 827bab90bf | |||
| 1a90f1c017 | |||
| 8172618bec | |||
| e12d779f00 | |||
| 1300955c13 | |||
| 7714c35829 | |||
| 3de070708f | |||
| 7aba7b0854 | |||
| f16c7247a9 | |||
| ef2ece3600 | |||
| 962b559638 | |||
| 9ab4707d43 | |||
| c3759feaa0 | |||
| 96418f3640 | |||
| a96c354f4f | |||
| 81462d9050 | |||
| 919bdca8f4 | |||
| 130e5cd3ec | |||
| 42301210c4 | |||
| 43a3c93d9b | |||
| cc98b88e28 | |||
| 212a192abf | |||
| ebc75b1ba8 | |||
| 7be6421989 | |||
| b4206d3202 | |||
| e8e0d5dd02 | |||
| be229d374e | |||
| 14b28a8a89 | |||
| c71bccd72c | |||
| cee9605fc5 | |||
| 7b5b942c47 | |||
| d5e0af2646 | |||
| a12e1d8b0e | |||
| d9d9b6800b | |||
| 8d7fd982e1 | |||
| 3e937e9811 | |||
| 4b993b99cd | |||
| 839f0b642c | |||
| f4d7586034 | |||
| ab23f624af | |||
| 86484e7426 | |||
| 734b6778b1 | |||
| 252682dd99 | |||
| 95e14486af | |||
| cf239ccac0 | |||
| dd041945d2 | |||
| 1cc4c52c7a | |||
| a2c894bcc9 | |||
| ebfd8ca4c3 | |||
| da938d8212 | |||
| 855f955dec | |||
| 1b8a8cf939 | |||
| 9147e86d96 | |||
| 6c748c2f87 | |||
| 4b6e0916c9 | |||
| fa5861a626 | |||
| f556890873 | |||
| 55f185f980 | |||
| d4474e1d4d | |||
| b64f6c5c27 | |||
| 616bb487f4 | |||
| 9f4fb29b58 | |||
| 1262d3fce9 | |||
| f4f74e1171 | |||
| f0c8c044c9 | |||
| c13b291c64 | |||
| 70191ea368 | |||
| d294bf4d05 | |||
| 10ca03f238 | |||
| 67f96e0fdd | |||
| 879ce3b30d | |||
| 3de96f1e7a | |||
| ee621bcace | |||
| c2118a8cb9 | |||
| 21f1579f73 | |||
| 4dce9d659f | |||
| ca4cfe358f | |||
| 7c8c4bd233 | |||
| 35cf96e15f | |||
| 7a9d408425 | |||
| 69300e0766 | |||
| 559f76e887 | |||
| 6eb88278ae | |||
| 662ddf9fd6 | |||
| 698f670350 | |||
| aebaf688a9 | |||
| 7e15a343f3 | |||
| f47eea1e6c | |||
| 5a944514f3 | |||
| fb955667f5 | |||
| 31aaa23b20 | |||
| 4d239b46e2 | |||
| 856b07197a | |||
| d07751605a | |||
| ddb09e98e8 | |||
| 75b40f603a | |||
| 5c21d71461 | |||
| 6c5f310cba | |||
| 909a951ff0 | |||
| 51a07bdb31 | |||
| 3dcdf0863e | |||
| 46b5731ac4 | |||
| 9be438d2f7 | |||
| bb8f4fb092 | |||
| 7b65a68450 | |||
| 7e6eecc6cf | |||
| 9d709ea152 | |||
| eadb3cf98c | |||
| 09e9c2f224 | |||
| dbae05605b | |||
| 3c5b721177 | |||
| b0e4ce7bb8 | |||
| 2bf7adef5c | |||
| 34fb03fbd3 | |||
| a8a28fea18 | |||
| 16cef29925 | |||
| 26564ee020 | |||
| 66a80ade30 | |||
| 685ec5d8d7 | |||
| 52139dc24e | |||
| 2357f46761 | |||
| 64fea21a38 | |||
| 71e73750e2 | |||
| 37b298fcba | |||
| 01ad97e7b0 | |||
| 988f4da6e1 | |||
| f48ee846e9 | |||
| a9c599abeb | |||
| c717d23901 | |||
| 6153375c76 | |||
| 850ecb23df | |||
| 8f03ff2952 | |||
| 0be166bb59 | |||
| cb2d24baca | |||
| 7609b08e86 | |||
| aeffa0e150 | |||
| 932d552ae7 | |||
| 78d8485243 | |||
| c3232a463c | |||
| 536beb0d40 | |||
| 1afe4f0cd9 | |||
| 334c4095bb | |||
| 986e5f9c7a | |||
| 6077cf2389 | |||
| f417e898f6 | |||
| 047d9525e7 | |||
| ca7da8a0da | |||
| 49b17023a5 | |||
| 693c4f8270 | |||
| df08c14aef | |||
| af903f6690 | |||
| cef25898bb | |||
| 0dea901368 | |||
| 9086171f45 | |||
| 9aec992693 | |||
| a788006d7c | |||
| 40512a4823 | |||
| 2e77f0ed7d | |||
| af5392b8ac | |||
| 471ac4976f | |||
| 16c892caa6 | |||
| 35b0e06260 | |||
| bbb7dfdd07 | |||
| 56a9316a28 | |||
| 7d676f51bd | |||
| 7ca8e31087 | |||
| 029d8b58db | |||
| 160a336b48 | |||
| 1ecd195e6e | |||
| 9f8a07fc27 | |||
| 1f3e3c698f | |||
| 1f9e33d995 | |||
| 32178541fe | |||
| 51e915c423 | |||
| 4ca00f7347 | |||
| b2d34d93ab | |||
| 78bb074c0d | |||
| 3a39c92ae4 | |||
| 883127f0d6 | |||
| 3b52cd018b | |||
| 6f34d0b346 | |||
| b35bd36ec7 | |||
| 8c037bf425 | |||
| ae5e07ddd6 | |||
| b16529bf9f | |||
| db0676cc51 | |||
| 2d1cb8b519 | |||
| 3a11c56438 | |||
| caf34d6a3a | |||
| a028dff6e9 | |||
| 0563ee4a97 | |||
| d466abdc64 | |||
| f4be899ae9 | |||
| 5403bc647a | |||
| 482eb6c0de | |||
| e02e4cd975 | |||
| ac90b13032 | |||
| 64aaf670ed | |||
| 4a764c2d9d | |||
| 0f0480b79f | |||
| df6feab346 | |||
| aef34c11b7 | |||
| 0292ba959f | |||
| 58275a2f0a | |||
| f0d3a06655 | |||
| 0ce67b307c | |||
| 598cdea22a | |||
| 32d23d6303 | |||
| 3279a575f6 | |||
| 16ffbd1920 | |||
| 9180060920 | |||
| fdae5fd89c | |||
| 8e218de3e7 | |||
| a6c89b75fc | |||
| 15cf475d04 | |||
| b56f4a129f | |||
| 0d8a6782b3 | |||
| fe219ed159 | |||
| 6ee24cc50e | |||
| 5a84814e27 | |||
| 994138c7a6 | |||
| df6809e705 | |||
| 71aa9802d5 | |||
| 8b98a7793d | |||
| b4cbffd978 | |||
| 53dde09523 | |||
| 8af73449fe | |||
| d2b513bd5e | |||
| c54766a08a | |||
| 8a7aa8083c | |||
| d1a26b9f81 | |||
| 655fec2f18 | |||
| 2d5bb8bd8b | |||
| bd7542cb0a | |||
| f06c9a5bc8 | |||
| 9f85ba4f7d | |||
| b878be27a0 | |||
| 1b98bf706e | |||
| c923b561e2 | |||
| e72e1c9c56 | |||
| ecad6bc2a8 | |||
| cedea831f7 | |||
| 1b4fbdb065 | |||
| c5cd39308d | |||
| 083e6f26bd | |||
| 15f95cb2a3 | |||
| b6d1f37249 | |||
| 232978ea9d | |||
| 5afe0a758c | |||
| d3fa5b0f85 | |||
| ad0bcc3851 | |||
| b110f430ee | |||
| 7993e3ab39 | |||
| 540c543984 | |||
| af02d9f0fd | |||
| 36d0b2c735 | |||
| 7518864938 | |||
| 2d00d3e07e | |||
| 0d520e9930 | |||
| b70ff1b164 | |||
| ba6d3a1124 | |||
| ac65e288df | |||
| c5e34c60f8 | |||
| 5a291e8188 | |||
| ab5156c5e3 | |||
| 360a3076a8 | |||
| 0af9564d1a | |||
| 21f83ea938 | |||
| 81c1769770 | |||
| 0620d19f26 | |||
| 46acb6da2c | |||
| e8a66ded01 | |||
| c90579956f | |||
| d857cc7d77 | |||
| 495230435f | |||
| 707ed3c51a | |||
| 027bada7d5 | |||
| 58add85f09 | |||
| 7359101bac | |||
| 4e787ceb43 | |||
| ff76911e4c | |||
| f0cddf9f32 | |||
| c32c894d23 | |||
| 422d89a7ed | |||
| 5e0dd80366 | |||
| bfbdfb46a8 | |||
| 91e3fbd2d8 | |||
| 6c640133f1 | |||
| bb287cb465 | |||
| 252159afcf | |||
| 6c43fd5c9d | |||
| 2f60ffcfce | |||
| 8980a97895 | |||
| 160b80b47f | |||
| df064ddd21 | |||
| 9d2d3d5c00 | |||
| f62e81bca8 | |||
| ab1b90804e | |||
| 9fe264ded4 | |||
| 0e3f9297fb | |||
| 7fdfd71382 | |||
| bb40ad6177 | |||
| e3295059a0 | |||
| 4940439f4b | |||
| dccd5ec8ba | |||
| 0ca1204b89 | |||
| c8d76edea1 | |||
| 1d9aa7c5e1 | |||
| 3a05731f2d | |||
| 9c7ff78fc8 | |||
| 89fe8e1628 | |||
| 7e0ac1db9c | |||
| 20073c9d34 | |||
| 4fdc9fba63 | |||
| 0d78098dbf | |||
| ee31114b32 | |||
| 0f623b3d08 | |||
| 1ac55413d9 | |||
| 60f945aafd | |||
| ca3b0c97da | |||
| c50b7fd99e | |||
| d69a32d551 | |||
| 875555d933 | |||
| faaaa538a9 | |||
| 00cb0bb8d9 | |||
| 59c02c90da | |||
| 2302baa4f3 | |||
| 443056ef5c | |||
| 6b0a466596 | |||
| d6eb1aba75 | |||
| c1769c3de1 | |||
| d37605766d | |||
| 763c59764f | |||
| ec54330096 | |||
| ac225731d5 | |||
| 2803da2f8b | |||
| 0640631d07 | |||
| 4e8c6e29ad | |||
| 915d2e42b7 | |||
| cd7162b3bc | |||
| 96e91f5fa1 | |||
| 24ce415283 | |||
| 2a6c4b04b1 | |||
| 9cc4c2e5de | |||
| 7e9c39fd55 | |||
| 09967db742 | |||
| 946f908ab7 | |||
| 8fb61168b0 | |||
| b65e1485a7 | |||
| 1c8509b873 | |||
| 044396d41a | |||
| 41229f50f7 | |||
| 1368026db2 | |||
| 36e725d5d5 | |||
| fc00688454 | |||
| df9c30d174 | |||
| 1b6bd1f32f | |||
| 2f5a99fac2 | |||
| b27b0c7d4f | |||
| d92db4a7a8 | |||
| 7ef87cb6c4 | |||
| 001fef384c | |||
| ab2a298994 | |||
| bef3c50fe5 | |||
| 4a5a155511 | |||
| 3087fabc21 | |||
| 41c79789e3 | |||
| 0ae599ad6f | |||
| 1b2b8861ee | |||
| f85e1ccf9a | |||
| 4ed36ec095 | |||
| 4fc7e1a9d5 | |||
| 7940820877 | |||
| e4eea237b5 | |||
| 1d6c2cdf27 | |||
| c51db80d6e | |||
| 38c2509927 | |||
| caed3d39de | |||
| 693a495618 | |||
| 987d1da233 | |||
| 840efa3d82 | |||
| 9f235103f8 | |||
| 1ccf026a83 | |||
| 2d897ba415 | |||
| c3045dd230 | |||
| e50aa56d02 | |||
| 228fa1abe5 | |||
| 125c41a2e2 | |||
| b9ad462c69 | |||
| 0d35943386 | |||
| b1527a7982 | |||
| eec6518278 | |||
| a447ab4edc | |||
| f0cf337857 | |||
| 927e9c3de8 | |||
| 4acb3acebc | |||
| 63d665e2cb | |||
| a720919dd8 | |||
| 220b9dadbb | |||
| 608ffd27ad | |||
| 35f0b7b49e | |||
| b856ab16cf | |||
| 9866e84c9f | |||
| 444325893b | |||
| 93910201b0 | |||
| 9204836d70 | |||
| e6274b2f45 | |||
| 8cd7adceb5 | |||
| d52631bab5 | |||
| 8e2938ea82 | |||
| f8011d9cc9 | |||
| 8bf9598f7b | |||
| 74d6bf776d | |||
| 4fa4bc5c17 | |||
| abc025326f | |||
| 2d054e715e | |||
| 9b621f330b | |||
| f84402c4cf | |||
| 62c94959e1 | |||
| 23fc73733f | |||
| 6bda6e7644 | |||
| faac67c88e | |||
| 1f4febcfaf | |||
| b37468871c | |||
| c63834924a | |||
| 1091875ca1 | |||
| 66b80d9682 | |||
| faca7f091a | |||
| 9489ec6787 | |||
| d5723aa18d | |||
| 1dffb9237a | |||
| 0a92f68aac | |||
| 40939ab984 | |||
| da898a5344 | |||
| 88ebad2b7a | |||
| c9edc3b2d6 | |||
| 1407f6c1f0 | |||
| 3542e879bc | |||
| c2eca1ff99 | |||
| 2568aa086e | |||
| 7cb8850ed2 | |||
| beeaa01d22 | |||
| 3e5448b698 | |||
| ed9f46b39f | |||
| 76484acb21 | |||
| 36768251f8 | |||
| b4ab10403d | |||
| 086c7f7133 | |||
| 4b48e07f83 | |||
| ca1177efea | |||
| a149357bd5 | |||
| b5474790cb | |||
| 848761710e | |||
| 53f03d1b30 | |||
| dcbd6f07e5 | |||
| 42290e87f8 | |||
| df528f954b | |||
| 5ee388cede | |||
| 5d7b4ec04b | |||
| cabee75f8a | |||
| 87f991a35d | |||
| 14a0010517 | |||
| e478d9b7a0 | |||
| 0acccc383e | |||
| 3303f5a741 | |||
| a50cfa26cc | |||
| 4d2b78b1f8 | |||
| 9f6ef4beec | |||
| f93b09fc9e | |||
| 599328cb9c | |||
| 9b8abe3552 | |||
| 130baf2235 | |||
| 5d84c8117e | |||
| 379bf54c40 | |||
| 88ae70eb19 | |||
| 1aa0e52cea | |||
| 8c138ebd04 | |||
| cada940345 | |||
| bbbdacab74 | |||
| aa27b3d464 | |||
| 807c6878c1 | |||
| 45ede6bc79 | |||
| 3c95fbd72c | |||
| ca49d0714c | |||
| f21571eab1 | |||
| bc99e72b3d | |||
| fe5d73c02a | |||
| a1cab1a692 | |||
| afa58160b3 | |||
| 84bc5d1e56 | |||
| 917ab3fe7b | |||
| a8f27a7848 | |||
| 58bf33fc6f | |||
| 6107734460 | |||
| 4c037d53e2 | |||
| 44871c84cf | |||
| 5071f083a1 | |||
| a2035bc305 | |||
| 27252961cf | |||
| 0102c0fd8d | |||
| f190dab5e6 | |||
| e037bf1db9 | |||
| 865b70e16d | |||
| e59ab14ad3 | |||
| 1ce9cdff0c | |||
| 140d5d5a85 | |||
| 8c648e9226 | |||
| cd9f6d4c62 | |||
| 305a1b91b8 | |||
| fff4531663 | |||
| 9d987ac911 | |||
| bc03810589 | |||
| d95016307a | |||
| 8f0bffc589 | |||
| d82daeccee | |||
| 23f66c12a4 | |||
| 39f920165d | |||
| e0c8c5ccb7 | |||
| c1e4d2f1f1 | |||
| 312f04f44d | |||
| e871929aae | |||
| 91cbcf0073 | |||
| 738fc31f56 | |||
| bbf7c6ca1b | |||
| 2f008aa886 | |||
| 4c56e8bb57 | |||
| c4e713f121 | |||
| 99333d4444 | |||
| 8bd02358d2 | |||
| 558e41f740 | |||
| 37b3784129 | |||
| f3b7874007 | |||
| 286e70cc57 | |||
| b2637aae57 | |||
| 0c5e38680d | |||
| e412eb16af | |||
| 6963503d6f | |||
| 7b42e975fb | |||
| 26638980bf | |||
| 9a3821b97e | |||
| 7e5b6bf5c4 | |||
| 235cd1fbff | |||
| 224e01102c | |||
| 75da75158a | |||
| ee7a90184b | |||
| 78dc676f0f | |||
| 7967dada4b | |||
| b1e79b4634 | |||
| 4e59605728 | |||
| 461aaa83b0 | |||
| bb8f5bb40c | |||
| e0e4936756 | |||
| 2e6735ecd0 | |||
| 26a4ff9121 | |||
| 89b0d7efdb | |||
| 99e573006e | |||
| 1ae878c000 | |||
| 6c4294dda9 | |||
| 8bcb01383c | |||
| bd00c5d53d | |||
| 1142ae89aa | |||
| c5557500a9 | |||
| 1963cb66fd | |||
| 9597d4ea52 | |||
| 57d9a7b22e | |||
| 93cddcf8dc | |||
| 2cb18f5855 | |||
| d56946fa6e | |||
| 9432f9703e | |||
| 8182bd59f9 | |||
| a64b81090d | |||
| 5bbc70e6de | |||
| f868c0cd4f | |||
| b74f2a3e9e | |||
| ec3a137a1a | |||
| 742a28ca9c | |||
| f677e6633c | |||
| 79562f51fd | |||
| badcc6c2bf | |||
| fad987c0f3 | |||
| 756bb5604f | |||
| abbda0643a | |||
| 53c3fa8ac8 | |||
| cf9185b512 | |||
| dbd924cfb0 | |||
| 8bfc3e473e | |||
| 27c5506d83 | |||
| efb4bdd028 | |||
| bf76083939 | |||
| 49e42c0510 | |||
| 5dc1ddd5b5 | |||
| 19c347903a | |||
| c9e1f89b60 | |||
| fe1b4c71a3 | |||
| cc3558067d | |||
| cfe03c108a | |||
| c91de1e515 | |||
| b2cb527f03 | |||
| f1c9d09fd9 | |||
| a5b8478060 | |||
| 3c4966f6a3 | |||
| fdcbf611aa | |||
| a630f05ae4 | |||
| a16428c5b6 | |||
| d042fadab1 | |||
| 9173711b58 | |||
| 09b7fe72eb | |||
| 758ff58d2d | |||
| d1c9d0ea68 | |||
| ae77011385 | |||
| 2f67312a80 | |||
| 78cb747a39 | |||
| 2601f266fa | |||
| 7c9119c793 | |||
| 9949f044cc | |||
| d42db869cd | |||
| 7a709b05f3 | |||
| 6ce3f87448 | |||
| cd7a906b9a | |||
| 5e504d6c08 | |||
| e3b381f638 | |||
| c7175c7e5f | |||
| 8993258e74 | |||
| b7b4dcda24 | |||
| 63017b7800 | |||
| 503b1231db | |||
| 9041c56ef3 | |||
| 2445829f83 | |||
| a12c78100e | |||
| f2698bc6a9 | |||
| 314324562e | |||
| f4161a1889 | |||
| 17e9c6ea3b | |||
| dc94855e1a | |||
| 4636e9ca40 | |||
| 049a2b3884 | |||
| 7c8e1634b8 | |||
| e0865e8c38 | |||
| 20580a5da8 | |||
| fcb90abfda | |||
| b9fcfda904 | |||
| fe0dc8181a | |||
| 003813f39d | |||
| 763729d08d | |||
| 6042439598 | |||
| 987f80aeb3 | |||
| abc5ed5190 | |||
| 3e07351552 | |||
| a7091c8d94 | |||
| 37e16bb163 | |||
| 7018f33ad7 | |||
| 2efed9f42c | |||
| bd58834e7d | |||
| be009e87c2 | |||
| 393cba4d42 | |||
| 131df22c11 | |||
| 40d7fcf32c | |||
| ff8491f8d3 | |||
| f22461e5e8 | |||
| 7b7c77645c | |||
| f6bfab5dd7 | |||
| 31579703f0 | |||
| 34019951d3 | |||
| af923cca9b | |||
| 26e53584c1 | |||
| 9633677bcc | |||
| f8fbfc8624 | |||
| c8dd9f8d82 | |||
| 1e3d157f49 | |||
| 9843147c3d | |||
| 30fb637f86 | |||
| 6e4d9508aa | |||
| 1fcc0adf6c | |||
| 33de90a0b6 | |||
| 9e38537239 | |||
| 84107317bb | |||
| 931ae677c1 | |||
| 8745ef8723 | |||
| 062d07ada0 | |||
| 6166f8e681 | |||
| bb2ab15753 | |||
| a048d2994e | |||
| 3a3336aaaa | |||
| e442dfff11 | |||
| 44d78ed30d | |||
| 725e0d778a | |||
| bd40133277 | |||
| 9773751e79 | |||
| 4683285e0d | |||
| 1730444db8 | |||
| 20083b97c6 | |||
| 26bcf7718b | |||
| 42119ecb29 | |||
| f37265978e | |||
| f455379a17 | |||
| bac2209449 | |||
| 2f4bbd90a6 | |||
| 5c9dd50e39 | |||
| 2973a81293 | |||
| 144984c726 | |||
| 1b56cfb270 | |||
| 16b53d3183 | |||
| 05d6adc6c7 | |||
| ed1c5d3417 | |||
| cf357376b3 | |||
| b4eb7d072e | |||
| 4f8d51450a | |||
| b50b2231d6 | |||
| a762291de9 | |||
| ec2b116674 | |||
| 0b9f6b14ba | |||
| d136837c79 | |||
| 081967dc95 | |||
| 101605e50f | |||
| 262e2fe1ec | |||
| 5d2a0a0223 | |||
| 8447a22419 | |||
| b6eed51eed | |||
| d1fd3c8d7c | |||
| a3ef9c204b | |||
| 52d47f555f | |||
| a5870cedd2 | |||
| ede5e88a19 | |||
| 0b3a91b5fe | |||
| 40aa81e9c1 | |||
| ace71acb3c | |||
| 5d22cff6ad | |||
| 19cf333e52 | |||
| e176141846 | |||
| 3347aba5ff | |||
| ee15855383 | |||
| 930cd9551b | |||
| f03b6207de | |||
| 08783f19e4 | |||
| a99e4ef5a9 | |||
| 5df78812ef | |||
| 59a5a5bc8f | |||
| 68a02fe009 | |||
| 460c4a0b09 | |||
| abce3d7f9b | |||
| 11f140ac5a | |||
| ec93dc38b7 | |||
| aa8fb3eb4b | |||
| 917fbaadad | |||
| 2dc1817807 | |||
| 320d177038 | |||
| acf538cf4b | |||
| 2cda2b9fe2 | |||
| 3d076daf54 | |||
| ba028f6358 | |||
| da59785c76 | |||
| bd1b407a4b | |||
| 326910eeed | |||
| f4264f00f8 | |||
| 606f446c27 | |||
| 2944b64795 | |||
| 55d4625091 | |||
| 5f2c4dad95 | |||
| e03f2fd738 | |||
| 5c93fd4574 | |||
| 22af597c42 | |||
| 34ca5ce949 | |||
| 83c6975d34 | |||
| 955e1571a2 | |||
| 79ac5d606d | |||
| 9a6b5986fe | |||
| a9c74762cc | |||
| 936d4f6d53 | |||
| f33a8538e3 | |||
| 1bbc9f61e9 | |||
| dab8c5b53b | |||
| 3150785db2 | |||
| f531d36060 | |||
| 9efc326ff3 | |||
| e8216a8313 | |||
| 78211acafd | |||
| 40975f15d3 | |||
| cc87595e4e | |||
| 693d8258ad | |||
| 9a8fd062c4 | |||
| 07b40265fb | |||
| 699212a13e | |||
| 7b0ce258d1 | |||
| 7ab79d05f0 | |||
| 1ee5eb32b4 | |||
| 206b58a86c | |||
| 7caddc6c10 | |||
| 0b6c817f0a | |||
| 9b19b4512f | |||
| d2f2011ea3 | |||
| d64c3e773d | |||
| 2ae5cacc6f | |||
| 3cfbbc5d94 | |||
| f3e1a72882 | |||
| 0e1adddd2f | |||
| 995ae4c9e2 | |||
| 4ce4529022 | |||
| cb1d9af06e | |||
| 2e0a6af8ca | |||
| e3236675c9 | |||
| 4971a73c01 | |||
| bd3eb02b1b | |||
| 7e2ea8aff1 | |||
| ecb159738f | |||
| 66044175cc | |||
| 326bfe1188 | |||
| 875474d496 | |||
| 32c950dee8 | |||
| 6052a90ce9 | |||
| 6066030059 | |||
| aea27ff779 | |||
| a4d8ed6ce6 | |||
| ae544e0c7e | |||
| da2cea4a24 | |||
| 6f982c7c4c | |||
| 4cd181022d | |||
| f48355ce10 | |||
| 5e5437502f | |||
| ea65421120 | |||
| 7f8e2aba1b | |||
| 209eceee6a | |||
| b8d0544517 | |||
| 19162db3ce | |||
| da090b57d4 | |||
| dc3b26c934 | |||
| 9708f436c5 | |||
| 2a2a391d13 | |||
| d3920cdc05 | |||
| 05336dc38c | |||
| cf07eef3ae | |||
| 00c1fdce38 | |||
| 4b146f3459 | |||
| a1e1bee334 | |||
| 142d18bb7c | |||
| 1c5b72e04d | |||
| 7d9e64a52d | |||
| a9175665fa | |||
| 3773061cb5 | |||
| 8e9a7355bc | |||
| 0a6963a965 | |||
| 082acf4386 | |||
| 327b49797b | |||
| 1ccfbe22dc | |||
| 5f9c643ae9 | |||
| 95218ca9f5 | |||
| 44cd588bf9 | |||
| e5b89e559e | |||
| 346a3c94aa | |||
| daf5b9cb14 | |||
| ff471ebf5b | |||
| bd48cfced0 | |||
| aab50d3c2c | |||
| 226611d2ec | |||
| 9e3935f349 | |||
| f51102a230 | |||
| b0706ee9fb | |||
| b298f63e4c | |||
| af78a6b50f | |||
| 7f8978f07a | |||
| 764a7bf257 | |||
| d54f2e6eab | |||
| a3483d0ffe | |||
| 0fe93bef91 | |||
| 72f57ad993 | |||
| 70010bad56 | |||
| 5308e03096 | |||
| 12bc89ca50 | |||
| a585df6d2c | |||
| 8323b0defd | |||
| 6a08827830 | |||
| 416f654d2c | |||
| fd7772a653 | |||
| a48a52922b | |||
| 1d84274973 | |||
| b6334483c9 | |||
| 7f8adf247e | |||
| 4c9ebc940c | |||
| d14ddf6f38 | |||
| a1b82e9dad | |||
| 5a7f2a9ef4 | |||
| 8d22b6d1b3 | |||
| bc211a2231 | |||
| 38924f5bb8 | |||
| 7233d9d64b | |||
| ac30781db8 | |||
| 4768ae9008 | |||
| 7effc4c456 | |||
| 6ce25d4c71 | |||
| 371fdde4f9 | |||
| b5be1c378a | |||
| 3c5a79710a | |||
| 3ed35574d4 | |||
| 142824ec01 | |||
| 0d7f642675 | |||
| 67c2a1473c | |||
| 215cd64c9a | |||
| a772a9aa75 | |||
| 7e405138fc | |||
| f817e37a01 | |||
| 2ffb88e936 | |||
| 34f3176259 | |||
| d3fa24be57 | |||
| 6a5ca3805e | |||
| eef13e7db8 | |||
| e32d7b1ff1 | |||
| d8b4beb8bd | |||
| 1f74b5ccb4 | |||
| a07cd87c2c | |||
| 2fe057bd9b | |||
| 2ac3af193b | |||
| 81d4b764b8 | |||
| c8ec73d2f0 | |||
| 368e10a9f5 | |||
| 3c561ef208 | |||
| c8b9622bf4 | |||
| 5d822b7305 | |||
| 1e51750b6c | |||
| 5410e9368f | |||
| 772787121c | |||
| c1954d869a | |||
| d37fbd43f1 | |||
| de7d9bfcb1 | |||
| 8c1f5658be | |||
| c8804359c9 | |||
| b846a4db98 | |||
| 643a5c6d0e | |||
| da016114b6 | |||
| 8437f3ff7f | |||
| 8340a084d3 | |||
| a41e3c1ebb | |||
| bb8b3782b9 | |||
| f5774972e9 | |||
| e3ddc3f29b | |||
| 4510d31301 | |||
| 58ef6c6582 | |||
| 054626a9a2 | |||
| 6e238967a4 | |||
| ae444d1ea3 | |||
| b64f5b2a85 | |||
| c51f1d2c52 | |||
| d3099cb682 | |||
| bf7e586e6a | |||
| af06575aad | |||
| 7a4f5ad9d1 | |||
| 280e527f5a | |||
| 02873f5116 | |||
| 187263173b | |||
| 75fbab94b1 | |||
| 4fddae68a9 | |||
| 60189c0135 | |||
| 00fd7fc00f | |||
| 8cbccafe08 | |||
| 9e674d52ac | |||
| 4e9b33075f | |||
| d58b1d5b72 | |||
| 858f58da97 | |||
| 43dc7fcf9e | |||
| c9cb5016b7 | |||
| 6d2805d782 | |||
| fab5842651 | |||
| 844f5343c2 | |||
| 0887ec2e55 | |||
| 68dc76def3 | |||
| 5a4108f3c8 | |||
| a83cb88630 | |||
| a52c516c88 | |||
| 3514ee5659 | |||
| 6f8c07e917 | |||
| 67adce6a99 | |||
| 513ed3b4b1 | |||
| 502d3c2957 | |||
| ec4bb162c3 | |||
| 7756f8e86d | |||
| 9604d81ec8 | |||
| 0080e09065 | |||
| 5015ca94bc | |||
| f969927c69 | |||
| e4995091d3 | |||
| 74e7fbc76d | |||
| 36e7351ba3 | |||
| 7a56d4080c | |||
| e0a93ed1c2 | |||
| adcfcb7897 | |||
| a05405370c | |||
| db4420e068 | |||
| dacb00ed67 | |||
| bfd2667c51 | |||
| 2416ff19a4 | |||
| a2f72882d7 | |||
| ab934cfbfb | |||
| 8e57ee2776 | |||
| d3ead2a0d1 | |||
| a5dcd71548 | |||
| 93bef861df | |||
| 7e6dc68bca | |||
| e23edd02fd | |||
| 84fe0a384d | |||
| 266c305ebb | |||
| 3d6dbf6d59 | |||
| 49d1801742 | |||
| 955fa78d51 | |||
| 712ba2c3fa | |||
| 1ad5327c99 | |||
| f4d339ccac | |||
| 84244a4c22 | |||
| a362a14f75 | |||
| f8ffe1c408 | |||
| be9ffc499f | |||
| ef595c74ef | |||
| b169759f98 | |||
| 2f3b4b9e5f | |||
| 0b719bfecf | |||
| 1929899365 | |||
| 6e472064dd | |||
| b006841fa7 | |||
| 4b5d375638 | |||
| 39ee6f66ba | |||
| 95090d735e | |||
| 71f28ad9e5 | |||
| 77b7e71920 | |||
| 8668998b1a | |||
| 661ef175d5 | |||
| efe44fd78c | |||
| 912b9292c4 | |||
| 1051ad83c8 | |||
| 61cc592605 | |||
| 529b3ac583 | |||
| a55fdc7551 | |||
| d2b2c6fc8d | |||
| 5f771978ac | |||
| 6c357aaca7 | |||
| ae96a48572 | |||
| 2f190025a9 | |||
| 46f0bfb991 | |||
| 38e8f0494d | |||
| 501dc9b76c | |||
| 977941655f | |||
| 9c6978e913 | |||
| aae705e82c | |||
| dfa91f0f3c | |||
| 35ab49eff0 | |||
| 1f23fa8cfc | |||
| 4702f3775d | |||
| 10f405f61f | |||
| 6b3d527dda | |||
| 014d5e7bb3 | |||
| 7798f04cc4 | |||
| 919cee3e4a | |||
| e7f371ac62 | |||
| 4a203a9eb6 | |||
| 5270a99f7b | |||
| 91587cbb99 | |||
| dfecef24e9 | |||
| e5436974eb | |||
| b01a3ff9cc | |||
| cdb7f14c03 | |||
| c720274221 | |||
| e5f6133e40 | |||
| 8a1c16c35e | |||
| c1b22cfa90 | |||
| a9b9e5651f | |||
| 875fbba024 | |||
| 44f53e5ed0 | |||
| 09259a579d | |||
| 74c1e64bdb | |||
| d120804520 | |||
| 694b499b21 | |||
| fc7eaf57fc | |||
| 836ff53ef3 | |||
| a1882ffd1f | |||
| 634117ed66 | |||
| 25839c5cf5 | |||
| 12d3686cb6 | |||
| eb5d0fe3f5 | |||
| 460577d9ae | |||
| aba0f8e362 | |||
| 8dbcb44d06 | |||
| 8fe9e31c08 | |||
| 20e2f2bb7c | |||
| 0df07a8c29 | |||
| 2b35eaa414 | |||
| c393a0677e | |||
| 347ba6c7ee | |||
| 65d5e631f8 | |||
| b27a465e2f | |||
| 426fc7ffc8 | |||
| 990f5a92ce | |||
| c64d07d506 | |||
| 8f177c3835 | |||
| 3a3f4e2ce6 | |||
| e091f48b81 | |||
| 3ec74f3211 | |||
| c236325c1a | |||
| f7f034ad2a | |||
| 4755233f92 | |||
| d916962a80 | |||
| 44d4dc7e60 | |||
| 9860f32d4c | |||
| 879f4e92a6 | |||
| aaf0d48edf | |||
| 051decc08c | |||
| d8a3848c1a | |||
| e461c4d94a | |||
| 4939b636da | |||
| c61bf804a4 | |||
| e601c6e256 | |||
| 96a949983c | |||
| 8b82c06c6f | |||
| eea02cb807 | |||
| 6699941da0 | |||
| 82bfd83da1 | |||
| 5399fdb939 | |||
| 1d1ba5f6d1 | |||
| 21cdde1188 | |||
| cec037333f | |||
| 6f5138a56e | |||
| a5a41cf292 | |||
| 115b960ce7 | |||
| 832df7149e | |||
| 9330276ae9 | |||
| 7c04aaf536 | |||
| ec8a5b368b | |||
| 66467b3571 | |||
| cc7ddc59ff | |||
| 2a78183a15 | |||
| 35419e8d80 | |||
| 9139df5779 | |||
| 214209d2da | |||
| 84420553d3 | |||
| 06b63c24dc | |||
| b01a4aa041 | |||
| 7e03880bd0 | |||
| 10fe754dfd | |||
| 140b22737e | |||
| 2aefd8ca46 | |||
| 5d8a40d240 | |||
| f3990722e3 | |||
| 194ac13f43 | |||
| bf7fc39434 | |||
| 50b61f3a00 | |||
| 10d0fdf2d7 | |||
| a392174164 | |||
| 2ecb2d9ba1 | |||
| 03b32ec29c | |||
| 2212222c47 | |||
| 8247e56bef | |||
| 8fec1e82ee | |||
| 634702005d | |||
| 7c47b7f8d4 | |||
| 478a376c97 | |||
| 9acd401b9e | |||
| 050c376e87 | |||
| 0624ba6d3f | |||
| 392b9cfeab | |||
| a448a79ae6 | |||
| 2b66b033e0 | |||
| b9604d1baa | |||
| e1a9362448 | |||
| 6fd0118d2c | |||
| 7ad67e50a6 | |||
| 758c9f116f | |||
| dcfee2d9d9 | |||
| 03642a2923 | |||
| 3821a492fc | |||
| bd0751e17e | |||
| 3d3947722f | |||
| b33494eada | |||
| 0e2ada4a91 | |||
| b502c811cb | |||
| 0b674978db | |||
| bf7e2d38f7 | |||
| 6dd9d011aa | |||
| 9bf7c9459d | |||
| e6ec46d7f0 | |||
| 7c41907a7d | |||
| 28f89672d0 | |||
| f3049681bd | |||
| 7bee41f1e2 | |||
| 9d706d6d5c | |||
| 8cf32149b7 | |||
| 110d3719bb | |||
| f3910ba34e | |||
| 06c9a3ac86 | |||
| 8ca8841f9e | |||
| cf6c46ba3a | |||
| 22d1336aa0 | |||
| 1561f22853 | |||
| 5cd3dfce8e | |||
| 709d9738ef | |||
| f432ad350f | |||
| 52f7e52255 | |||
| 99dc796f42 | |||
| 6ba9f24381 | |||
| 2f8b1d5e3e | |||
| d91c540d47 | |||
| d55e1bfb67 | |||
| 5202e846de | |||
| 6abf1ff1aa | |||
| e7050b2083 | |||
| fedf43ca0a | |||
| 4bc513a8e3 | |||
| fe172985bb | |||
| acf5f4ce5e | |||
| 53b3fbfed6 | |||
| ce8867fac9 | |||
| c22d14c5b0 | |||
| eddfb8a1bb | |||
| 7cfdf0ad9c | |||
| 689088c1a8 | |||
| 01faf6ea1e | |||
| f3c2b41f4f | |||
| beb0754faa | |||
| e36e3c0a78 | |||
| 0b33c6473e | |||
| 7e33bd17e0 | |||
| 0f1ffdaee8 | |||
| d59ae44914 | |||
| e26d2e5637 | |||
| d84614866a | |||
| ff50bc2e6f | |||
| 98c9012bdb | |||
| 0375d7f45a | |||
| 17f4d6f064 | |||
| b0ec0cda7f | |||
| 39fabaa344 | |||
| 91b5c3e9c7 | |||
| d34796a78b | |||
| cac6c854d2 | |||
| ea8068652b | |||
| ce2d0389e1 | |||
| dba7c08f59 | |||
| c3456dd5ac | |||
| 6257bcf0f5 | |||
| 8333f14ef8 | |||
| 4f0bf9020b | |||
| d4fc718e8e | |||
| c1d19c4c5c | |||
| ffb8bcd71d | |||
| 5ad53bb32c | |||
| 96fefe94f0 | |||
| f2e5fcc902 | |||
| d97e91bdcb | |||
| f23d9091f2 | |||
| 4b8d786d2a | |||
| 7ebce683c6 | |||
| e4bf73b41c | |||
| f0398f2331 | |||
| 48c693d756 | |||
| da986b6a6c | |||
| fff5d5158f | |||
| bb15389b66 | |||
| 685df18a3a | |||
| 3f9ee08e76 | |||
| 59a06acc0b | |||
| 699e780e99 | |||
| 6ae684d609 | |||
| 54fc9efdcb | |||
| 9f7b804a6c | |||
| d5654cf0df | |||
| 43b41e9ed9 | |||
| 298a963148 | |||
| a1dc2cfc2d | |||
| 24c9f11cc9 | |||
| 29566d55c6 | |||
| 5bba4cd9f7 | |||
| 5d9e20afa4 | |||
| 15144514bb | |||
| c1e226d6a3 | |||
| 3bf31e440d | |||
| ae95c04bbc | |||
| 52b649dca5 | |||
| 80859b0a9f | |||
| 3c9793d803 | |||
| 6157a75868 | |||
| 5291924bcc | |||
| 9a93694a4c | |||
| 31f7d6669f | |||
| 7145136cd9 | |||
| 2b53655934 | |||
| 8dc3afbcce | |||
| 2790e5d12b | |||
| 5b0f5727dc | |||
| a2ddd10d31 | |||
| 279ebc0958 | |||
| 2bfc73afaa | |||
| fab3b4564e | |||
| fe0d3cad36 | |||
| d69335f08d | |||
| 0238061fa2 | |||
| 9655fa8898 | |||
| 916c5caa3a | |||
| 28141e315e | |||
| 47621bd3b2 | |||
| 7aba839dac | |||
| 2e2ff3a1d0 | |||
| 61fa393e03 | |||
| 4a7e5b74c6 | |||
| 1d0cd16cd1 | |||
| 465bb14659 | |||
| 887b5ea007 | |||
| 21990cf986 | |||
| 3456b2db3c | |||
| 8898f81fc3 | |||
| de8198084c | |||
| 0c24843e52 | |||
| 5240d9989f | |||
| dd120663b7 | |||
| a40d05f6ee | |||
| 15d8a6cada | |||
| 892ff0c51f | |||
| 3382a542b3 | |||
| 1902a0c553 | |||
| 20590f590e | |||
| a6bf7f876d | |||
| 8660670ae3 | |||
| ff899e9c1b | |||
| 062adae714 | |||
| 106c6c3958 | |||
| 6304bac233 | |||
| 2bf5163798 | |||
| 26c63edf33 | |||
| d6b85cf7e8 | |||
| 3ae9c10ff5 | |||
| 161ed69ef0 | |||
| 75229808de | |||
| 517c5022d3 | |||
| 80e736d4ee | |||
| 58228f7ff7 | |||
| 4a6f05ae4e | |||
| ad62f896bc | |||
| d310fb366f | |||
| 4e12882478 | |||
| 486baa393b | |||
| 2ba63e608f | |||
| 8f980a0f20 | |||
| bd8ec81b1e | |||
| 11a702a2a6 | |||
| 7d147dd2ce | |||
| fee835f899 | |||
| 9ecb03e470 | |||
| 19e2cab920 | |||
| 0c2a5f273c | |||
| 45eec6a8ff | |||
| 281a28bb0e | |||
| 568fcf441e | |||
| bee1efed5c | |||
| 829bfa0a10 | |||
| c6729e9df1 | |||
| 62729c42ee | |||
| 77bf3e4d74 | |||
| d89a7eb522 | |||
| 41f18ee6a2 | |||
| ef0c62f532 | |||
| 372393d9ca | |||
| 2bdc077d2a | |||
| 68b05a5d8d | |||
| 5b58751a14 | |||
| beaeac4425 | |||
| 9fe1be7fe0 | |||
| d509195aab | |||
| 8af55a04d8 | |||
| b76ab87a96 | |||
| 57b0151cd2 | |||
| 1b403d2920 | |||
| 9331b3beed | |||
| d6ae5a1778 | |||
| 0dfd3597fb | |||
| 8e11ca58e5 | |||
| ad3782753b | |||
| 0a21ef4a18 | |||
| 081e3a459f | |||
| 280a73e7fd | |||
| fbd6364f78 | |||
| 07a8a35e48 | |||
| 0c067b55ba | |||
| 716a78a774 | |||
| ae1757aa4a | |||
| 192f8841bb | |||
| 8394852f07 | |||
| cea04758a5 | |||
| 9b2468a484 | |||
| 5421dddec6 | |||
| 9e1b975773 | |||
| 7b32560ce2 | |||
| 28d4ea0456 | |||
| 01e0e886e6 | |||
| aae5ebc810 | |||
| ebaa344164 | |||
| caf0dec598 | |||
| 5f2bd9edd7 | |||
| 91347f14f2 | |||
| 7eee81cd6a | |||
| 94099358f3 | |||
| 37e4091723 | |||
| 17fc679b25 | |||
| 8c1ec19797 | |||
| 1c09a1352b | |||
| 5ddea28d80 | |||
| fe7f43155a | |||
| 091851ee3d | |||
| cc4fea5e67 | |||
| f170d37479 | |||
| 887e285cce | |||
| 464aed92cb | |||
| eb00623807 | |||
| 60c2829af4 | |||
| a389d57219 | |||
| 11b5fc14dc | |||
| 5005aa0c7c | |||
| 673e8c948f | |||
| 8b7e3c1092 | |||
| a1570a77e0 | |||
| 165dffc15d | |||
| 060ed27a2f | |||
| 885da83df2 | |||
| c9ef846727 | |||
| c14aa3b86f | |||
| 1be0b817de | |||
| 14a73337ce | |||
| 72851486d8 | |||
| ab5043f890 | |||
| e3ebda7d30 | |||
| fd82f3f8a4 | |||
| 3703877ae8 | |||
| 4384c69dcf | |||
| 7838f3741f | |||
| 4c773439d2 | |||
| 77bc42bd45 | |||
| 3852b7212b | |||
| 31690d16ec | |||
| 77a5f4775a | |||
| 587a6552ea | |||
| 2e7e4b3ee4 | |||
| 4fe6db240b | |||
| 2ec4d558ba | |||
| 219a8581fd | |||
| 94449f772c | |||
| 910be149ab | |||
| 68b61d71c6 | |||
| 083562e1aa | |||
| c6e89d33f8 | |||
| 50bc1aac74 | |||
| 4add7b6213 | |||
| 69f79b940b | |||
| 41e1ce4a09 | |||
| 30d4cb81b8 | |||
| 0fe570fc47 | |||
| 04ec1b01be | |||
| fd2d1f2dfc | |||
| 73e0b72479 | |||
| 83ee2d23b3 | |||
| 6511d0e111 | |||
| c96e9acb64 | |||
| b0e7abac60 | |||
| 7952dfc196 | |||
| 32d57892a2 | |||
| d6309ec31c | |||
| 5e25d3634c | |||
| 467e30aeb1 | |||
| 591aba3faf | |||
| 4e971b085e | |||
| b7976cac68 | |||
| 2966cdb033 | |||
| 595cf71d93 | |||
| 5e1701f8db | |||
| 82bce082ef | |||
| 8a3b395613 | |||
| 225aca016b | |||
| a3c48df25b |
+1
-1
@@ -1,2 +1,2 @@
|
||||
[docs]
|
||||
title = The Guide to Atom
|
||||
title = The Guide to Atom
|
||||
|
||||
+3
-5
@@ -1,12 +1,10 @@
|
||||
*.swp
|
||||
.DS_Store
|
||||
.project
|
||||
.svn
|
||||
.nvm-version
|
||||
atom-build
|
||||
atom.xcodeproj
|
||||
build
|
||||
.xcodebuild-info
|
||||
node_modules
|
||||
npm-debug.log
|
||||
/tags
|
||||
/cef/
|
||||
/atom-shell/
|
||||
docs/api
|
||||
|
||||
+9
-72
@@ -1,72 +1,9 @@
|
||||
[submodule "vendor/packages/text.tmbundle"]
|
||||
path = vendor/packages/text.tmbundle
|
||||
url = https://github.com/textmate/text.tmbundle.git
|
||||
[submodule "vendor/packages/css.tmbundle"]
|
||||
path = vendor/packages/css.tmbundle
|
||||
url = https://github.com/textmate/css.tmbundle.git
|
||||
[submodule "vendor/packages/html.tmbundle"]
|
||||
path = vendor/packages/html.tmbundle
|
||||
url = https://github.com/textmate/html.tmbundle.git
|
||||
[submodule "vendor/packages/javascript.tmbundle"]
|
||||
path = vendor/packages/javascript.tmbundle
|
||||
url = https://github.com/textmate/javascript.tmbundle.git
|
||||
[submodule "vendor/packages/ruby-on-rails-tmbundle"]
|
||||
path = vendor/packages/ruby-on-rails-tmbundle
|
||||
url = https://github.com/drnic/ruby-on-rails-tmbundle.git
|
||||
[submodule "vendor/packages/ruby.tmbundle"]
|
||||
path = vendor/packages/ruby.tmbundle
|
||||
url = https://github.com/textmate/ruby.tmbundle.git
|
||||
[submodule "vendor/packages/coffee-script-tmbundle"]
|
||||
path = vendor/packages/coffee-script-tmbundle
|
||||
url = https://github.com/kevinsawicki/coffee-script-tmbundle.git
|
||||
[submodule "vendor/packages/puppet-textmate.tmbundle"]
|
||||
path = vendor/packages/puppet-textmate.tmbundle
|
||||
url = https://github.com/cburyta/puppet-textmate.tmbundle.git
|
||||
[submodule "vendor/packages/c.tmbundle"]
|
||||
path = vendor/packages/c.tmbundle
|
||||
url = https://github.com/textmate/c.tmbundle.git
|
||||
[submodule "vendor/packages/objective-c.tmbundle"]
|
||||
path = vendor/packages/objective-c.tmbundle
|
||||
url = https://github.com/textmate/objective-c.tmbundle.git
|
||||
[submodule "vendor/packages/git.tmbundle"]
|
||||
path = vendor/packages/git.tmbundle
|
||||
url = https://github.com/kevinsawicki/git.tmbundle.git
|
||||
[submodule "vendor/packages/json.tmbundle"]
|
||||
path = vendor/packages/json.tmbundle
|
||||
url = https://github.com/textmate/json.tmbundle.git
|
||||
[submodule "vendor/packages/shellscript.tmbundle"]
|
||||
path = vendor/packages/shellscript.tmbundle
|
||||
url = https://github.com/textmate/shellscript.tmbundle
|
||||
[submodule "vendor/packages/xml.tmbundle"]
|
||||
path = vendor/packages/xml.tmbundle
|
||||
url = https://github.com/textmate/xml.tmbundle.git
|
||||
[submodule "vendor/packages/property-list.tmbundle"]
|
||||
path = vendor/packages/property-list.tmbundle
|
||||
url = https://github.com/textmate/property-list.tmbundle.git
|
||||
[submodule "vendor/packages/python.tmbundle"]
|
||||
path = vendor/packages/python.tmbundle
|
||||
url = https://github.com/textmate/python.tmbundle
|
||||
[submodule "vendor/packages/clojure.tmbundle"]
|
||||
path = vendor/packages/clojure.tmbundle
|
||||
url = https://github.com/mmcgrana/textmate-clojure
|
||||
[submodule "prebuilt-cef"]
|
||||
path = prebuilt-cef
|
||||
url = git@github.com:github/prebuilt-cef.git
|
||||
[submodule "vendor/packages/yaml.tmbundle"]
|
||||
path = vendor/packages/yaml.tmbundle
|
||||
url = https://github.com/textmate/yaml.tmbundle.git
|
||||
[submodule "vendor/packages/java.tmbundle"]
|
||||
path = vendor/packages/java.tmbundle
|
||||
url = https://github.com/textmate/java.tmbundle.git
|
||||
[submodule "vendor/packages/php.tmbundle"]
|
||||
path = vendor/packages/php.tmbundle
|
||||
url = https://github.com/textmate/php.tmbundle.git
|
||||
[submodule "vendor/packages/perl.tmbundle"]
|
||||
path = vendor/packages/perl.tmbundle
|
||||
url = https://github.com/textmate/perl.tmbundle.git
|
||||
[submodule "vendor/packages/sass.tmbundle"]
|
||||
path = vendor/packages/sass.tmbundle
|
||||
url = https://github.com/alexsancho/SASS.tmbundle.git
|
||||
[submodule "vendor/packages/less.tmbundle"]
|
||||
path = vendor/packages/less.tmbundle
|
||||
url = https://github.com/mathewbyrne/less.tmbundle.git
|
||||
[submodule "vendor/bootstrap"]
|
||||
path = vendor/bootstrap
|
||||
url = https://github.com/twbs/bootstrap
|
||||
[submodule "vendor/apm"]
|
||||
path = vendor/apm
|
||||
url = https://github.com/github/apm.git
|
||||
[submodule "vendor/telepath"]
|
||||
path = vendor/telepath
|
||||
url = https://github.com/github/telepath.git
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
tags
|
||||
node_modules
|
||||
docs/api
|
||||
.git
|
||||
+4
-1
@@ -6,7 +6,10 @@ pairs:
|
||||
jc: Jerry Cheung; jerry
|
||||
bl: Brian Lopez; brian
|
||||
jp: Justin Palmer; justin
|
||||
gt: Garen Torikian; garen
|
||||
mc: Matt Colyer; mcolyer
|
||||
jr: Jason Rudolph; jasonrudolph
|
||||
jl: Jessica Lord; jlord
|
||||
email:
|
||||
domain: github.com
|
||||
#global: true
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
* Added: Terminal package now bundled by default, open with ctrl-`
|
||||
* Fixed: Fuzzy finder not showing results for files at a certain depth
|
||||
* Fixed: Atom > Preferences... menu not opening settings in focused window
|
||||
|
||||
* Fixed: Atom failing to launch if the theme being used was not found
|
||||
|
||||
* Improved: Theme changes now immediately take effect
|
||||
* Fixed: Wrap in quotes/parens now works in split panes
|
||||
* Improved: Autocomplete now includes CSS property names and values
|
||||
* Improved: Settings GUI is now a pane item
|
||||
* Added: Support package filtering in Settings GUI
|
||||
* Added: Dynamically load all config options in the Settings GUI
|
||||
* Added: Ability to bookmark lines and navigate bookmarks
|
||||
* Fixed: Error when inserting newlines in CSS
|
||||
* Fixed: Folding all will fold comments as well
|
||||
* Added: Ability to fold all code at a given indentation level
|
||||
|
||||
* Improved: cmd-n now opens a new tab and cmd-shift-n now opens a new window.
|
||||
* Added: Inspect Element context menu
|
||||
* Fixed: Save As dialog now defaults to directory path of current editor
|
||||
* Fixed: Using toggle comment shortcut respects indentation level
|
||||
|
||||
* Fixed: Search never completing in the command panel
|
||||
|
||||
* Fixed: cmd-n now works when no windows are open
|
||||
|
||||
* Fixed: Error selecting a grammar for an untitled editor
|
||||
|
||||
* Added: j/k now can be used to navigate the tree view and archive editor
|
||||
|
||||
* Fixed: Atom can now be launched when ~/.atom/config.cson doesn't exist
|
||||
* Added: Initial collaboration sessions
|
||||
* Fixed: Empty lines being deleted via uppercase/downcase command
|
||||
* Fixed: Keybindings not working when using non-English keyboard language
|
||||
* Fixed: cmd-shift-p and cmd-alt-w not doing anything when pressed
|
||||
|
||||
* Improved: Use grunt (instead of rake) for build system
|
||||
* Fixed: Java files not syntax highlighting correctly.
|
||||
* Fixed: LESS/CSS now indents properly after hitting enter.
|
||||
* Added: Support for browsing .tar.gz and .zip files in the editor
|
||||
* Added: TODO/FIXME/CHANGED are now highlighted in comments.
|
||||
* Fixed: Full screen state of windows is now persisted across restarts.
|
||||
* Added: Makefile syntax highlighting now included.
|
||||
* Added: Open fuzzy finder to specific line using colon suffix (i.e ':25')
|
||||
* Fixed: Issues deleting and moving over certain UTF-8 characters
|
||||
* Fixed: Tree view not properly highlighting or revealing for open images.
|
||||
* Added: Packages can now be installed from the configuration UI.
|
||||
* Fixed: .git folder now ignored by default when searching
|
||||
|
||||
* Fixed: Not being able to disable packages from configuration UI.
|
||||
* Fixed: Fuzzy finder showing poor results for entered text
|
||||
* Improved: App icon
|
||||
|
||||
* Fixed: Fuzzy finder being empty sometimes
|
||||
|
||||
* Improved: App icon
|
||||
* Fixed: End of line invisibles rendering incorrectly with the indent guide
|
||||
* Fixed: Updates not installing automatically on restart
|
||||
* Fixed: Wrap guide not displaying
|
||||
* Fixed: Error when saving with the markdown preview focused
|
||||
|
||||
* Fixed: Atom always running in dev mode
|
||||
* Fixed: Crash when running in dev mode without a path to the Atom source
|
||||
|
||||
* Fixed: Freeze when editing a RoR class
|
||||
* Added: meta-N to open a new untitled editor in the current window
|
||||
|
||||
* Fixed: Styling in command logger
|
||||
* Added: XML and Ruby syntax highlighting in Markdown files
|
||||
* Fixed: Error when editing files in a HEAD-less Git repository
|
||||
|
||||
* Fixed: Invisible characters not being visible when enabled
|
||||
* Added: Editor gutter now displays Git status for lines
|
||||
|
||||
* Improved: Startup time
|
||||
* Added: SQL bundle now included
|
||||
* Added: PEG.js bundle now included
|
||||
* Added: Hyperlinks can now be opened with ctrl-O
|
||||
* Fixed: PHP syntax highlighting
|
||||
+39
-1
@@ -1,5 +1,6 @@
|
||||
# :rotating_light: Contributing to Atom :rotating_light:
|
||||
|
||||
|
||||
## Issues
|
||||
* Include screenshots and animated GIFs whenever possible, they are immensely
|
||||
helpful
|
||||
@@ -18,6 +19,43 @@
|
||||
* Style new elements in both the light and dark default themes when
|
||||
appropriate
|
||||
* New packages go in `src/packages/`
|
||||
* Add 3rd-party packages by submoduling in `vendor/packages/`
|
||||
* Add 3rd-party packages as a `package.json` dependency
|
||||
* Commit messages are in the present tense
|
||||
* Files end with a newline
|
||||
* Class variables and methods should be in the following order:
|
||||
* Class variables (variables starting with a `@`)
|
||||
* Class methods (methods starting with a `@`)
|
||||
* Instance variables
|
||||
* Instance methods
|
||||
|
||||
## Philosophy
|
||||
|
||||
### Write Beautiful Code
|
||||
Once you get something working, take the time to consider whether you can achieve it in a more elegant way. We're planning on open-sourcing Atom, so let's put our best foot forward.
|
||||
|
||||
### When in doubt, pair-up
|
||||
Pairing can be an effective and fun way to pass on culture, knowledge, and taste. If you can find the time, we encourage you to work synchronously with other community members of all experience levels to help the knowledge-mulching process. It doesn't have to be all the time; a little pairing goes a long way.
|
||||
|
||||
### Write tests, and write them first
|
||||
The test suite keeps protects our codebase from the ravages of entropy, but it only works when we have thorough coverage. Before you write implementation code, write a failing test proving that it's needed.
|
||||
|
||||
### Leave the test suite better than you found it
|
||||
Consider how the specs you are adding fit into the spec-file as a whole. Is this the right place for your spec? Does the spec need to be reorganized now that you're adding this extra dimension? Specs are only as useful as the next person's ability to understand them.
|
||||
|
||||
### Solve today's problem
|
||||
Avoid adding flexibility that isn't needed *today*. Nothing is ever set in stone, and we can always go back and add flexibility later. Adding it early just means we have to pay for complexity that we might not end up using.
|
||||
|
||||
### Favor clarity over brevity or cleverness.
|
||||
Three lines that someone else can read are better than one line that's tricky.
|
||||
|
||||
### Don't be defensive
|
||||
Only catch exceptions that are truly exceptional. Assume that components we control will honor their contracts. If they don't, the solution is to find and fix the problem in code rather than cluttering the code with attempts to foresee all potential issues at runtime.
|
||||
|
||||
### Don't be afraid to add classes and methods
|
||||
Code rarely suffers from too many methods and classes, and often suffers from too few. Err on the side of numerous short, well-named methods. Pull out classes with well-defined roles.
|
||||
|
||||
### Rip shit out
|
||||
Don't be afraid to delete code. Don't be afraid to rewrite something that needs to be refreshed. If it's in version control, we can always resurrect it.
|
||||
|
||||
### Maintain a consistent level of abstraction
|
||||
Every line in a method should read at the same basic level of abstraction. If there's a section of a method that goes into a lot more detail than the rest of the method, consider extracting a new method and giving it a clear name.
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
path = require 'path'
|
||||
|
||||
module.exports = (grunt) ->
|
||||
appName = 'Atom.app'
|
||||
buildDir = grunt.option('build-dir') ? '/tmp/atom-build'
|
||||
shellAppDir = path.join(buildDir, appName)
|
||||
contentsDir = path.join(shellAppDir, 'Contents')
|
||||
appDir = path.join(contentsDir, 'Resources', 'app')
|
||||
installDir = path.join('/Applications', appName)
|
||||
|
||||
grunt.initConfig
|
||||
pkg: grunt.file.readJSON('package.json')
|
||||
|
||||
atom: {appDir, appName, buildDir, contentsDir, installDir, shellAppDir}
|
||||
|
||||
coffee:
|
||||
options:
|
||||
sourceMap: true
|
||||
glob_to_multiple:
|
||||
expand: true
|
||||
src: [
|
||||
'src/**/*.coffee'
|
||||
'static/**/*.coffee'
|
||||
]
|
||||
dest: appDir
|
||||
ext: '.js'
|
||||
|
||||
less:
|
||||
options:
|
||||
paths: [
|
||||
'static'
|
||||
'vendor'
|
||||
]
|
||||
glob_to_multiple:
|
||||
expand: true
|
||||
src: [
|
||||
'src/**/*.less'
|
||||
'static/**/*.less'
|
||||
'themes/**/*.less'
|
||||
]
|
||||
dest: appDir
|
||||
ext: '.css'
|
||||
|
||||
cson:
|
||||
options:
|
||||
rootObject: true
|
||||
glob_to_multiple:
|
||||
expand: true
|
||||
src: [
|
||||
'src/**/*.cson'
|
||||
'static/**/*.cson'
|
||||
'themes/**/*.cson'
|
||||
]
|
||||
dest: appDir
|
||||
ext: '.json'
|
||||
|
||||
coffeelint:
|
||||
options:
|
||||
no_empty_param_list:
|
||||
level: 'error'
|
||||
max_line_length:
|
||||
level: 'ignore'
|
||||
src: [
|
||||
'dot-atom/**/*.coffee'
|
||||
'src/**/*.coffee'
|
||||
]
|
||||
test: [
|
||||
'spec/*.coffee'
|
||||
'spec/app/**/*.coffee'
|
||||
'spec/stdlib/**/*.coffee'
|
||||
]
|
||||
|
||||
csslint:
|
||||
options:
|
||||
'adjoining-classes': false
|
||||
'box-model': false
|
||||
'box-sizing': false
|
||||
'bulletproof-font-face': false
|
||||
'compatible-vendor-prefixes': false
|
||||
'display-property-grouping': false
|
||||
'fallback-colors': false
|
||||
'font-sizes': false
|
||||
'gradients': false
|
||||
'ids': false
|
||||
'important': false
|
||||
'known-properties': false
|
||||
'outline-none': false
|
||||
'overqualified-elements': false
|
||||
'qualified-headings': false
|
||||
'unique-headings': false
|
||||
'universal-selector': false
|
||||
'vendor-prefix': false
|
||||
src: [
|
||||
'src/**/*.css',
|
||||
'static/**/*.css'
|
||||
'themes/**/*.css'
|
||||
]
|
||||
|
||||
lesslint:
|
||||
src: [
|
||||
'src/**/*.less',
|
||||
'static/**/*.less'
|
||||
'themes/**/*.less'
|
||||
]
|
||||
|
||||
grunt.loadNpmTasks('grunt-coffeelint')
|
||||
grunt.loadNpmTasks('grunt-lesslint')
|
||||
grunt.loadNpmTasks('grunt-cson')
|
||||
grunt.loadNpmTasks('grunt-contrib-csslint')
|
||||
grunt.loadNpmTasks('grunt-contrib-coffee')
|
||||
grunt.loadNpmTasks('grunt-contrib-less')
|
||||
grunt.loadTasks('tasks')
|
||||
|
||||
grunt.registerTask('compile', ['coffee', 'less', 'cson'])
|
||||
grunt.registerTask('lint', ['coffeelint', 'csslint', 'lesslint'])
|
||||
grunt.registerTask('ci', ['lint', 'partial-clean', 'update-atom-shell', 'build', 'set-development-version', 'test'])
|
||||
grunt.registerTask('deploy', ['partial-clean', 'update-atom-shell', 'build', 'codesign'])
|
||||
grunt.registerTask('default', ['update-atom-shell', 'build', 'set-development-version', 'install'])
|
||||
+15
-8
@@ -1,19 +1,26 @@
|
||||
# Atom — Futuristic Text Editing
|
||||
|
||||

|
||||

|
||||
|
||||
Check out our [documentation on the docs tab](https://github.com/github/atom/docs).
|
||||
|
||||
## Building from source
|
||||
## Installing
|
||||
|
||||
Requirements
|
||||
Download the latest Atom release from [speakeasy](https://speakeasy.githubapp.com/apps/27).
|
||||
|
||||
**Mountain Lion**
|
||||
It will automatically update when a new release is available.
|
||||
|
||||
**The Setup™**
|
||||
## Building
|
||||
|
||||
**Xcode** (Get Xcode from the App Store (ugh, I know))
|
||||
### Requirements
|
||||
|
||||
1. gh-setup atom
|
||||
* Mountain Lion
|
||||
* Boxen (Obviously Atom won't release with this requirement)
|
||||
|
||||
2. cd ~/github/atom && `rake install`
|
||||
### Installation
|
||||
|
||||
1. `gh-setup atom`
|
||||
|
||||
2. `cd ~/github/atom`
|
||||
|
||||
3. `script/build`
|
||||
|
||||
+9
-126
@@ -1,128 +1,11 @@
|
||||
ATOM_SRC_PATH = File.dirname(__FILE__)
|
||||
BUILD_DIR = 'atom-build'
|
||||
rule "" do |t|
|
||||
puts <<-HELP
|
||||
Atom now uses grunt instead of Rake.
|
||||
See https://github.com/github/atom/pull/596 for more info.
|
||||
|
||||
desc "Build Atom via `xcodebuild`"
|
||||
task :build => "create-xcode-project" do
|
||||
command = "xcodebuild -target Atom -configuration Release SYMROOT=#{BUILD_DIR}"
|
||||
output = `#{command}`
|
||||
if $?.exitstatus != 0
|
||||
$stderr.puts "Error #{$?.exitstatus}:\n#{output}"
|
||||
exit($?.exitstatus)
|
||||
end
|
||||
end
|
||||
|
||||
desc "Create xcode project from gyp file"
|
||||
task "create-xcode-project" => "update-cef" do
|
||||
`rm -rf atom.xcodeproj`
|
||||
`gyp --depth=. -D CODE_SIGN="#{ENV['CODE_SIGN']}" atom.gyp`
|
||||
end
|
||||
|
||||
desc "Update CEF to the latest version specified by the prebuilt-cef submodule"
|
||||
task "update-cef" => "bootstrap" do
|
||||
exit 1 unless system %{prebuilt-cef/script/download -f cef}
|
||||
Dir.glob('cef/*.gypi').each do |filename|
|
||||
`sed -i '' -e "s/'include\\//'cef\\/include\\//" -e "s/'libcef_dll\\//'cef\\/libcef_dll\\//" #{filename}`
|
||||
end
|
||||
end
|
||||
|
||||
desc "Download debug symbols for CEF"
|
||||
task "download-cef-symbols" => "update-cef" do
|
||||
sh %{prebuilt-cef/script/download -s cef}
|
||||
end
|
||||
|
||||
task "bootstrap" do
|
||||
`script/bootstrap`
|
||||
end
|
||||
|
||||
desc "Copies Atom.app to /Applications and creates `atom` cli app"
|
||||
task :install => [:clean, :build] do
|
||||
path = application_path()
|
||||
exit 1 if not path
|
||||
|
||||
# Install Atom.app
|
||||
dest_path = "/Applications/#{File.basename(path)}"
|
||||
`rm -rf #{dest_path}`
|
||||
`cp -r #{path} #{File.expand_path(dest_path)}`
|
||||
|
||||
# Install atom cli
|
||||
if File.directory?("/opt/boxen")
|
||||
cli_path = "/opt/boxen/bin/atom"
|
||||
else
|
||||
cli_path = "/opt/github/bin/atom"
|
||||
end
|
||||
|
||||
FileUtils.cp("#{ATOM_SRC_PATH}/atom.sh", cli_path)
|
||||
FileUtils.chmod(0755, cli_path)
|
||||
|
||||
Rake::Task["clone-default-bundles"].invoke()
|
||||
|
||||
puts "\033[32mAtom is installed at `#{dest_path}`. Atom cli is installed at `#{cli_path}`\033[0m"
|
||||
end
|
||||
|
||||
desc "Package up the app for speakeasy"
|
||||
task :package => ["setup-codesigning", "build"] do
|
||||
path = application_path()
|
||||
exit 1 if not path
|
||||
|
||||
dest_path = '/tmp/atom-for-speakeasy/Atom.tar.bz2'
|
||||
`mkdir -p $(dirname #{dest_path})`
|
||||
`rm -rf #{dest_path}`
|
||||
`tar --directory $(dirname #{path}) -jcf #{dest_path} $(basename #{path})`
|
||||
`open $(dirname #{dest_path})`
|
||||
end
|
||||
|
||||
task "setup-codesigning" do
|
||||
ENV['CODE_SIGN'] = "Developer ID Application: GitHub"
|
||||
end
|
||||
|
||||
desc "Clone default bundles into vendor/bundles directory"
|
||||
task "clone-default-bundles" do
|
||||
`git submodule --quiet sync`
|
||||
`git submodule --quiet update --recursive --init`
|
||||
end
|
||||
|
||||
desc "Clean build Atom via `xcodebuild`"
|
||||
task :clean do
|
||||
output = `xcodebuild clean`
|
||||
`rm -rf #{application_path()}`
|
||||
`rm -rf #{BUILD_DIR}`
|
||||
`rm -rf /tmp/atom-compiled-scripts`
|
||||
end
|
||||
|
||||
desc "Run the specs"
|
||||
task :test => ["update-cef", "clone-default-bundles", "build"] do
|
||||
`pkill Atom`
|
||||
if path = application_path()
|
||||
cmd = "#{path}/Contents/MacOS/Atom --test --resource-path=#{ATOM_SRC_PATH} 2> /dev/null"
|
||||
system(cmd)
|
||||
exit($?.exitstatus)
|
||||
else
|
||||
exit(1)
|
||||
end
|
||||
end
|
||||
|
||||
desc "Run the benchmarks"
|
||||
task :benchmark do
|
||||
Rake::Task["run"].invoke("--benchmark")
|
||||
end
|
||||
|
||||
task :nof do
|
||||
system %{find . -name *spec.coffee | grep --invert-match --regexp "#{BUILD_DIR}\\|##package-name##" | xargs sed -E -i "" "s/f+(it|describe) +(['\\"])/\\1 \\2/g"}
|
||||
end
|
||||
|
||||
task :tags do
|
||||
system %{find src native cef vendor -not -name "*spec.coffee" -type f -print0 | xargs -0 ctags}
|
||||
end
|
||||
|
||||
def application_path
|
||||
applications = FileList["#{BUILD_DIR}/**/Atom.app"]
|
||||
if applications.size == 0
|
||||
$stderr.puts "No Atom application found in directory `#{BUILD_DIR}`"
|
||||
elsif applications.size > 1
|
||||
$stderr.puts "Multiple Atom applications found \n\t" + applications.join("\n\t")
|
||||
else
|
||||
return applications.first
|
||||
end
|
||||
|
||||
return nil
|
||||
tl;dr
|
||||
-----
|
||||
Run ./script/build instead of rake install.
|
||||
|
||||
HELP
|
||||
end
|
||||
|
||||
Arquivo executável
+2
@@ -0,0 +1,2 @@
|
||||
coffee -c -o /Applications/Atom.app/Contents/Resources/app/src/ src/main.coffee src/atom-application.coffee src/atom-window.coffee &&
|
||||
/Applications/Atom.app/Contents/MacOS/Atom --resource-path=$(pwd) --executed-from=$(pwd) $@
|
||||
+6
-361
@@ -1,369 +1,14 @@
|
||||
{
|
||||
'variables': {
|
||||
'pkg-config': 'pkg-config',
|
||||
'chromium_code': 1,
|
||||
'use_aura%': 0,
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
'os_posix': 0,
|
||||
}, {
|
||||
'os_posix': 1,
|
||||
}],
|
||||
# Set toolkit_uses_gtk for the Chromium browser on Linux.
|
||||
['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_aura==0', {
|
||||
'toolkit_uses_gtk%': 1,
|
||||
}, {
|
||||
'toolkit_uses_gtk%': 0,
|
||||
}],
|
||||
],
|
||||
},
|
||||
'includes': [
|
||||
'cef/cef_paths2.gypi',
|
||||
'git2/libgit2.gypi',
|
||||
],
|
||||
'target_defaults': {
|
||||
'default_configuration': 'Debug',
|
||||
'configurations': {
|
||||
'Debug': {
|
||||
'defines': ['DEBUG=1'],
|
||||
'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL' : '0' },
|
||||
},
|
||||
'Release': {
|
||||
},
|
||||
},
|
||||
'xcode_settings': {
|
||||
'CLANG_CXX_LANGUAGE_STANDARD' : 'c++0x',
|
||||
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
|
||||
'COMBINE_HIDPI_IMAGES': 'YES', # Removes 'Validate Project Settings' warning
|
||||
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES' # Removes 'Reference to global weak symbol vtable' warning
|
||||
},
|
||||
},
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'Atom',
|
||||
'type': 'executable',
|
||||
'mac_bundle': 1,
|
||||
'msvs_guid': 'D22C6F51-AA2D-457C-B579-6C97A96C724D',
|
||||
'dependencies': [
|
||||
'libcef_dll_wrapper',
|
||||
],
|
||||
'defines': [
|
||||
'USING_CEF_SHARED',
|
||||
],
|
||||
'include_dirs': [ '.', 'cef', 'git2' ],
|
||||
'mac_framework_dirs': [ 'native/frameworks' ],
|
||||
'libraries': [ 'native/frameworks/CocoaOniguruma.framework', 'native/frameworks/Sparkle.framework'],
|
||||
'sources': [
|
||||
'<@(includes_common)',
|
||||
'<@(includes_wrapper)',
|
||||
'native/main_mac.mm',
|
||||
'native/atom_application.h',
|
||||
'native/atom_application.mm',
|
||||
'native/atom_cef_app.h',
|
||||
'native/atom_window_controller.h',
|
||||
'native/atom_window_controller.mm',
|
||||
'native/atom_cef_client_mac.mm',
|
||||
'native/atom_cef_client.cpp',
|
||||
'native/atom_cef_client.h',
|
||||
'native/message_translation.cpp',
|
||||
'native/message_translation.h',
|
||||
],
|
||||
'mac_bundle_resources': [
|
||||
'native/mac/atom.icns',
|
||||
'native/mac/file.icns',
|
||||
'native/mac/speakeasy.pem',
|
||||
'native/mac/English.lproj/MainMenu.xib',
|
||||
'native/mac/English.lproj/AtomWindow.xib',
|
||||
],
|
||||
'xcode_settings': {
|
||||
'INFOPLIST_FILE': 'native/mac/info.plist',
|
||||
'OTHER_LDFLAGS': ['-Wl,-headerpad_max_install_names'], # Necessary to avoid an "install_name_tool: changing install names or rpaths can't be redone" error.
|
||||
},
|
||||
'conditions': [
|
||||
['CODE_SIGN' , {
|
||||
'xcode_settings': {'CODE_SIGN_IDENTITY': "<(CODE_SIGN)"},
|
||||
}],
|
||||
['OS=="win" and win_use_allocator_shim==1', {
|
||||
'dependencies': [
|
||||
'<(DEPTH)/base/allocator/allocator.gyp:allocator',
|
||||
],
|
||||
}],
|
||||
['OS=="win"', {
|
||||
'configurations': {
|
||||
'Debug_Base': {
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
# Set /SUBSYSTEM:WINDOWS.
|
||||
'SubSystem': '2',
|
||||
'EntryPointSymbol' : 'wWinMainCRTStartup',
|
||||
},
|
||||
},
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
'-lcomctl32.lib',
|
||||
'-lshlwapi.lib',
|
||||
'-lrpcrt4.lib',
|
||||
],
|
||||
},
|
||||
'sources': [
|
||||
'<@(includes_win)',
|
||||
],
|
||||
}],
|
||||
['OS == "win" or (toolkit_uses_gtk == 1 and selinux == 0)', {
|
||||
'dependencies': [
|
||||
'<(DEPTH)/sandbox/sandbox.gyp:sandbox',
|
||||
],
|
||||
}],
|
||||
['toolkit_uses_gtk == 1', {
|
||||
'dependencies': [
|
||||
'<(DEPTH)/build/linux/system.gyp:gtk',
|
||||
],
|
||||
}],
|
||||
[ 'OS=="mac"', {
|
||||
'product_name': 'Atom',
|
||||
'dependencies': [
|
||||
'AtomHelperApp',
|
||||
],
|
||||
'copies': [
|
||||
{
|
||||
'destination': '<(PRODUCT_DIR)/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/',
|
||||
'files': [
|
||||
'cef/Release/libcef.dylib',
|
||||
'cef/Release/ffmpegsumo.so',
|
||||
],
|
||||
},
|
||||
{
|
||||
'destination': '<(PRODUCT_DIR)/Atom.app/Contents/Frameworks',
|
||||
'files': [
|
||||
'native/frameworks/CocoaOniguruma.framework',
|
||||
'native/frameworks/Sparkle.framework',
|
||||
],
|
||||
},
|
||||
{
|
||||
'destination': '<(PRODUCT_DIR)/Atom.app/Contents/Frameworks/libgit2.framework/Libraries',
|
||||
'files': [
|
||||
'git2/frameworks/libgit2.0.17.0.dylib',
|
||||
],
|
||||
},
|
||||
],
|
||||
'postbuilds': [
|
||||
{
|
||||
'postbuild_name': 'Copy and Compile Static Files',
|
||||
'action': [
|
||||
'script/copy-files-to-bundle'
|
||||
],
|
||||
},
|
||||
{
|
||||
'postbuild_name': 'Copy Helper App',
|
||||
'action': [
|
||||
'cp',
|
||||
'-r',
|
||||
'${BUILT_PRODUCTS_DIR}/Atom Helper.app',
|
||||
'${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks',
|
||||
],
|
||||
},
|
||||
{
|
||||
'postbuild_name': 'Fix Framework Link',
|
||||
'action': [
|
||||
'install_name_tool',
|
||||
'-change',
|
||||
'@executable_path/libcef.dylib',
|
||||
'@executable_path/../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib',
|
||||
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
|
||||
],
|
||||
},
|
||||
{
|
||||
'postbuild_name': 'Copy Framework Resources Directory',
|
||||
'action': [
|
||||
'cp',
|
||||
'-r',
|
||||
'cef/Resources',
|
||||
'${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/'
|
||||
],
|
||||
},
|
||||
{
|
||||
# This postbuid step is responsible for creating the following
|
||||
# helpers:
|
||||
#
|
||||
# Atom Helper EH.app and Atom Helper NP.app are created
|
||||
# from Atom Helper.app.
|
||||
#
|
||||
# The EH helper is marked for an executable heap. The NP helper
|
||||
# is marked for no PIE (ASLR).
|
||||
'postbuild_name': 'Make More Helpers',
|
||||
'action': [
|
||||
'tools/mac/make_more_helpers.sh',
|
||||
'Frameworks',
|
||||
'Atom',
|
||||
],
|
||||
},
|
||||
],
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
|
||||
],
|
||||
},
|
||||
'sources': [
|
||||
'cef/include/cef_application_mac.h',
|
||||
'cef/include/internal/cef_mac.h',
|
||||
'cef/include/internal/cef_types_mac.h',
|
||||
],
|
||||
}],
|
||||
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
|
||||
'sources': [
|
||||
'<@(includes_linux)',
|
||||
],
|
||||
'copies': [
|
||||
{
|
||||
'destination': '<(PRODUCT_DIR)/files',
|
||||
'files': [
|
||||
'<@(cefclient_bundle_resources_linux)',
|
||||
],
|
||||
},
|
||||
],
|
||||
}],
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'libcef_dll_wrapper',
|
||||
'type': 'static_library',
|
||||
'msvs_guid': 'A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9',
|
||||
'dependencies': [
|
||||
],
|
||||
'defines': [
|
||||
'USING_CEF_SHARED',
|
||||
],
|
||||
'include_dirs': [ '.', 'cef' ],
|
||||
'sources': [
|
||||
'<@(includes_common)',
|
||||
'<@(includes_capi)',
|
||||
'<@(includes_wrapper)',
|
||||
'<@(libcef_dll_wrapper_sources_common)',
|
||||
],
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
'cef/Release/libcef.dylib',
|
||||
],
|
||||
}
|
||||
},
|
||||
],
|
||||
'conditions': [
|
||||
['os_posix==1 and OS!="mac" and OS!="android" and gcc_version==46', {
|
||||
'target_defaults': {
|
||||
# Disable warnings about c++0x compatibility, as some names (such
|
||||
# as nullptr) conflict with upcoming c++0x types.
|
||||
'cflags_cc': ['-Wno-c++0x-compat'],
|
||||
},
|
||||
}],
|
||||
['OS=="mac"', {
|
||||
'targets': [
|
||||
'type': 'none',
|
||||
'postbuilds': [
|
||||
{
|
||||
'target_name': 'AtomHelperApp',
|
||||
'type': 'executable',
|
||||
'variables': { 'enable_wexit_time_destructors': 1, },
|
||||
'product_name': 'Atom Helper',
|
||||
'mac_bundle': 1,
|
||||
'dependencies': [
|
||||
'libcef_dll_wrapper',
|
||||
],
|
||||
'defines': [
|
||||
'USING_CEF_SHARED',
|
||||
'PROCESS_HELPER_APP',
|
||||
],
|
||||
'include_dirs': [ '.', 'cef', 'git2' ],
|
||||
'mac_framework_dirs': [ 'native/frameworks' ],
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
|
||||
],
|
||||
},
|
||||
'libraries': [
|
||||
'native/frameworks/CocoaOniguruma.framework',
|
||||
'git2/frameworks/libgit2.0.17.0.dylib',
|
||||
],
|
||||
'sources': [
|
||||
'native/atom_cef_app.h',
|
||||
'native/atom_cef_render_process_handler.h',
|
||||
'native/atom_cef_render_process_handler.mm',
|
||||
'native/message_translation.cpp',
|
||||
'native/message_translation.h',
|
||||
'native/path_watcher.mm',
|
||||
'native/path_watcher.h',
|
||||
'native/main_helper_mac.mm',
|
||||
'native/v8_extensions/native.mm',
|
||||
'native/v8_extensions/native.h',
|
||||
'native/v8_extensions/onig_reg_exp.mm',
|
||||
'native/v8_extensions/onig_reg_exp.h',
|
||||
'native/v8_extensions/onig_scanner.mm',
|
||||
'native/v8_extensions/onig_scanner.h',
|
||||
'native/v8_extensions/atom.mm',
|
||||
'native/v8_extensions/atom.h',
|
||||
'native/v8_extensions/git.mm',
|
||||
'native/v8_extensions/git.h',
|
||||
'native/v8_extensions/readtags.h',
|
||||
'native/v8_extensions/readtags.c',
|
||||
'native/v8_extensions/tags.h',
|
||||
'native/v8_extensions/tags.mm',
|
||||
],
|
||||
# TODO(mark): For now, don't put any resources into this app. Its
|
||||
# resources directory will be a symbolic link to the browser app's
|
||||
# resources directory.
|
||||
'mac_bundle_resources/': [
|
||||
['exclude', '.*'],
|
||||
],
|
||||
'xcode_settings': {
|
||||
'INFOPLIST_FILE': 'native/mac/helper-info.plist',
|
||||
'OTHER_LDFLAGS': ['-Wl,-headerpad_max_install_names'], # Necessary to avoid an "install_name_tool: changing install names or rpaths can't be redone" error.
|
||||
},
|
||||
'copies': [
|
||||
{
|
||||
'destination': '<(PRODUCT_DIR)/Atom Helper.app/Contents/Frameworks',
|
||||
'files': [
|
||||
'native/frameworks/CocoaOniguruma.framework',
|
||||
],
|
||||
},
|
||||
],
|
||||
'postbuilds': [
|
||||
{
|
||||
# The framework defines its load-time path
|
||||
# (DYLIB_INSTALL_NAME_BASE) relative to the main executable
|
||||
# (chrome). A different relative path needs to be used in
|
||||
# atom_helper_app.
|
||||
'postbuild_name': 'Fix CEF Framework Link',
|
||||
'action': [
|
||||
'install_name_tool',
|
||||
'-change',
|
||||
'@executable_path/libcef.dylib',
|
||||
'@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib',
|
||||
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
|
||||
],
|
||||
},
|
||||
{
|
||||
'postbuild_name': 'Fix libgit2 Framework Link',
|
||||
'action': [
|
||||
'install_name_tool',
|
||||
'-change',
|
||||
'@executable_path/libgit2.0.17.0.dylib',
|
||||
'@executable_path/../../../../Frameworks/libgit2.framework/Libraries/libgit2.0.17.0.dylib',
|
||||
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
|
||||
],
|
||||
},
|
||||
{
|
||||
'postbuild_name': 'Copy and Compile Static Files',
|
||||
'action': [
|
||||
'script/copy-files-to-bundle'
|
||||
],
|
||||
},
|
||||
],
|
||||
}, # target cefclient_helper_app
|
||||
'postbuild_name': 'Create Atom, basically do everything',
|
||||
'action': ['script/constructicon/build'],
|
||||
},
|
||||
],
|
||||
}], # OS=="mac"
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
Arquivo normal → Arquivo executável
+36
-11
@@ -1,5 +1,40 @@
|
||||
#!/bin/sh
|
||||
open -a /Applications/Atom.app -n --args --executed-from="$(pwd)" --pid=$$ $@
|
||||
ATOM_PATH=/Applications/Atom.app
|
||||
ATOM_BINARY=$ATOM_PATH/Contents/MacOS/Atom
|
||||
|
||||
if [ ! -d $ATOM_PATH ]; then sleep 5; fi # Wait for Atom to reappear, Sparkle may be replacing it.
|
||||
|
||||
if [ ! -d $ATOM_PATH ]; then
|
||||
echo "Atom application not found at '$ATOM_PATH'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while getopts ":whv-:" opt; do
|
||||
case "$opt" in
|
||||
-)
|
||||
case "${OPTARG}" in
|
||||
wait)
|
||||
WAIT=1
|
||||
;;
|
||||
help|version)
|
||||
EXPECT_OUTPUT=1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
w)
|
||||
WAIT=1
|
||||
;;
|
||||
h|v)
|
||||
EXPECT_OUTPUT=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $EXPECT_OUTPUT ]; then
|
||||
$ATOM_BINARY --executed-from="$(pwd)" --pid=$$ $@
|
||||
else
|
||||
open -a $ATOM_PATH -n --args --executed-from="$(pwd)" --pid=$$ $@
|
||||
fi
|
||||
|
||||
# Used to exit process when atom is used as $EDITOR
|
||||
on_die() {
|
||||
@@ -7,16 +42,6 @@ on_die() {
|
||||
}
|
||||
trap 'on_die' SIGQUIT SIGTERM
|
||||
|
||||
# Don't exit process if we were told to wait.
|
||||
while [ "$#" -gt "0" ]; do
|
||||
case $1 in
|
||||
-W|--wait)
|
||||
WAIT=1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ $WAIT ]; then
|
||||
while true; do
|
||||
sleep 1
|
||||
|
||||
@@ -7,7 +7,7 @@ Config = require 'config'
|
||||
Project = require 'project'
|
||||
|
||||
require 'window'
|
||||
requireStylesheet "jasmine.css"
|
||||
requireStylesheet "jasmine.less"
|
||||
|
||||
# Load TextMate bundles, which specs rely on (but not other packages)
|
||||
atom.loadTextMatePackages()
|
||||
@@ -25,7 +25,6 @@ keymap.bindKeys '*',
|
||||
'meta-w': 'close'
|
||||
'alt-meta-i': 'show-console'
|
||||
$(document).on 'close', -> window.close()
|
||||
$(document).on 'show-console', -> atom.toggleDevTools()
|
||||
|
||||
defaultCount = 100
|
||||
window.pbenchmark = (args...) -> window.benchmark(args..., profile: true)
|
||||
@@ -57,7 +56,7 @@ window.benchmark = (args...) ->
|
||||
report = "#{fullname}: #{total} / #{count} = #{avg}ms"
|
||||
console.log(report)
|
||||
|
||||
if atom.exitWhenDone
|
||||
if atom.getLoadSettings().exitWhenDone
|
||||
url = "https://github.com/_stats"
|
||||
data = [type: 'timing', metric: "atom.#{fullname}", ms: avg]
|
||||
$.ajax url,
|
||||
@@ -127,4 +126,3 @@ $.fn.textInput = (data) ->
|
||||
event = document.createEvent 'TextEvent'
|
||||
event.initTextEvent('textInput', true, true, window, data)
|
||||
this.each -> this.dispatchEvent(event)
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
require 'benchmark-helper'
|
||||
fs = require 'fs'
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
TokenizedBuffer = require 'tokenized-buffer'
|
||||
@@ -107,7 +106,7 @@ describe "TokenizedBuffer.", ->
|
||||
[languageMode, buffer] = []
|
||||
|
||||
beforeEach ->
|
||||
editSession = benchmarkFixturesProject.buildEditSessionForPath('medium.coffee')
|
||||
editSession = benchmarkFixturesProject.open('medium.coffee')
|
||||
{ languageMode, buffer } = editSession
|
||||
|
||||
benchmark "construction", 20, ->
|
||||
|
||||
@@ -145,7 +145,7 @@ generate_html = (source, sections) ->
|
||||
|
||||
# Require our external dependencies, including **Showdown.js**
|
||||
# (the JavaScript implementation of Markdown).
|
||||
fs = require 'fs'
|
||||
fs = require 'fs-utils'
|
||||
path = require 'path'
|
||||
showdown = require('./../vendor/showdown').Showdown
|
||||
{spawn, exec} = require 'child_process'
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
# Authoring Packages
|
||||
|
||||
A package can contain a variety of different resource types to change Atom's
|
||||
behavior. The basic package layout is as follows (not every package will
|
||||
have all of these directories):
|
||||
|
||||
```text
|
||||
my-package/
|
||||
lib/
|
||||
config/
|
||||
stylesheets/
|
||||
keymaps/
|
||||
snippets/
|
||||
grammars/
|
||||
package.json
|
||||
index.coffee
|
||||
```
|
||||
|
||||
**NOTE:** NPM behavior is partially implemented until we get a working Node.js
|
||||
API built into Atom. The goal is to make Atom packages be a superset of NPM
|
||||
packages
|
||||
|
||||
## package.json
|
||||
|
||||
Similar to npm packages, Atom packages can contain a `package.json` file in their
|
||||
top-level directory. This file contains metadata about the package, such as the
|
||||
path to its "main" module, library dependencies, and manifests specifying the
|
||||
order in which its resources should be loaded.
|
||||
|
||||
## Source Code
|
||||
|
||||
If you want to extend Atom's behavior, your package should contain a single
|
||||
top-level module, which you export from `index.coffee` or another file as
|
||||
indicated by the `main` key in your `package.json` file. The remainder of your
|
||||
code should be placed in the `lib` directory, and required from your top-level
|
||||
file.
|
||||
|
||||
Your package's top-level module is a singleton object that manages the lifecycle
|
||||
of your extensions to Atom. Even if your package creates ten different views and
|
||||
appends them to different parts of the DOM, it's all managed from your top-level
|
||||
object. Your package's top-level module should implement the following methods:
|
||||
|
||||
- `activate(rootView, state)` **Required**: This method is called when your
|
||||
package is loaded. It is always passed the window's global `rootView`, and is
|
||||
sometimes passed state data if the window has been reloaded and your module
|
||||
implements the `serialize` method.
|
||||
|
||||
- `serialize()` **Optional**: This method is called when the window is shutting
|
||||
down, allowing you to return JSON to represent the state of your component. When
|
||||
the window is later restored, the data you returned will be passed to your
|
||||
module's `activate` method so you can restore your view to where the user left
|
||||
off.
|
||||
|
||||
- `deactivate()` **Optional**: This method is called when the window is shutting
|
||||
down. If your package is watching any files or holding external resources in any
|
||||
other way, release them here. If you're just subscribing to things on window
|
||||
you don't need to worry because that's getting torn down anyway.
|
||||
|
||||
## A Simple Package Layout:
|
||||
|
||||
```text
|
||||
my-package/
|
||||
package.json # optional
|
||||
index.coffee
|
||||
lib/
|
||||
my-package.coffee
|
||||
```
|
||||
|
||||
`index.coffee`:
|
||||
```coffeescript
|
||||
module.exports = require "./lib/my-package"
|
||||
```
|
||||
|
||||
`my-package/my-package.coffee`:
|
||||
```coffeescript
|
||||
module.exports =
|
||||
activate: (rootView, state) -> # ...
|
||||
deactivate: -> # ...
|
||||
serialize: -> # ...
|
||||
```
|
||||
|
||||
Beyond this simple contract, your package has full access to Atom's internal
|
||||
API. Anything we call internally, you can call as well. Be aware that since we
|
||||
are early in development, APIs are subject to change and we have not yet
|
||||
established clear boundaries between what is public and what is private. Also,
|
||||
Please collaborate with us if you need an API that doesn't exist. Our goal is
|
||||
to build out Atom's API organically based on the needs of package authors like
|
||||
you. See [Atom's built-in packages](https://github.com/github/atom/tree/master/src/packages)
|
||||
for examples of Atom's API in action.
|
||||
|
||||
## Stylesheets
|
||||
|
||||
Stylesheets for your package should be placed in the `stylesheets` directory.
|
||||
Any stylesheets in this directory will be loaded and attached to the DOM when
|
||||
your package is activated. An optional `stylesheets` key in your `package.json`
|
||||
can list the stylesheets by name in order to specify a load order; otherwise
|
||||
stylesheets are loaded alphabetically.
|
||||
|
||||
## Keymaps
|
||||
|
||||
Keymaps are placed in the `keymaps` subdirectory. By default, all keymaps will be
|
||||
loaded in alphabetical order unless there is a `keymaps` array in `package.json`
|
||||
specifying which keymaps to load and in what order. It's a good idea to provide
|
||||
default keymaps for your extension. They can be customized by users later. See
|
||||
the (main keymaps documentation)[#keymaps] for more information on how keymaps
|
||||
work.
|
||||
|
||||
## Snippets
|
||||
|
||||
An extension can supply snippets in a `snippets` directory as `.cson` or `.json`
|
||||
files:
|
||||
|
||||
```coffeescript
|
||||
".source.coffee .specs":
|
||||
"Expect":
|
||||
prefix: "ex"
|
||||
body: "expect($1).to$2"
|
||||
"Describe":
|
||||
prefix: "de"
|
||||
body: """
|
||||
describe "${1:description}", ->
|
||||
${2:body}
|
||||
"""
|
||||
```
|
||||
|
||||
A snippets file contains scope selectors at its top level. Each scope selector
|
||||
contains a hash of snippets keyed by their name. Each snippet specifies a
|
||||
`prefix` and a `body` key.
|
||||
|
||||
All files in the directory will be automatically loaded, unless the
|
||||
`package.json` supplies a `snippets` key as a manifest. As with all scoped
|
||||
items, snippets loaded later take precedence over earlier snippets when two
|
||||
snippets match a scope with the same specificity.
|
||||
@@ -1,22 +1,26 @@
|
||||
## Command Panel
|
||||
|
||||
A partial implementation of the [Sam command language](http://man.cat-v.org/plan_9/1/sam)
|
||||
The command panel contains a partial implementation of the [Sam command language](http://man.cat-v.org/plan_9/1/sam).
|
||||
In addition, packages are free to design and define any scoped command.
|
||||
|
||||
*Examples*
|
||||
Pop open the command line by hitting .
|
||||
You can get a list of commands available to Atom (including any keybindings) by hitting `meta-p`.
|
||||
|
||||
`,` selects entire file
|
||||
## Examples
|
||||
|
||||
`1,4` selects lines 1-4
|
||||
`,` selects the entire file
|
||||
|
||||
`1,4` selects lines 1-4 in the current file
|
||||
|
||||
`/pattern` selects the first match after the cursor/selection
|
||||
|
||||
`s/pattern/replacement` replace first text matching pattern in current selection
|
||||
`s/pattern/replacement` replaces the first text matching pattern in current selection
|
||||
|
||||
`s/pattern/replacement/g` replace all text matching pattern in current selection
|
||||
`s/pattern/replacement/g` replaces all text matching pattern in current selection
|
||||
|
||||
`,s/pattern/replacement/g` replace all text matching pattern in file
|
||||
`,s/pattern/replacement/g` replaces all text matching pattern in file
|
||||
|
||||
`1,4s/pattern/replacement` replace all text matching pattern in lines 1-4
|
||||
`1,4s/pattern/replacement` replaces all text matching pattern in lines 1-4
|
||||
|
||||
`x/pattern` selects all matches in the current selections
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
## Wrap Guide
|
||||
|
||||
The `wrap-guide` extension places a vertical line in each editor at a certain
|
||||
column to guide your formatting so lines do not exceed a certain width.
|
||||
column to guide your formatting, so lines do not exceed a certain width.
|
||||
|
||||
By default the wrap-guide is placed at the 80th column.
|
||||
By default, the wrap-guide is placed at the 80th column.
|
||||
|
||||
### Configuration
|
||||
|
||||
You can customize where the column is placed using the `wrapGuide.columns`
|
||||
config option.
|
||||
config option:
|
||||
|
||||
config.cson:
|
||||
```coffee-cript
|
||||
```coffeescript
|
||||
"wrap-guide":
|
||||
columns: [
|
||||
{ pattern: "\.mm$", column: 200 },
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
# Configuration Settings
|
||||
|
||||
## Your .atom Directory
|
||||
|
||||
When you install Atom, an _.atom_ directory is created in your home directory.
|
||||
If you press `meta-,`, that directory is opened in a new window. For the
|
||||
time being, this serves as the primary interface for adjusting configuration
|
||||
settings, adding and changing key bindings, tweaking styles, etc.
|
||||
|
||||
Atom loads configuration settings from the `config.cson` file in your _~/.atom_
|
||||
directory, which contains CoffeeScript-style JSON:
|
||||
|
||||
```coffeescript
|
||||
core:
|
||||
hideGitIgnoredFiles: true
|
||||
editor:
|
||||
fontSize: 18
|
||||
```
|
||||
|
||||
Configuration is broken into namespaces, which are defined by the config hash's
|
||||
top-level keys. In addition to Atom's core components, each package may define
|
||||
its own namespace.
|
||||
|
||||
## Glossary of Config Keys
|
||||
|
||||
- `core`
|
||||
- `disablePackages`: An array of package names to disable
|
||||
- `hideGitIgnoredFiles`: Whether files in the _.gitignore_ should be hidden
|
||||
- `ignoredNames`: File names to ignore across all of Atom (not fully implemented)
|
||||
- `themes`: An array of theme names to load, in cascading order
|
||||
- `autosave`: Save a buffer when its view loses focus
|
||||
- `editor`
|
||||
- `autoIndent`: Enable/disable basic auto-indent (defaults to `true`)
|
||||
- `autoIndentOnPaste`: Enable/disable auto-indented pasted text (defaults to `false`)
|
||||
- `nonWordCharacters`: A string of non-word characters to define word boundaries
|
||||
- `fontSize`: The editor font size
|
||||
- `fontFamily`: The editor font family
|
||||
- `invisibles`: Specify characters that Atom renders for invisibles in this hash
|
||||
- `tab`: Hard tab characters
|
||||
- `cr`: Carriage return (for Microsoft-style line endings)
|
||||
- `eol`: `\n` characters
|
||||
- `space`: Leading and trailing space characters
|
||||
- `preferredLineLength`: Identifies the length of a line (defaults to `80`)
|
||||
- `showInvisibles`: Whether to render placeholders for invisible characters (defaults to `false`)
|
||||
- `fuzzyFinder`
|
||||
- `ignoredNames`: Files to ignore *only* in the fuzzy-finder
|
||||
- `whitespace`
|
||||
- `ensureSingleTrailingNewline`: Whether to reduce multiple newlines to one at the end of files
|
||||
- `wrapGuide`
|
||||
- `columns`: Array of hashes with a `pattern` and `column` key to match the
|
||||
the path of the current editor to a column position.
|
||||
|
||||
## Customizing Key Bindings
|
||||
|
||||
Atom keymaps work similarly to stylesheets. Just as stylesheets use selectors
|
||||
to apply styles to elements, Atom keymaps use selectors to associate keystrokes
|
||||
with events in specific contexts. Here's a small example, excerpted from Atom's
|
||||
built-in keymaps:
|
||||
|
||||
```coffee-script
|
||||
'.editor':
|
||||
'enter': 'editor:newline'
|
||||
|
||||
".select-list .editor.mini":
|
||||
'enter': 'core:confirm',
|
||||
```
|
||||
|
||||
This keymap defines the meaning of `enter` in two different contexts. In a
|
||||
normal editor, pressing `enter` emits the `editor:newline` event, which causes
|
||||
the editor to insert a newline. But if the same keystroke occurs inside of a
|
||||
select list's mini-editor, it instead emits the `core:confirm` event based on
|
||||
the binding in the more-specific selector.
|
||||
|
||||
By default, any keymap files in your `~/.atom/keymaps` directory are loaded
|
||||
in alphabetical order when Atom is started. They will always be loaded last,
|
||||
giving you the chance to override bindings that are defined by Atom's core
|
||||
keymaps or third-party packages.
|
||||
|
||||
## Changing The Theme
|
||||
|
||||
Atom comes bundled with two themes `atom-dark-*` and `atom-light-*`.
|
||||
|
||||
Because Atom themes are based on CSS, it's possible to have multiple themes
|
||||
active at the same time. For example, you'll usually select a theme for the UI
|
||||
and another theme for syntax highlighting. You can select themes by specifying
|
||||
them in the `core.themes` array in your `config.cson`:
|
||||
|
||||
```coffee-script
|
||||
core:
|
||||
themes: ["atom-light-ui", "atom-light-syntax"]
|
||||
# or, if the sun is going down:
|
||||
# themes: ["atom-dark-ui", "atom-dark-syntax"]
|
||||
```
|
||||
|
||||
You install new themes by placing them in the _~/.atom/themes_ directory. A
|
||||
theme can be a CSS file, a directory containing multiple CSS files, or a
|
||||
TextMate theme (either _.tmTheme_ or _.plist_).
|
||||
|
||||
|
||||
## Installing Packages (Partially Implemented)
|
||||
|
||||
To install a package, clone it into the _~/.atom/packages_ directory. Atom will
|
||||
also load grammars and snippets from TextMate bundles. If you want to disable a
|
||||
package without removing it from the packages directory, insert its name into
|
||||
_config.core.disabledPackages_:
|
||||
|
||||
```coffeescript
|
||||
core:
|
||||
disabledPackages: [
|
||||
"fuzzy-finder",
|
||||
"tree-view"
|
||||
]
|
||||
```
|
||||
|
||||
## Quick Personal Hacks
|
||||
|
||||
### user.coffee
|
||||
|
||||
When Atom finishes loading, it will evaluate _user.coffee_ in your _~/.atom_
|
||||
directory, giving you a chance to run arbitrary personal CoffeeScript code to
|
||||
make customizations. You have full access to Atom's API from code in this file.
|
||||
Please refer to the [Atom Internals Guide](./internals/intro,md) for more information. If your
|
||||
customizations become extensive, consider [creating a package](./packages/creating_packages.md).
|
||||
|
||||
### user.css
|
||||
|
||||
If you want to apply quick-and-dirty personal styling changes without creating
|
||||
an entire theme that you intend to distribute, you can add styles to
|
||||
_user.css_ in your _~/.atom_ directory.
|
||||
|
||||
For example, to change the color of the highlighted line number for the line that
|
||||
contains the cursor, you could add the following style to _user.css_:
|
||||
|
||||
```css
|
||||
.editor .line-number.cursor-line {
|
||||
color: pink;
|
||||
}
|
||||
```
|
||||
+59
-50
@@ -1,35 +1,37 @@
|
||||
# Getting Started
|
||||
|
||||
Welcome to Atom. This documentation is intended to offer a basic introduction
|
||||
of how to get productive with this editor. Then we'll delve into more details
|
||||
about configuring, theming, and extending Atom.
|
||||
Welcome to Atom. This documentation provides a basic introduction to being
|
||||
productive with this editor. We'll then delve into more details about configuring,
|
||||
theming, and extending Atom.
|
||||
|
||||
## The Command Palette
|
||||
|
||||
If there's one key-command you learn in Atom, it should be `meta-p`. You can
|
||||
always hit `meta-p` to bring up a list of commands that are relevant to the
|
||||
currently focused UI element. If there is a key binding for a given command, it
|
||||
is also displayed. This is a great way to explore the system and get to know the
|
||||
key commands interactively. If you'd like to add or change a binding for a
|
||||
command, refer to the [keymaps](#keymaps) section to learn how.
|
||||
If there's one key-command you must remember in Atom, it should be `meta-p` (`meta` is
|
||||
synonymous with the ⌘ key). You can always hit `meta-p` to bring up a list of
|
||||
commands that are relevant to the currently focused UI element. If there is a
|
||||
key binding for a given command, it is also displayed. This is a great way to
|
||||
explore the system and get to know the key commands interactively. If you'd like
|
||||
to learn about adding or changing a binding for a command, refer to the [key
|
||||
bindings](#customizing-key-bindings) section.
|
||||
|
||||

|
||||
|
||||
## Basic Key Bindings
|
||||
Remember you can always use `meta-p` to explore available commands and their
|
||||
|
||||
You can always use `meta-p` to explore available commands and their
|
||||
bindings, but here's a list of a few useful commands.
|
||||
|
||||
- `meta-o` : open file/directory
|
||||
- `meta-n` : new window
|
||||
- `meta-o` : open a file or directory
|
||||
- `meta-shift-n` : open new window
|
||||
- `meta-r` : reload the current window
|
||||
- `meta-alt-ctrl-s` : run specs
|
||||
- `meta-t` : open fuzzy file finder
|
||||
- `meta-alt-ctrl-s` : run test specs
|
||||
- `meta-t` : open file finder to navigate files in your project
|
||||
- `meta-;` : open command prompt
|
||||
- `meta-f` : open command prompt with `/`
|
||||
- `meta-f` : open command prompt with `/` for a local file search
|
||||
- `meta-g` : repeat the last local search
|
||||
- `meta-shift-f` : open command prompt with `Xx/` for a project-wide search
|
||||
- `meta-\` : focus/open tree view, or close it when it is focused
|
||||
- `meta-shift-\` : open tree view with the current file selected
|
||||
- `meta-|` : open tree view with the current file selected
|
||||
- `ctrl-w v`, `ctrl-|` : split screen vertically
|
||||
- `ctrl-w s`, `ctrl--` : split screen horizontally
|
||||
- `meta-l` : go to line
|
||||
@@ -51,8 +53,8 @@ issue so you can keep working.
|
||||
|
||||
The fastest way to find a file in your project is to use the fuzzy finder. Just
|
||||
hit `meta-t` and start typing the name of the file you're looking for. If you
|
||||
already have the file open and want to jump to it, hit `meta-b` to bring up a
|
||||
searchable list of open buffers.
|
||||
already have the file open as a tab and want to jump to it, hit `meta-b` to bring
|
||||
up a searchable list of open buffers.
|
||||
|
||||
You can also use the tree view to navigate to a file. To open or move focus to
|
||||
the tree view, hit `meta-\`. You can then navigate to a file and select it with
|
||||
@@ -72,28 +74,32 @@ To delete a file, select it in the tree view and hit `delete`.
|
||||
|
||||
#### Using the Command Line
|
||||
|
||||
Atom has a command line similar to editors Emacs and Vim, which is currently the
|
||||
only interface for performing searches. Hitting `meta-f` will open the command
|
||||
line prepopulated with the `/` command, which finds forward in the current
|
||||
buffer from the location of the cursor. Pressing `meta-g` will repeat the
|
||||
search. Hitting `meta-shift-f` will open the command line prepopulated with
|
||||
`Xx/`, which is a composite command that performs a global search. The results
|
||||
of the search will appear in the operation preview list, which you can focus
|
||||
Atom has a command line similar to old-school editors such as emacs and vim. Nearly
|
||||
every command has a key binding which you can discover with `meta-p`.
|
||||
|
||||
The command line is also (currently) the only place you can perform a search. Hitting
|
||||
`meta-f` opens the command line and prepopulates it with the `/` command. This finds
|
||||
text in the current buffer, starting at the location of the cursor. Pressing `meta-g`
|
||||
repeats the search. Hitting `meta-shift-f` opens the command line and prepopulates
|
||||
it with `Xx/`, which is a composite command that performs a global search. The results
|
||||
of the search appear in the operation preview list, which you can focus
|
||||
with `meta-:`.
|
||||
|
||||
Atom's command language is still under construction and is loosely based on
|
||||
Atom's command language is still under construction, and is loosely based on
|
||||
the [Sam editor](http://doc.cat-v.org/bell_labs/sam_lang_tutorial/) from the
|
||||
Plan 9 operating system. It's similar to Ex mode in Vim, but is selection-based
|
||||
Plan 9 operating system. It's similar to Ex mode in vim, but is selection-based
|
||||
rather than line-based. It allows you to compose commands together in
|
||||
interesting ways.
|
||||
|
||||
#### Navigating By Symbols
|
||||
|
||||
If you want to jump to a method, you can use the ctags-based symbols package.
|
||||
The `meta-j` binding will open a list of all symbols in the current file. The
|
||||
`meta-shift-j` binding will open a list of all symbols for the current project
|
||||
based on a tags file. And `meta-.` will jump to the tag for the word currently
|
||||
under the cursor. Make sure you have a tags file generated for the project for
|
||||
The `meta-j` binding opens a list of all symbols in the current file. The
|
||||
`meta-shift-j` binding opens a list of all symbols for the current project
|
||||
based on a tags file. `meta-.` jumps to the tag for the word currently
|
||||
under the cursor.
|
||||
|
||||
Make sure you have a tags file generated for the project for
|
||||
the latter of these two bindings to work. Also, if you're editing CoffeeScript,
|
||||
it's a good idea to update your `~/.ctags` file to understand the language. Here
|
||||
is [a good example](https://github.com/kevinsawicki/dotfiles/blob/master/.ctags).
|
||||
@@ -105,31 +111,31 @@ command, as follows: `s/foo/bar/g`. Note that if you have a selection, the
|
||||
replacement will only occur inside the selected text. An empty selection will
|
||||
cause the replacement to occur across the whole buffer. If you want to run the
|
||||
command on the whole buffer even if you have a selection, precede your
|
||||
substitution with the `,` address, which specifies that the command following it
|
||||
operate on the whole buffer.
|
||||
substitution with the `,` address; this indicates that the following command should
|
||||
run on the whole buffer.
|
||||
|
||||
### Split Panes
|
||||
|
||||
You can split any editor pane horizontally or vertically by using `ctrl-shift-|` or
|
||||
You can split any editor pane horizontally or vertically by using `ctrl-\` or
|
||||
`ctrl-w v`. Once you have a split pane, you can move focus between them with
|
||||
`ctrl-tab` or `ctrl-w w`. To close a pane, close all tabs inside it.
|
||||
|
||||
### Folding
|
||||
|
||||
You can fold everything with `ctrl-shift-[` and unfold everything with
|
||||
`ctrl-shift-]`. Or, you can fold / unfold by a single level with `ctrl-[` and
|
||||
You can fold everything with `ctrl-{` and unfold everything with
|
||||
`ctrl-}`. Or, you can fold / unfold by a single level with `ctrl-[` and
|
||||
`ctrl-]`. The user interaction around folds is still a bit rough, but we're
|
||||
planning to improve it soon.
|
||||
|
||||
### Soft-Wrap
|
||||
|
||||
If you want to toggle soft wrap, trigger the command from the command palette.
|
||||
Press `meta-p` to open the palette, then type "wrap" to find the correct
|
||||
Hit `meta-p` to open the palette, then type "wrap" to find the correct
|
||||
command.
|
||||
|
||||
## Your .atom Directory
|
||||
|
||||
When you install Atom, a `.atom` directory is created in your home directory.
|
||||
When you install Atom, an `.atom` directory is created in your home directory.
|
||||
If you press `meta-,`, that directory will be opened in a new window. For the
|
||||
time being, this will serve as the primary interface for adjusting configuration
|
||||
settings, adding and changing key bindings, tweaking styles, etc.
|
||||
@@ -140,10 +146,13 @@ Atom loads configuration settings from the `config.cson` file in your `~/.atom`
|
||||
directory, which contains CoffeeScript-style JSON:
|
||||
|
||||
```coffeescript
|
||||
core:
|
||||
hideGitIgnoredFiles: true
|
||||
editor:
|
||||
fontSize: 18
|
||||
'editor':
|
||||
'fontSize': 16
|
||||
'core':
|
||||
'themes': [
|
||||
'atom-dark-ui'
|
||||
'atom-dark-syntax'
|
||||
]
|
||||
```
|
||||
|
||||
Configuration is broken into namespaces, which are defined by the config hash's
|
||||
@@ -153,14 +162,14 @@ its own namespace.
|
||||
### Glossary of Config Keys
|
||||
|
||||
- core
|
||||
- disablePackages: An array of package names to disable
|
||||
- disabledPackages: An array of package names to disable
|
||||
- hideGitIgnoredFiles: Whether files in the .gitignore should be hidden
|
||||
- ignoredNames: File names to ignore across all of atom (not fully implemented)
|
||||
- themes: An array of theme names to load, in cascading order
|
||||
- autosave: Save a resource when its view loses focus
|
||||
- editor
|
||||
- autoIndent: Enable/disable basic auto-indent (defaults to true)
|
||||
- autoIndentOnPaste: Enable/disable auto-indented pasted text (defaults to false)
|
||||
- autosave: Save a file when an editor loses focus
|
||||
- nonWordCharacters: A string of non-word characters to define word boundaries
|
||||
- fontSize
|
||||
- fontFamily
|
||||
@@ -173,8 +182,8 @@ its own namespace.
|
||||
- showInvisibles: Whether to render placeholders for invisible characters (defaults to false)
|
||||
- fuzzyFinder
|
||||
- ignoredNames: Files to ignore *only* in the fuzzy-finder
|
||||
- stripTrailingWhitespace
|
||||
- singleTrailingNewline: Whether to reduce multiple newlines to one at the end of files
|
||||
- whitespace
|
||||
- ensureSingleTrailingNewline: Whether to reduce multiple newlines to one at the end of files
|
||||
- wrapGuide
|
||||
- columns: Array of hashes with a `pattern` and `column` key to match the
|
||||
the path of the current editor to a column position.
|
||||
@@ -186,12 +195,12 @@ to apply styles to elements, Atom keymaps use selectors to associate keystrokes
|
||||
with events in specific contexts. Here's a small example, excerpted from Atom's
|
||||
built-in keymaps:
|
||||
|
||||
```coffee-script
|
||||
```coffeescript
|
||||
'.editor':
|
||||
'enter': 'editor:newline'
|
||||
|
||||
".select-list .editor.mini":
|
||||
'enter': 'core:confirm',
|
||||
'.select-list .editor.mini':
|
||||
'enter': 'core:confirm'
|
||||
```
|
||||
|
||||
This keymap defines the meaning of `enter` in two different contexts. In a
|
||||
@@ -214,7 +223,7 @@ active at the same time. For example, you'll usually select a theme for the UI
|
||||
and another theme for syntax highlighting. You can select themes by specifying
|
||||
them in the `core.themes` array in your `config.cson`:
|
||||
|
||||
```coffee-script
|
||||
```coffeescript
|
||||
core:
|
||||
themes: ["atom-light-ui", "atom-light-syntax"]
|
||||
# or, if the sun is going down:
|
||||
|
||||
@@ -7,7 +7,7 @@ read config settings. You can read a value from `config` with `config.get`:
|
||||
|
||||
```coffeescript
|
||||
# read a value with `config.get`
|
||||
@autosave() if config.get "editor.autosave"
|
||||
@autosave() if config.get "core.autosave"
|
||||
```
|
||||
|
||||
Or you can use `observeConfig` to track changes from a view object.
|
||||
@@ -47,12 +47,9 @@ the following way:
|
||||
|
||||
```coffeescript
|
||||
# basic key update
|
||||
config.set("editor.autosave", true)
|
||||
config.set("core.autosave", true)
|
||||
|
||||
# if you mutate a config key, you'll need to call `config.update` to inform
|
||||
# observers of the change
|
||||
config.get("fuzzyFinder.ignoredPaths").push "vendor"
|
||||
config.update()
|
||||
config.pushAtKeyPath("core.disabledPackages", "wrap-guide")
|
||||
```
|
||||
|
||||
You can also use `setDefaults`, which will assign default values for keys that
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
## Serialization in Atom
|
||||
|
||||
When a window is refreshed or restored from a previous session, the view and its
|
||||
associated objects are *deserialized* from a JSON representation that was stored
|
||||
during the window's previous shutdown. For your own views and objects to be
|
||||
compatible with refreshing, you'll need to make them play nicely with the
|
||||
serializing and deserializing.
|
||||
|
||||
### Package Serialization Hook
|
||||
|
||||
Your package's main module can optionally include a `serialize` method, which
|
||||
will be called before your package is deactivated. You should return JSON, which
|
||||
will be handed back to you as an argument to `activate` next time it is called.
|
||||
In the following example, the package keeps an instance of `MyObject` in the
|
||||
same state across refreshes.
|
||||
|
||||
```coffee-script
|
||||
module.exports =
|
||||
activate: (state) ->
|
||||
@myObject =
|
||||
if state
|
||||
deserialize(state)
|
||||
else
|
||||
new MyObject("Hello")
|
||||
|
||||
serialize: ->
|
||||
@myObject.serialize()
|
||||
```
|
||||
|
||||
### Serialization Methods
|
||||
|
||||
```coffee-script
|
||||
class MyObject
|
||||
registerDeserializer(this)
|
||||
@deserialize: ({data}) -> new MyObject(data)
|
||||
constructor: (@data) ->
|
||||
serialize: -> { deserializer: 'MyObject', data: @data }
|
||||
```
|
||||
|
||||
#### .serialize()
|
||||
Objects that you want to serialize should implement `.serialize()`. This method
|
||||
should return a serializable object, and it must contain a key named
|
||||
`deserializer` whose value is the name of a registered deserializer that can
|
||||
convert the rest of the data to an object. It's usually just the name of the
|
||||
class itself.
|
||||
|
||||
#### @deserialize(data)
|
||||
The other side of the coin is the `deserialize` method, which is usually a
|
||||
class-level method on the same class that implements `serialize`. This method's
|
||||
job is to convert a state object returned from a previous call `serialize` back
|
||||
into a genuine object.
|
||||
|
||||
#### registerDeserializer(klass)
|
||||
You need to call the global `registerDeserializer` method with your class in
|
||||
order to make it available to the deserialization system. Now you can call the
|
||||
global `deserialize` method with state returned from `serialize`, and your
|
||||
class's `deserialize` method will be selected automatically.
|
||||
|
||||
### Versioning
|
||||
|
||||
```coffee-script
|
||||
class MyObject
|
||||
@version: 2
|
||||
@deserialize: (state) -> ...
|
||||
serialize: -> { version: MyObject.version, ... }
|
||||
```
|
||||
|
||||
Your serializable class can optionally have a class-level `@version` property
|
||||
and include a `version` key in its serialized state. When deserializing, Atom
|
||||
will only attempt to call deserialize if the two versions match, and otherwise
|
||||
return undefined. We plan on implementing a migration system in the future, but
|
||||
this at least protects you from improperly deserializing old state. If you find
|
||||
yourself in dire need of the migration system, let us know.
|
||||
|
||||
### Deferred Package Deserializers
|
||||
|
||||
If your package defers loading on startup with an `activationEvents` property in
|
||||
its `package.cson`, your deserializers won't be loaded until your package is
|
||||
activated. If you want to deserialize an object from your package on startup,
|
||||
this could be a problem.
|
||||
|
||||
The solution is to also supply a `deferredDeserializers` array in your
|
||||
`package.cson` with the names of all your deserializers. When Atom attempts to
|
||||
deserialize some state whose `deserializer` matches one of these names, it will
|
||||
load your package first so it can register any necessary deserializers before
|
||||
proceeding.
|
||||
|
||||
For example, the markdown preview package doesn't fully load until a preview is
|
||||
triggered. But if you refresh a window with a preview pane, it loads the
|
||||
markdown package early so Atom can deserialize the view correctly.
|
||||
|
||||
```coffee-script
|
||||
# markdown-preview/package.cson
|
||||
'activationEvents': 'markdown-preview:toggle': '.editor'
|
||||
'deferredDeserializers': ['MarkdownPreviewView']
|
||||
...
|
||||
```
|
||||
+6
-2
@@ -1,10 +1,14 @@
|
||||
getting-started.md
|
||||
configuring-atom.md
|
||||
built-in-packages/intro.md
|
||||
built-in-packages/command-panel.md
|
||||
built-in-packages/markdown-preview.md
|
||||
built-in-packages/wrap-guide.md
|
||||
authoring-themes.md
|
||||
authoring-packages..md
|
||||
packages/authoring-packages.md
|
||||
packages/creating_a_package.md
|
||||
packages/included_libraries.md
|
||||
packages/package_json.md
|
||||
themes/authoring-themes.md
|
||||
internals/intro.md
|
||||
internals/configuration.md
|
||||
internals/keymaps.md
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
# Authoring Packages
|
||||
|
||||
Packages are at the core of Atom. Nearly everything outside of the main editor manipulation
|
||||
is handled by a package. That includes "core" pieces like the command panel, status bar,
|
||||
file tree, and more.
|
||||
|
||||
A package can contain a variety of different resource types to change Atom's
|
||||
behavior. The basic package layout is as follows (though not every package will
|
||||
have all of these directories):
|
||||
|
||||
```text
|
||||
my-package/
|
||||
lib/
|
||||
stylesheets/
|
||||
keymaps/
|
||||
snippets/
|
||||
grammars/
|
||||
spec/
|
||||
package.json
|
||||
index.coffee
|
||||
```
|
||||
|
||||
**NOTE:** NPM behavior is partially implemented until we get a working Node.js
|
||||
API built into Atom. The goal is to make Atom packages be a superset of NPM
|
||||
packages.
|
||||
|
||||
Below, we'll break down each directory. There's also [a tutorial](./creating_a_package.md)
|
||||
on creating your first package.
|
||||
|
||||
## package.json
|
||||
|
||||
Similar to [npm packages](http://en.wikipedia.org/wiki/Npm_(software\)), Atom packages
|
||||
can contain a _package.json_ file in their top-level directory. This file contains metadata
|
||||
about the package, such as the path to its "main" module, library dependencies,
|
||||
and manifests specifying the order in which its resources should be loaded.
|
||||
|
||||
In addition to the regular [npm package.json keys](https://npmjs.org/doc/json.html)
|
||||
available, Atom package.json files [have their own additions](./package_json.md).
|
||||
|
||||
## Source Code
|
||||
|
||||
If you want to extend Atom's behavior, your package should contain a single
|
||||
top-level module, which you export from _index.coffee_ (or whichever file is
|
||||
indicated by the `main` key in your _package.json_ file). The remainder of your
|
||||
code should be placed in the `lib` directory, and required from your top-level
|
||||
file.
|
||||
|
||||
Your package's top-level module is a singleton object that manages the lifecycle
|
||||
of your extensions to Atom. Even if your package creates ten different views and
|
||||
appends them to different parts of the DOM, it's all managed from your top-level
|
||||
object.
|
||||
|
||||
Your package's top-level module should implement the following methods:
|
||||
|
||||
- `activate(rootView, state)`: This **required** method is called when your
|
||||
package is loaded. It is always passed the window's global `rootView`, and is
|
||||
sometimes passed state data if the window has been reloaded and your module
|
||||
implements the `serialize` method. Use this to do initialization work when your
|
||||
package is started (like setting up DOM elements or binding events).
|
||||
|
||||
- `serialize()`: This **optional** method is called when the window is shutting
|
||||
down, allowing you to return JSON to represent the state of your component. When
|
||||
the window is later restored, the data you returned is passed to your
|
||||
module's `activate` method so you can restore your view to where the user left
|
||||
off.
|
||||
|
||||
- `deactivate()`: This **optional** method is called when the window is shutting
|
||||
down. If your package is watching any files or holding external resources in any
|
||||
other way, release them here. If you're just subscribing to things on window,
|
||||
you don't need to worry because that's getting torn down anyway.
|
||||
|
||||
### Simple Package Code
|
||||
|
||||
```text
|
||||
my-package/
|
||||
package.json # optional
|
||||
index.coffee
|
||||
lib/
|
||||
my-package.coffee
|
||||
```
|
||||
|
||||
`index.coffee`:
|
||||
```coffeescript
|
||||
module.exports = require "./lib/my-package"
|
||||
```
|
||||
|
||||
`my-package/my-package.coffee`:
|
||||
```coffeescript
|
||||
module.exports =
|
||||
activate: (rootView, state) -> # ...
|
||||
deactivate: -> # ...
|
||||
serialize: -> # ...
|
||||
```
|
||||
|
||||
Beyond this simple contract, your package has full access to Atom's internal
|
||||
API. Anything we call internally, you can call as well. Be aware that since we
|
||||
are early in development, APIs are subject to change and we have not yet
|
||||
established clear boundaries between what is public and what is private. Also,
|
||||
please collaborate with us if you need an API that doesn't exist. Our goal is
|
||||
to build out Atom's API organically based on the needs of package authors like
|
||||
you.
|
||||
|
||||
See [Atom's built-in packages](https://github.com/github/atom/tree/master/src/packages)
|
||||
for examples of Atom's API in action.
|
||||
|
||||
## Stylesheets
|
||||
|
||||
Stylesheets for your package should be placed in the _stylesheets_ directory.
|
||||
Any stylesheets in this directory will be loaded and attached to the DOM when
|
||||
your package is activated. Stylesheets can be written as CSS or LESS.
|
||||
|
||||
An optional `stylesheets` array in your _package.json_ can list the stylesheets by
|
||||
name to specify a loading order; otherwise, stylesheets are loaded alphabetically.
|
||||
|
||||
## Keymaps
|
||||
|
||||
Keymaps are placed in the _keymaps_ subdirectory. It's a good idea to provide
|
||||
default keymaps for your extension, especially if you're also adding a new command.
|
||||
|
||||
By default, all keymaps are loaded in alphabetical order. An optional `keymaps`
|
||||
array in your _package.json_ can specify which keymaps to load and in what order.
|
||||
|
||||
See the [main keymaps documentation](../internals/keymaps.md) for more information on
|
||||
how keymaps work.
|
||||
|
||||
## Snippets
|
||||
|
||||
An extension can supply language snippets in the _snippets_ directory. These can
|
||||
be `.cson` or `.json` files. Here's an example:
|
||||
|
||||
```coffeescript
|
||||
".source.coffee .specs":
|
||||
"Expect":
|
||||
prefix: "ex"
|
||||
body: "expect($1).to$2"
|
||||
"Describe":
|
||||
prefix: "de"
|
||||
body: """
|
||||
describe "${1:description}", ->
|
||||
${2:body}
|
||||
"""
|
||||
```
|
||||
|
||||
A snippets file contains scope selectors at its top level (`.source.coffee .spec`).
|
||||
Each scope selector contains a hash of snippets keyed by their name (`Expect`, `Describe`).
|
||||
Each snippet also specifies a `prefix` and a `body` key. The `prefix` represents
|
||||
the first few letters to type before hitting the `tab` key to autocomplete. The
|
||||
`body` defines the autofilled text. You can use placeholders like `$1`, `$2`, to indicate
|
||||
regions in the body the user can navigate to every time they hit `tab`.
|
||||
|
||||
All files in the directory are automatically loaded, unless the
|
||||
_package.json_ supplies a `snippets` key. As with all scoped
|
||||
items, snippets loaded later take precedence over earlier snippets when two
|
||||
snippets match a scope with the same specificity.
|
||||
|
||||
## Language Grammars
|
||||
|
||||
If you're developing a new language grammar, you'll want to place your file in
|
||||
the _grammars_ directory. Each grammar is a pairing of two keys, `match` and
|
||||
`captures`. `match` is a regular expression identifying the pattern to highlight,
|
||||
while `captures` is a JSON representing what to do with each matching group.
|
||||
For example:
|
||||
|
||||
|
||||
```json
|
||||
{
|
||||
'match': '(?:^|\\s)(__[^_]+__)'
|
||||
'captures':
|
||||
'1': 'name': 'markup.bold.gfm'
|
||||
}
|
||||
```
|
||||
|
||||
This indicates that the first matching capture (`(__[^_]+__)`) should have the
|
||||
`markup.bold.gfm` token applied to it.
|
||||
|
||||
To capture a single group, simply use the `name` key instead:
|
||||
|
||||
```json
|
||||
{
|
||||
'match': '^#{1,6}\\s+.+$'
|
||||
'name': 'markup.heading.gfm'
|
||||
}
|
||||
```
|
||||
|
||||
This indicates that Markdown header lines (`#`, `##`, `###`) should be applied with
|
||||
the `markup.heading.gfm` token.
|
||||
|
||||
More information about the significance of these tokens can be found in
|
||||
[section 12.4 of the TextMate Manual](http://manual.macromates.com/en/language_grammars.html).
|
||||
|
||||
Your grammar should also include a `filetypes` array, which is a list of file extensions
|
||||
your grammar supports:
|
||||
|
||||
```
|
||||
'fileTypes': [
|
||||
'markdown'
|
||||
'md'
|
||||
'mkd'
|
||||
'mkdown'
|
||||
'ron'
|
||||
]
|
||||
```
|
||||
|
||||
## Writing Tests
|
||||
|
||||
Your package **should** have tests, and if they're placed in the _spec_ directory,
|
||||
they can be run by Atom.
|
||||
|
||||
Under the hood, [Jasmine](https://github.com/pivotal/jasmine) is being used to run
|
||||
to execute the tests, so you can assume that any DSL available there is available
|
||||
to your package as well.
|
||||
@@ -0,0 +1,254 @@
|
||||
# Creating Packages
|
||||
|
||||
Let's take a look at creating our first package.
|
||||
|
||||
Atom has a command you can enter that'll create a package for you:
|
||||
`package-generator:generate`. Otherwise, you can hit `meta-p`, and start typing
|
||||
"Package Generator." Once you activate this package, it'll ask you for a name for
|
||||
your new package. Let's call ours _changer_.
|
||||
|
||||
Now, _changer_ is going to have a default set of folders and files created for us.
|
||||
Hit `meta-R` to reload Atom, then hit `meta-p` and start typing "Changer." You'll
|
||||
see a new `Changer:Toggle` command which, if selected, pops up a new message. So
|
||||
far, so good!
|
||||
|
||||
In order to demonstrate the capabilities of Atom and its API, our Changer plugin
|
||||
is going to do two things:
|
||||
|
||||
1. It'll show only modified files in the file tree
|
||||
2. It'll append a new pane to the editor with some information about the modified
|
||||
files
|
||||
|
||||
Let's get started!
|
||||
|
||||
## Changing Keybindings and Commands
|
||||
|
||||
Since Changer is primarily concerned with the file tree, let's write a keybinding
|
||||
that works only when the tree is focused. Instead of using the default `toggle`,
|
||||
our keybinding executes a new command called `magic`.
|
||||
|
||||
_keymaps/changer.cson_ can easily become this:
|
||||
|
||||
```cson
|
||||
'.tree-view-scroller':
|
||||
'ctrl-V': 'changer:magic'
|
||||
```
|
||||
|
||||
Notice that the keybinding is called `ctrl-V`--that's actually `ctrl-shift-v`.
|
||||
You can use capital letters to denote using `shift` for your binding.
|
||||
|
||||
`.tree-view-scroller` represents the parent container for the tree view. Keybindings
|
||||
only work within the context of where they're entered. For example, hitting `ctrl-V`
|
||||
anywhere other than tree won't do anything. You can map to `body` if you want
|
||||
to scope to anywhere in Atom, or just `.editor` for the editor portion.
|
||||
|
||||
To bind keybindings to a command, we'll use the `rootView.command` method. This
|
||||
takes a command name and executes a function in the code. For example:
|
||||
|
||||
```coffeescript
|
||||
rootView.command "changer:magic", => @magic()
|
||||
```
|
||||
|
||||
It's common practice to namespace your commands with your package name, and separate
|
||||
it with a colon (`:`). Rename the existing `toggle` method to `magic` to get the
|
||||
binding to work.
|
||||
|
||||
Reload the editor, click on the tree, hit your keybinding, and...nothing happens! What the heck?!
|
||||
|
||||
Open up the _package.json_ file, and notice the key that says `activationEvents`.
|
||||
Basically, this tells Atom to not load a package until it hears a certain event.
|
||||
Let's change the event to `changer:magic` and reload the editor.
|
||||
|
||||
Hitting the key binding on the tree now works!
|
||||
|
||||
## Working with styles
|
||||
|
||||
The next step is to hide elements in the tree that aren't modified. To do that,
|
||||
we'll first try and get a list of files that have not changed.
|
||||
|
||||
All packages are able to use jQuery in their code. In fact, we have [a list of
|
||||
some of the bundled libraries Atom provides by default](./included_libraries.md).
|
||||
|
||||
Let's bring in jQuery:
|
||||
|
||||
```coffeescript
|
||||
$ = require 'jquery'
|
||||
```
|
||||
|
||||
Now, we can query the tree to get us a list of every file that _wasn't_ modified:
|
||||
|
||||
```coffeescript
|
||||
magic: ->
|
||||
$('ol.entries li').each (i, el) ->
|
||||
if !$(el).hasClass("modified")
|
||||
console.log el
|
||||
```
|
||||
|
||||
You can access the dev console by hitting `alt-meta-i`. When we execute the
|
||||
`changer:magic` command, the browser console lists the items that are not being
|
||||
modified. Let's add a class to each of these elements called `hide-me`:
|
||||
|
||||
```coffeescript
|
||||
magic: ->
|
||||
$('ol.entries li').each (i, el) ->
|
||||
if !$(el).hasClass("modified")
|
||||
$(el).addClass("hide-me")
|
||||
```
|
||||
|
||||
With our newly added class, we can manipulate the visibility of the elements
|
||||
with a simple stylesheet. Open up _changer.css_ in the _stylesheets_ directory,
|
||||
and add a single entry:
|
||||
|
||||
```css
|
||||
ol.entries .hide-me {
|
||||
display: none;
|
||||
}
|
||||
```
|
||||
|
||||
Refresh atom, and run the `changer` command. You'll see all the non-changed files
|
||||
disappear from the tree. There are a number of ways you can get the list back;
|
||||
let's just naively iterate over the same elements and remove the class:
|
||||
|
||||
```coffeescript
|
||||
magic: ->
|
||||
$('ol.entries li').each (i, el) ->
|
||||
if !$(el).hasClass("modified")
|
||||
if !$(el).hasClass("hide-me")
|
||||
$(el).addClass("hide-me")
|
||||
else
|
||||
$(el).removeClass("hide-me")
|
||||
```
|
||||
|
||||
## Creating a New Pane
|
||||
|
||||
The next goal of this package is to append a pane to the Atom editor that lists
|
||||
some information about the modified files.
|
||||
|
||||
To do that, we're going to first create a new class method called `content`. Every
|
||||
package that extends from the `View` class can provide an optional class method
|
||||
called `content`. The `content` method constructs the DOM that your package uses
|
||||
as its UI. The principals of `content` are built entirely on [SpacePen](https://github.com/nathansobo/space-pen),
|
||||
which we'll touch upon only briefly here.
|
||||
|
||||
Our display will simply be an unordered list of the file names, and their
|
||||
modified times. Let's start by carving out a `div` to hold the filenames:
|
||||
|
||||
```coffeescript
|
||||
@content: ->
|
||||
@div class: 'modified-files-container', =>
|
||||
@ul class: 'modified-files-list', outlet: 'modifiedFilesList', =>
|
||||
@li 'Test'
|
||||
@li 'Test2'
|
||||
```
|
||||
|
||||
You can add any HTML5 attribute you like. `outlet` names the variable
|
||||
your package can uses to manipulate the element directly. The fat pipe (`=>`) indicates
|
||||
that the next set are nested children.
|
||||
|
||||
We'll add one more line to `magic` to make this pane appear:
|
||||
|
||||
```coffeescript
|
||||
rootView.vertical.append(this)
|
||||
```
|
||||
|
||||
If you hit the key command, you'll see a box appear right underneath the editor.
|
||||
Success!
|
||||
|
||||
Before we populate this, let's apply some logic to toggle the pane off and on, just
|
||||
like we did with the tree view:
|
||||
|
||||
```coffeescript
|
||||
# toggles the pane
|
||||
if @hasParent()
|
||||
rootView.vertical.children().last().remove()
|
||||
else
|
||||
rootView.vertical.append(this)
|
||||
```
|
||||
|
||||
There are about a hundred different ways to toggle a pane on and off, and this
|
||||
might not be the most efficient one. If you know your package needs to be toggled
|
||||
on and off more freely, it might be better to draw the UI during the initialization,
|
||||
then immediately call `hide()` on the element to remove it from the view. You can
|
||||
then swap between `show()` and `hide()`, and instead of forcing Atom to add and remove
|
||||
the element as we're doing here, it'll just set a CSS property to control your package's
|
||||
visibility.
|
||||
|
||||
You might have noticed that our two `li` elements aren't showing up. Let's set
|
||||
a color on them so that they pop. Open up `changer.css` and add this CSS:
|
||||
|
||||
```css
|
||||
ul.modified-files-list {
|
||||
color: white;
|
||||
}
|
||||
```
|
||||
|
||||
Refresh Atom, hit the key combo, and see your brilliantly white test list.
|
||||
|
||||
## Calling Node.js Code
|
||||
|
||||
Since Atom is built on top of Node.js, you can call any of its libraries, including
|
||||
other modules that your package requires.
|
||||
|
||||
We'll iterate through our resulting tree, and construct the path to our modified
|
||||
file based on its depth in the tree:
|
||||
|
||||
```coffeescript
|
||||
path = require 'path'
|
||||
|
||||
# ...
|
||||
|
||||
modifiedFiles = []
|
||||
# for each single entry...
|
||||
$('ol.entries li.file.modified span.name').each (i, el) ->
|
||||
filePath = []
|
||||
# ...grab its name...
|
||||
filePath.unshift($(el).text())
|
||||
|
||||
# ... then find its parent directories, and grab their names
|
||||
parents = $(el).parents('.directory.modified')
|
||||
parents.each (i, el) ->
|
||||
filePath.unshift($(el).find('div.header span.name').eq(0).text())
|
||||
|
||||
modifiedFilePath = path.join(project.rootDirectory.path, filePath.join(path.sep))
|
||||
modifiedFiles.push modifiedFilePath
|
||||
```
|
||||
|
||||
`modifiedFiles` is an array containing a list of our modified files. We're also using
|
||||
the node.js [`path` library](http://nodejs.org/docs/latest/api/path.html) to get
|
||||
the proper directory separator for our system.
|
||||
|
||||
Let's remove the two `@li` elements we added in `@content`, so that we can populate
|
||||
our `modifiedFilesList` with real information. We'll do that by iterating over
|
||||
`modifiedFiles`, accessing a file's last modified time, and appending it to
|
||||
`modifiedFilesList`:
|
||||
|
||||
```coffeescript
|
||||
# toggles the pane
|
||||
if @hasParent()
|
||||
rootView.vertical.children().last().remove()
|
||||
else
|
||||
for file in modifiedFiles
|
||||
stat = fs.lstatSync(file)
|
||||
mtime = stat.mtime
|
||||
@modifiedFilesList.append("<li>#{file} - Modified at #{mtime}")
|
||||
rootView.vertical.append(this)
|
||||
```
|
||||
|
||||
When you toggle the modified files list, your pane is now populated with the filenames
|
||||
and modified times of files in your project. You might notice that subsequent calls
|
||||
to this command reduplicate information. We could provide an elegant way of rechecking
|
||||
files already in the list, but for this demonstration, we'll just clear the `modifiedFilesList`
|
||||
each time it's closed:
|
||||
|
||||
```coffeescript
|
||||
# toggles the pane
|
||||
if @hasParent()
|
||||
@modifiedFilesList.empty()
|
||||
rootView.vertical.children().last().remove()
|
||||
else
|
||||
for file in modifiedFiles
|
||||
stat = fs.lstatSync(file)
|
||||
mtime = stat.mtime
|
||||
@modifiedFilesList.append("<li>#{file} - Modified at #{mtime}")
|
||||
rootView.vertical.append(this)
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
# Included Libraries
|
||||
|
||||
In addition to core node.js modules, all packages can `require` the following popular
|
||||
libraries into their packages:
|
||||
|
||||
* [SpacePen](https://github.com/nathansobo/space-pen) (as `require 'space-pen'`)
|
||||
* [jQuery](http://jquery.com/) (as `require 'jquery'`)
|
||||
* [Underscore](http://underscorejs.org/) (as `require 'underscore'`)
|
||||
|
||||
Additional libraries can be found by browsing Atom's _node_modules_ folder.
|
||||
@@ -0,0 +1,18 @@
|
||||
# package.json format
|
||||
|
||||
The following keys are available to your package's _package.json_ manifest file:
|
||||
|
||||
- `main` (**Required**): the path to the CoffeeScript file that's the entry point
|
||||
to your package
|
||||
- `stylesheets` (**Optional**): an Array of Strings identifying the order of the
|
||||
stylesheets your package needs to load. If not specified, stylesheets in the _stylesheets_
|
||||
directory are added alphabetically.
|
||||
- `keymaps`(**Optional**): an Array of Strings identifying the order of the
|
||||
key mappings your package needs to load. If not specified, mappings in the _keymaps_
|
||||
directory are added alphabetically.
|
||||
- `snippets` (**Optional**): an Array of Strings identifying the order of the
|
||||
snippets your package needs to load. If not specified, snippets in the _snippets_
|
||||
directory are added alphabetically.
|
||||
- `activationEvents` (**Optional**): an Array of Strings identifying events that
|
||||
trigger your package's activation. You can delay the loading of your package until
|
||||
one of these events is trigged.
|
||||
@@ -1,4 +1,4 @@
|
||||
# Authoring A Theme
|
||||
# Authoring Themes
|
||||
|
||||
If you understand CSS, you can write an Atom theme easily. Your theme can style
|
||||
Atom's user interface, specify the appearance of syntax-highlighted code, or
|
||||
@@ -9,9 +9,9 @@ translate scope names to CSS classes. To theme Atom's user interface, take a
|
||||
look at the existing light and dark themes for an example. Pressing `alt-meta-i`
|
||||
and inspecting the Atom's markup directly can also be helpful.
|
||||
|
||||
The most basic theme is just a `.css` file. More complex themes occupy their own
|
||||
The most basic theme is just a _.css_ file. More complex themes occupy their own
|
||||
folder, which can contain multiple stylesheets along with an optional
|
||||
`package.cson` file containing a manifest to control their load-order:
|
||||
_package.cson_ file containing a manifest to control their load-order:
|
||||
|
||||
```text
|
||||
~/.atom/themes/
|
||||
Arquivo binário não exibido.
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_git_git_h__
|
||||
#define INCLUDE_git_git_h__
|
||||
|
||||
#include "git2/version.h"
|
||||
|
||||
#include "git2/common.h"
|
||||
#include "git2/threads.h"
|
||||
#include "git2/errors.h"
|
||||
|
||||
#include "git2/types.h"
|
||||
|
||||
#include "git2/oid.h"
|
||||
#include "git2/signature.h"
|
||||
#include "git2/odb.h"
|
||||
|
||||
#include "git2/repository.h"
|
||||
#include "git2/revwalk.h"
|
||||
#include "git2/merge.h"
|
||||
#include "git2/graph.h"
|
||||
#include "git2/refs.h"
|
||||
#include "git2/reflog.h"
|
||||
#include "git2/revparse.h"
|
||||
|
||||
#include "git2/object.h"
|
||||
#include "git2/blob.h"
|
||||
#include "git2/commit.h"
|
||||
#include "git2/tag.h"
|
||||
#include "git2/tree.h"
|
||||
#include "git2/diff.h"
|
||||
|
||||
#include "git2/index.h"
|
||||
#include "git2/config.h"
|
||||
#include "git2/transport.h"
|
||||
#include "git2/remote.h"
|
||||
#include "git2/clone.h"
|
||||
#include "git2/checkout.h"
|
||||
#include "git2/push.h"
|
||||
|
||||
#include "git2/attr.h"
|
||||
#include "git2/ignore.h"
|
||||
#include "git2/branch.h"
|
||||
#include "git2/refspec.h"
|
||||
#include "git2/net.h"
|
||||
#include "git2/status.h"
|
||||
#include "git2/indexer.h"
|
||||
#include "git2/submodule.h"
|
||||
#include "git2/notes.h"
|
||||
#include "git2/reset.h"
|
||||
#include "git2/message.h"
|
||||
#include "git2/pack.h"
|
||||
#include "git2/stash.h"
|
||||
|
||||
#endif
|
||||
@@ -1,241 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_attr_h__
|
||||
#define INCLUDE_git_attr_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* @file git2/attr.h
|
||||
* @brief Git attribute management routines
|
||||
* @defgroup git_attr Git attribute management routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* GIT_ATTR_TRUE checks if an attribute is set on. In core git
|
||||
* parlance, this the value for "Set" attributes.
|
||||
*
|
||||
* For example, if the attribute file contains:
|
||||
*
|
||||
* *.c foo
|
||||
*
|
||||
* Then for file `xyz.c` looking up attribute "foo" gives a value for
|
||||
* which `GIT_ATTR_TRUE(value)` is true.
|
||||
*/
|
||||
#define GIT_ATTR_TRUE(attr) (git_attr_value(attr) == GIT_ATTR_TRUE_T)
|
||||
|
||||
/**
|
||||
* GIT_ATTR_FALSE checks if an attribute is set off. In core git
|
||||
* parlance, this is the value for attributes that are "Unset" (not to
|
||||
* be confused with values that a "Unspecified").
|
||||
*
|
||||
* For example, if the attribute file contains:
|
||||
*
|
||||
* *.h -foo
|
||||
*
|
||||
* Then for file `zyx.h` looking up attribute "foo" gives a value for
|
||||
* which `GIT_ATTR_FALSE(value)` is true.
|
||||
*/
|
||||
#define GIT_ATTR_FALSE(attr) (git_attr_value(attr) == GIT_ATTR_FALSE_T)
|
||||
|
||||
/**
|
||||
* GIT_ATTR_UNSPECIFIED checks if an attribute is unspecified. This
|
||||
* may be due to the attribute not being mentioned at all or because
|
||||
* the attribute was explicitly set unspecified via the `!` operator.
|
||||
*
|
||||
* For example, if the attribute file contains:
|
||||
*
|
||||
* *.c foo
|
||||
* *.h -foo
|
||||
* onefile.c !foo
|
||||
*
|
||||
* Then for `onefile.c` looking up attribute "foo" yields a value with
|
||||
* `GIT_ATTR_UNSPECIFIED(value)` of true. Also, looking up "foo" on
|
||||
* file `onefile.rb` or looking up "bar" on any file will all give
|
||||
* `GIT_ATTR_UNSPECIFIED(value)` of true.
|
||||
*/
|
||||
#define GIT_ATTR_UNSPECIFIED(attr) (git_attr_value(attr) == GIT_ATTR_UNSPECIFIED_T)
|
||||
|
||||
/**
|
||||
* GIT_ATTR_HAS_VALUE checks if an attribute is set to a value (as
|
||||
* opposed to TRUE, FALSE or UNSPECIFIED). This would be the case if
|
||||
* for a file with something like:
|
||||
*
|
||||
* *.txt eol=lf
|
||||
*
|
||||
* Given this, looking up "eol" for `onefile.txt` will give back the
|
||||
* string "lf" and `GIT_ATTR_SET_TO_VALUE(attr)` will return true.
|
||||
*/
|
||||
#define GIT_ATTR_HAS_VALUE(attr) (git_attr_value(attr) == GIT_ATTR_VALUE_T)
|
||||
|
||||
typedef enum {
|
||||
GIT_ATTR_UNSPECIFIED_T = 0,
|
||||
GIT_ATTR_TRUE_T,
|
||||
GIT_ATTR_FALSE_T,
|
||||
GIT_ATTR_VALUE_T,
|
||||
} git_attr_t;
|
||||
|
||||
/*
|
||||
* Return the value type for a given attribute.
|
||||
*
|
||||
* This can be either `TRUE`, `FALSE`, `UNSPECIFIED` (if the attribute
|
||||
* was not set at all), or `VALUE`, if the attribute was set to
|
||||
* an actual string.
|
||||
*
|
||||
* If the attribute has a `VALUE` string, it can be accessed normally
|
||||
* as a NULL-terminated C string.
|
||||
*
|
||||
* @param attr The attribute
|
||||
* @return the value type for the attribute
|
||||
*/
|
||||
GIT_EXTERN(git_attr_t) git_attr_value(const char *attr);
|
||||
|
||||
/**
|
||||
* Check attribute flags: Reading values from index and working directory.
|
||||
*
|
||||
* When checking attributes, it is possible to check attribute files
|
||||
* in both the working directory (if there is one) and the index (if
|
||||
* there is one). You can explicitly choose where to check and in
|
||||
* which order using the following flags.
|
||||
*
|
||||
* Core git usually checks the working directory then the index,
|
||||
* except during a checkout when it checks the index first. It will
|
||||
* use index only for creating archives or for a bare repo (if an
|
||||
* index has been specified for the bare repo).
|
||||
*/
|
||||
#define GIT_ATTR_CHECK_FILE_THEN_INDEX 0
|
||||
#define GIT_ATTR_CHECK_INDEX_THEN_FILE 1
|
||||
#define GIT_ATTR_CHECK_INDEX_ONLY 2
|
||||
|
||||
/**
|
||||
* Check attribute flags: Using the system attributes file.
|
||||
*
|
||||
* Normally, attribute checks include looking in the /etc (or system
|
||||
* equivalent) directory for a `gitattributes` file. Passing this
|
||||
* flag will cause attribute checks to ignore that file.
|
||||
*/
|
||||
#define GIT_ATTR_CHECK_NO_SYSTEM (1 << 2)
|
||||
|
||||
/**
|
||||
* Look up the value of one git attribute for path.
|
||||
*
|
||||
* @param value_out Output of the value of the attribute. Use the GIT_ATTR_...
|
||||
* macros to test for TRUE, FALSE, UNSPECIFIED, etc. or just
|
||||
* use the string value for attributes set to a value. You
|
||||
* should NOT modify or free this value.
|
||||
* @param repo The repository containing the path.
|
||||
* @param flags A combination of GIT_ATTR_CHECK... flags.
|
||||
* @param path The path to check for attributes. Relative paths are
|
||||
* interpreted relative to the repo root. The file does
|
||||
* not have to exist, but if it does not, then it will be
|
||||
* treated as a plain file (not a directory).
|
||||
* @param name The name of the attribute to look up.
|
||||
*/
|
||||
GIT_EXTERN(int) git_attr_get(
|
||||
const char **value_out,
|
||||
git_repository *repo,
|
||||
uint32_t flags,
|
||||
const char *path,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* Look up a list of git attributes for path.
|
||||
*
|
||||
* Use this if you have a known list of attributes that you want to
|
||||
* look up in a single call. This is somewhat more efficient than
|
||||
* calling `git_attr_get()` multiple times.
|
||||
*
|
||||
* For example, you might write:
|
||||
*
|
||||
* const char *attrs[] = { "crlf", "diff", "foo" };
|
||||
* const char **values[3];
|
||||
* git_attr_get_many(values, repo, 0, "my/fun/file.c", 3, attrs);
|
||||
*
|
||||
* Then you could loop through the 3 values to get the settings for
|
||||
* the three attributes you asked about.
|
||||
*
|
||||
* @param values An array of num_attr entries that will have string
|
||||
* pointers written into it for the values of the attributes.
|
||||
* You should not modify or free the values that are written
|
||||
* into this array (although of course, you should free the
|
||||
* array itself if you allocated it).
|
||||
* @param repo The repository containing the path.
|
||||
* @param flags A combination of GIT_ATTR_CHECK... flags.
|
||||
* @param path The path inside the repo to check attributes. This
|
||||
* does not have to exist, but if it does not, then
|
||||
* it will be treated as a plain file (i.e. not a directory).
|
||||
* @param num_attr The number of attributes being looked up
|
||||
* @param names An array of num_attr strings containing attribute names.
|
||||
*/
|
||||
GIT_EXTERN(int) git_attr_get_many(
|
||||
const char **values_out,
|
||||
git_repository *repo,
|
||||
uint32_t flags,
|
||||
const char *path,
|
||||
size_t num_attr,
|
||||
const char **names);
|
||||
|
||||
typedef int (*git_attr_foreach_cb)(const char *name, const char *value, void *payload);
|
||||
|
||||
/**
|
||||
* Loop over all the git attributes for a path.
|
||||
*
|
||||
* @param repo The repository containing the path.
|
||||
* @param flags A combination of GIT_ATTR_CHECK... flags.
|
||||
* @param path Path inside the repo to check attributes. This does not have
|
||||
* to exist, but if it does not, then it will be treated as a
|
||||
* plain file (i.e. not a directory).
|
||||
* @param callback Function to invoke on each attribute name and value. The
|
||||
* value may be NULL is the attribute is explicitly set to
|
||||
* UNSPECIFIED using the '!' sign. Callback will be invoked
|
||||
* only once per attribute name, even if there are multiple
|
||||
* rules for a given file. The highest priority rule will be
|
||||
* used. Return a non-zero value from this to stop looping.
|
||||
* @param payload Passed on as extra parameter to callback function.
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_attr_foreach(
|
||||
git_repository *repo,
|
||||
uint32_t flags,
|
||||
const char *path,
|
||||
git_attr_foreach_cb callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Flush the gitattributes cache.
|
||||
*
|
||||
* Call this if you have reason to believe that the attributes files on
|
||||
* disk no longer match the cached contents of memory. This will cause
|
||||
* the attributes files to be reloaded the next time that an attribute
|
||||
* access function is called.
|
||||
*/
|
||||
GIT_EXTERN(void) git_attr_cache_flush(
|
||||
git_repository *repo);
|
||||
|
||||
/**
|
||||
* Add a macro definition.
|
||||
*
|
||||
* Macros will automatically be loaded from the top level `.gitattributes`
|
||||
* file of the repository (plus the build-in "binary" macro). This
|
||||
* function allows you to add others. For example, to add the default
|
||||
* macro, you would call:
|
||||
*
|
||||
* git_attr_add_macro(repo, "binary", "-diff -crlf");
|
||||
*/
|
||||
GIT_EXTERN(int) git_attr_add_macro(
|
||||
git_repository *repo,
|
||||
const char *name,
|
||||
const char *values);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
|
||||
@@ -1,201 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_blob_h__
|
||||
#define INCLUDE_git_blob_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
#include "object.h"
|
||||
|
||||
/**
|
||||
* @file git2/blob.h
|
||||
* @brief Git blob load and write routines
|
||||
* @defgroup git_blob Git blob load and write routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Lookup a blob object from a repository.
|
||||
*
|
||||
* @param blob pointer to the looked up blob
|
||||
* @param repo the repo to use when locating the blob.
|
||||
* @param id identity of the blob to locate.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_INLINE(int) git_blob_lookup(git_blob **blob, git_repository *repo, const git_oid *id)
|
||||
{
|
||||
return git_object_lookup((git_object **)blob, repo, id, GIT_OBJ_BLOB);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup a blob object from a repository,
|
||||
* given a prefix of its identifier (short id).
|
||||
*
|
||||
* @see git_object_lookup_prefix
|
||||
*
|
||||
* @param blob pointer to the looked up blob
|
||||
* @param repo the repo to use when locating the blob.
|
||||
* @param id identity of the blob to locate.
|
||||
* @param len the length of the short identifier
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_INLINE(int) git_blob_lookup_prefix(git_blob **blob, git_repository *repo, const git_oid *id, size_t len)
|
||||
{
|
||||
return git_object_lookup_prefix((git_object **)blob, repo, id, len, GIT_OBJ_BLOB);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close an open blob
|
||||
*
|
||||
* This is a wrapper around git_object_free()
|
||||
*
|
||||
* IMPORTANT:
|
||||
* It *is* necessary to call this method when you stop
|
||||
* using a blob. Failure to do so will cause a memory leak.
|
||||
*
|
||||
* @param blob the blob to close
|
||||
*/
|
||||
|
||||
GIT_INLINE(void) git_blob_free(git_blob *blob)
|
||||
{
|
||||
git_object_free((git_object *) blob);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id of a blob.
|
||||
*
|
||||
* @param blob a previously loaded blob.
|
||||
* @return SHA1 hash for this blob.
|
||||
*/
|
||||
GIT_INLINE(const git_oid *) git_blob_id(const git_blob *blob)
|
||||
{
|
||||
return git_object_id((const git_object *)blob);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a read-only buffer with the raw content of a blob.
|
||||
*
|
||||
* A pointer to the raw content of a blob is returned;
|
||||
* this pointer is owned internally by the object and shall
|
||||
* not be free'd. The pointer may be invalidated at a later
|
||||
* time.
|
||||
*
|
||||
* @param blob pointer to the blob
|
||||
* @return the pointer; NULL if the blob has no contents
|
||||
*/
|
||||
GIT_EXTERN(const void *) git_blob_rawcontent(const git_blob *blob);
|
||||
|
||||
/**
|
||||
* Get the size in bytes of the contents of a blob
|
||||
*
|
||||
* @param blob pointer to the blob
|
||||
* @return size on bytes
|
||||
*/
|
||||
GIT_EXTERN(git_off_t) git_blob_rawsize(const git_blob *blob);
|
||||
|
||||
/**
|
||||
* Read a file from the working folder of a repository
|
||||
* and write it to the Object Database as a loose blob
|
||||
*
|
||||
* @param id return the id of the written blob
|
||||
* @param repo repository where the blob will be written.
|
||||
* this repository cannot be bare
|
||||
* @param relative_path file from which the blob will be created,
|
||||
* relative to the repository's working dir
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_blob_create_fromworkdir(git_oid *id, git_repository *repo, const char *relative_path);
|
||||
|
||||
/**
|
||||
* Read a file from the filesystem and write its content
|
||||
* to the Object Database as a loose blob
|
||||
*
|
||||
* @param id return the id of the written blob
|
||||
* @param repo repository where the blob will be written.
|
||||
* this repository can be bare or not
|
||||
* @param path file from which the blob will be created
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_blob_create_fromdisk(git_oid *id, git_repository *repo, const char *path);
|
||||
|
||||
|
||||
typedef int (*git_blob_chunk_cb)(char *content, size_t max_length, void *payload);
|
||||
|
||||
/**
|
||||
* Write a loose blob to the Object Database from a
|
||||
* provider of chunks of data.
|
||||
*
|
||||
* Provided the `hintpath` parameter is filled, its value
|
||||
* will help to determine what git filters should be applied
|
||||
* to the object before it can be placed to the object database.
|
||||
*
|
||||
*
|
||||
* The implementation of the callback has to respect the
|
||||
* following rules:
|
||||
*
|
||||
* - `content` will have to be filled by the consumer. The maximum number
|
||||
* of bytes that the buffer can accept per call is defined by the
|
||||
* `max_length` parameter. Allocation and freeing of the buffer will be taken
|
||||
* care of by the function.
|
||||
*
|
||||
* - The callback is expected to return the number of bytes
|
||||
* that `content` have been filled with.
|
||||
*
|
||||
* - When there is no more data to stream, the callback should
|
||||
* return 0. This will prevent it from being invoked anymore.
|
||||
*
|
||||
* - When an error occurs, the callback should return -1.
|
||||
*
|
||||
*
|
||||
* @param id Return the id of the written blob
|
||||
*
|
||||
* @param repo repository where the blob will be written.
|
||||
* This repository can be bare or not.
|
||||
*
|
||||
* @param hintpath if not NULL, will help selecting the filters
|
||||
* to apply onto the content of the blob to be created.
|
||||
*
|
||||
* @return GIT_SUCCESS or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_blob_create_fromchunks(
|
||||
git_oid *id,
|
||||
git_repository *repo,
|
||||
const char *hintpath,
|
||||
git_blob_chunk_cb callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Write an in-memory buffer to the ODB as a blob
|
||||
*
|
||||
* @param oid return the oid of the written blob
|
||||
* @param repo repository where to blob will be written
|
||||
* @param buffer data to be written into the blob
|
||||
* @param len length of the data
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_blob_create_frombuffer(git_oid *oid, git_repository *repo, const void *buffer, size_t len);
|
||||
|
||||
/**
|
||||
* Determine if the blob content is most certainly binary or not.
|
||||
*
|
||||
* The heuristic used to guess if a file is binary is taken from core git:
|
||||
* Searching for NUL bytes and looking for a reasonable ratio of printable
|
||||
* to non-printable characters among the first 4000 bytes.
|
||||
*
|
||||
* @param blob The blob which content should be analyzed
|
||||
* @return 1 if the content of the blob is detected
|
||||
* as binary; 0 otherwise.
|
||||
*/
|
||||
GIT_EXTERN(int) git_blob_is_binary(git_blob *blob);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,173 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_branch_h__
|
||||
#define INCLUDE_git_branch_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "oid.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* @file git2/branch.h
|
||||
* @brief Git branch parsing routines
|
||||
* @defgroup git_branch Git branch management
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Create a new branch pointing at a target commit
|
||||
*
|
||||
* A new direct reference will be created pointing to
|
||||
* this target commit. If `force` is true and a reference
|
||||
* already exists with the given name, it'll be replaced.
|
||||
*
|
||||
* The returned reference must be freed by the user.
|
||||
*
|
||||
* The branch name will be checked for validity.
|
||||
* See `git_tag_create()` for rules about valid names.
|
||||
*
|
||||
* @param out Pointer where to store the underlying reference.
|
||||
*
|
||||
* @param branch_name Name for the branch; this name is
|
||||
* validated for consistency. It should also not conflict with
|
||||
* an already existing branch name.
|
||||
*
|
||||
* @param target Object to which this branch should point. This object
|
||||
* must belong to the given `repo` and can either be a git_commit or a
|
||||
* git_tag. When a git_tag is being passed, it should be dereferencable
|
||||
* to a git_commit which oid will be used as the target of the branch.
|
||||
*
|
||||
* @param force Overwrite existing branch.
|
||||
*
|
||||
* @return 0, GIT_EINVALIDSPEC or an error code.
|
||||
* A proper reference is written in the refs/heads namespace
|
||||
* pointing to the provided target commit.
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_create(
|
||||
git_reference **out,
|
||||
git_repository *repo,
|
||||
const char *branch_name,
|
||||
const git_commit *target,
|
||||
int force);
|
||||
|
||||
/**
|
||||
* Delete an existing branch reference.
|
||||
*
|
||||
* If the branch is successfully deleted, the passed reference
|
||||
* object will be freed and invalidated.
|
||||
*
|
||||
* @param branch A valid reference representing a branch
|
||||
* @return 0 on success, or an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_delete(git_reference *branch);
|
||||
|
||||
/**
|
||||
* Loop over all the branches and issue a callback for each one.
|
||||
*
|
||||
* If the callback returns a non-zero value, this will stop looping.
|
||||
*
|
||||
* @param repo Repository where to find the branches.
|
||||
*
|
||||
* @param list_flags Filtering flags for the branch
|
||||
* listing. Valid values are GIT_BRANCH_LOCAL, GIT_BRANCH_REMOTE
|
||||
* or a combination of the two.
|
||||
*
|
||||
* @param branch_cb Callback to invoke per found branch.
|
||||
*
|
||||
* @param payload Extra parameter to callback function.
|
||||
*
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_foreach(
|
||||
git_repository *repo,
|
||||
unsigned int list_flags,
|
||||
int (*branch_cb)(
|
||||
const char *branch_name,
|
||||
git_branch_t branch_type,
|
||||
void *payload),
|
||||
void *payload
|
||||
);
|
||||
|
||||
/**
|
||||
* Move/rename an existing local branch reference.
|
||||
*
|
||||
* The new branch name will be checked for validity.
|
||||
* See `git_tag_create()` for rules about valid names.
|
||||
*
|
||||
* @param branch Current underlying reference of the branch.
|
||||
*
|
||||
* @param new_branch_name Target name of the branch once the move
|
||||
* is performed; this name is validated for consistency.
|
||||
*
|
||||
* @param force Overwrite existing branch.
|
||||
*
|
||||
* @return 0 on success, GIT_EINVALIDSPEC or an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_move(
|
||||
git_reference *branch,
|
||||
const char *new_branch_name,
|
||||
int force);
|
||||
|
||||
/**
|
||||
* Lookup a branch by its name in a repository.
|
||||
*
|
||||
* The generated reference must be freed by the user.
|
||||
*
|
||||
* The branch name will be checked for validity.
|
||||
* See `git_tag_create()` for rules about valid names.
|
||||
*
|
||||
* @param out pointer to the looked-up branch reference
|
||||
*
|
||||
* @param repo the repository to look up the branch
|
||||
*
|
||||
* @param branch_name Name of the branch to be looked-up;
|
||||
* this name is validated for consistency.
|
||||
*
|
||||
* @param branch_type Type of the considered branch. This should
|
||||
* be valued with either GIT_BRANCH_LOCAL or GIT_BRANCH_REMOTE.
|
||||
*
|
||||
* @return 0 on success; GIT_ENOTFOUND when no matching branch
|
||||
* exists, GIT_EINVALIDSPEC, otherwise an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_lookup(
|
||||
git_reference **out,
|
||||
git_repository *repo,
|
||||
const char *branch_name,
|
||||
git_branch_t branch_type);
|
||||
|
||||
/**
|
||||
* Return the reference supporting the remote tracking branch,
|
||||
* given a local branch reference.
|
||||
*
|
||||
* @param out Pointer where to store the retrieved
|
||||
* reference.
|
||||
*
|
||||
* @param branch Current underlying reference of the branch.
|
||||
*
|
||||
* @return 0 on success; GIT_ENOTFOUND when no remote tracking
|
||||
* reference exists, otherwise an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_tracking(
|
||||
git_reference **out,
|
||||
git_reference *branch);
|
||||
|
||||
/**
|
||||
* Determine if the current local branch is pointed at by HEAD.
|
||||
*
|
||||
* @param branch Current underlying reference of the branch.
|
||||
*
|
||||
* @return 1 if HEAD points at the branch, 0 if it isn't,
|
||||
* error code otherwise.
|
||||
*/
|
||||
GIT_EXTERN(int) git_branch_is_head(
|
||||
git_reference *branch);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,281 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_checkout_h__
|
||||
#define INCLUDE_git_checkout_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "diff.h"
|
||||
|
||||
/**
|
||||
* @file git2/checkout.h
|
||||
* @brief Git checkout routines
|
||||
* @defgroup git_checkout Git checkout routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Checkout behavior flags
|
||||
*
|
||||
* In libgit2, checkout is used to update the working directory and index
|
||||
* to match a target tree. Unlike git checkout, it does not move the HEAD
|
||||
* commit for you - use `git_repository_set_head` or the like to do that.
|
||||
*
|
||||
* Checkout looks at (up to) four things: the "target" tree you want to
|
||||
* check out, the "baseline" tree of what was checked out previously, the
|
||||
* working directory for actual files, and the index for staged changes.
|
||||
*
|
||||
* You give checkout one of four strategies for update:
|
||||
*
|
||||
* - `GIT_CHECKOUT_NONE` is a dry-run strategy that checks for conflicts,
|
||||
* etc., but doesn't make any actual changes.
|
||||
*
|
||||
* - `GIT_CHECKOUT_FORCE` is at the opposite extreme, taking any action to
|
||||
* make the working directory match the target (including potentially
|
||||
* discarding modified files).
|
||||
*
|
||||
* In between those are `GIT_CHECKOUT_SAFE` and `GIT_CHECKOUT_SAFE_CREATE`
|
||||
* both of which only make modifications that will not lose changes.
|
||||
*
|
||||
* | target == baseline | target != baseline |
|
||||
* ---------------------|-----------------------|----------------------|
|
||||
* workdir == baseline | no action | create, update, or |
|
||||
* | | delete file |
|
||||
* ---------------------|-----------------------|----------------------|
|
||||
* workdir exists and | no action | conflict (notify |
|
||||
* is != baseline | notify dirty MODIFIED | and cancel checkout) |
|
||||
* ---------------------|-----------------------|----------------------|
|
||||
* workdir missing, | create if SAFE_CREATE | create file |
|
||||
* baseline present | notify dirty DELETED | |
|
||||
* ---------------------|-----------------------|----------------------|
|
||||
*
|
||||
* The only difference between SAFE and SAFE_CREATE is that SAFE_CREATE
|
||||
* will cause a file to be checked out if it is missing from the working
|
||||
* directory even if it is not modified between the target and baseline.
|
||||
*
|
||||
*
|
||||
* To emulate `git checkout`, use `GIT_CHECKOUT_SAFE` with a checkout
|
||||
* notification callback (see below) that displays information about dirty
|
||||
* files. The default behavior will cancel checkout on conflicts.
|
||||
*
|
||||
* To emulate `git checkout-index`, use `GIT_CHECKOUT_SAFE_CREATE` with a
|
||||
* notification callback that cancels the operation if a dirty-but-existing
|
||||
* file is found in the working directory. This core git command isn't
|
||||
* quite "force" but is sensitive about some types of changes.
|
||||
*
|
||||
* To emulate `git checkout -f`, use `GIT_CHECKOUT_FORCE`.
|
||||
*
|
||||
* To emulate `git clone` use `GIT_CHECKOUT_SAFE_CREATE` in the options.
|
||||
*
|
||||
*
|
||||
* There are some additional flags to modified the behavior of checkout:
|
||||
*
|
||||
* - GIT_CHECKOUT_ALLOW_CONFLICTS makes SAFE mode apply safe file updates
|
||||
* even if there are conflicts (instead of cancelling the checkout).
|
||||
*
|
||||
* - GIT_CHECKOUT_REMOVE_UNTRACKED means remove untracked files (i.e. not
|
||||
* in target, baseline, or index, and not ignored) from the working dir.
|
||||
*
|
||||
* - GIT_CHECKOUT_REMOVE_IGNORED means remove ignored files (that are also
|
||||
* untracked) from the working directory as well.
|
||||
*
|
||||
* - GIT_CHECKOUT_UPDATE_ONLY means to only update the content of files that
|
||||
* already exist. Files will not be created nor deleted. This just skips
|
||||
* applying adds, deletes, and typechanges.
|
||||
*
|
||||
* - GIT_CHECKOUT_DONT_UPDATE_INDEX prevents checkout from writing the
|
||||
* updated files' information to the index.
|
||||
*
|
||||
* - Normally, checkout will reload the index and git attributes from disk
|
||||
* before any operations. GIT_CHECKOUT_NO_REFRESH prevents this reload.
|
||||
*
|
||||
* - Unmerged index entries are conflicts. GIT_CHECKOUT_SKIP_UNMERGED skips
|
||||
* files with unmerged index entries instead. GIT_CHECKOUT_USE_OURS and
|
||||
* GIT_CHECKOUT_USE_THEIRS to proceed with the checkout using either the
|
||||
* stage 2 ("ours") or stage 3 ("theirs") version of files in the index.
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_CHECKOUT_NONE = 0, /** default is a dry run, no actual updates */
|
||||
|
||||
/** Allow safe updates that cannot overwrite uncommitted data */
|
||||
GIT_CHECKOUT_SAFE = (1u << 0),
|
||||
|
||||
/** Allow safe updates plus creation of missing files */
|
||||
GIT_CHECKOUT_SAFE_CREATE = (1u << 1),
|
||||
|
||||
/** Allow all updates to force working directory to look like index */
|
||||
GIT_CHECKOUT_FORCE = (1u << 2),
|
||||
|
||||
|
||||
/** Allow checkout to make safe updates even if conflicts are found */
|
||||
GIT_CHECKOUT_ALLOW_CONFLICTS = (1u << 4),
|
||||
|
||||
/** Remove untracked files not in index (that are not ignored) */
|
||||
GIT_CHECKOUT_REMOVE_UNTRACKED = (1u << 5),
|
||||
|
||||
/** Remove ignored files not in index */
|
||||
GIT_CHECKOUT_REMOVE_IGNORED = (1u << 6),
|
||||
|
||||
/** Only update existing files, don't create new ones */
|
||||
GIT_CHECKOUT_UPDATE_ONLY = (1u << 7),
|
||||
|
||||
/** Normally checkout updates index entries as it goes; this stops that */
|
||||
GIT_CHECKOUT_DONT_UPDATE_INDEX = (1u << 8),
|
||||
|
||||
/** Don't refresh index/config/etc before doing checkout */
|
||||
GIT_CHECKOUT_NO_REFRESH = (1u << 9),
|
||||
|
||||
/**
|
||||
* THE FOLLOWING OPTIONS ARE NOT YET IMPLEMENTED
|
||||
*/
|
||||
|
||||
/** Allow checkout to skip unmerged files (NOT IMPLEMENTED) */
|
||||
GIT_CHECKOUT_SKIP_UNMERGED = (1u << 10),
|
||||
/** For unmerged files, checkout stage 2 from index (NOT IMPLEMENTED) */
|
||||
GIT_CHECKOUT_USE_OURS = (1u << 11),
|
||||
/** For unmerged files, checkout stage 3 from index (NOT IMPLEMENTED) */
|
||||
GIT_CHECKOUT_USE_THEIRS = (1u << 12),
|
||||
|
||||
/** Recursively checkout submodules with same options (NOT IMPLEMENTED) */
|
||||
GIT_CHECKOUT_UPDATE_SUBMODULES = (1u << 16),
|
||||
/** Recursively checkout submodules if HEAD moved in super repo (NOT IMPLEMENTED) */
|
||||
GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = (1u << 17),
|
||||
|
||||
} git_checkout_strategy_t;
|
||||
|
||||
/**
|
||||
* Checkout notification flags
|
||||
*
|
||||
* Checkout will invoke an options notification callback (`notify_cb`) for
|
||||
* certain cases - you pick which ones via `notify_flags`:
|
||||
*
|
||||
* - GIT_CHECKOUT_NOTIFY_CONFLICT invokes checkout on conflicting paths.
|
||||
*
|
||||
* - GIT_CHECKOUT_NOTIFY_DIRTY notifies about "dirty" files, i.e. those that
|
||||
* do not need an update but no longer match the baseline. Core git
|
||||
* displays these files when checkout runs, but won't stop the checkout.
|
||||
*
|
||||
* - GIT_CHECKOUT_NOTIFY_UPDATED sends notification for any file changed.
|
||||
*
|
||||
* - GIT_CHECKOUT_NOTIFY_UNTRACKED notifies about untracked files.
|
||||
*
|
||||
* - GIT_CHECKOUT_NOTIFY_IGNORED notifies about ignored files.
|
||||
*
|
||||
* Returning a non-zero value from this callback will cancel the checkout.
|
||||
* Notification callbacks are made prior to modifying any files on disk.
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_CHECKOUT_NOTIFY_NONE = 0,
|
||||
GIT_CHECKOUT_NOTIFY_CONFLICT = (1u << 0),
|
||||
GIT_CHECKOUT_NOTIFY_DIRTY = (1u << 1),
|
||||
GIT_CHECKOUT_NOTIFY_UPDATED = (1u << 2),
|
||||
GIT_CHECKOUT_NOTIFY_UNTRACKED = (1u << 3),
|
||||
GIT_CHECKOUT_NOTIFY_IGNORED = (1u << 4),
|
||||
} git_checkout_notify_t;
|
||||
|
||||
/** Checkout notification callback function */
|
||||
typedef int (*git_checkout_notify_cb)(
|
||||
git_checkout_notify_t why,
|
||||
const char *path,
|
||||
const git_diff_file *baseline,
|
||||
const git_diff_file *target,
|
||||
const git_diff_file *workdir,
|
||||
void *payload);
|
||||
|
||||
/** Checkout progress notification function */
|
||||
typedef void (*git_checkout_progress_cb)(
|
||||
const char *path,
|
||||
size_t completed_steps,
|
||||
size_t total_steps,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Checkout options structure
|
||||
*
|
||||
* Zero out for defaults. Initialize with `GIT_CHECKOUT_OPTS_INIT` macro to
|
||||
* correctly set the `version` field. E.g.
|
||||
*
|
||||
* git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
|
||||
*/
|
||||
typedef struct git_checkout_opts {
|
||||
unsigned int version;
|
||||
|
||||
unsigned int checkout_strategy; /** default will be a dry run */
|
||||
|
||||
int disable_filters; /** don't apply filters like CRLF conversion */
|
||||
unsigned int dir_mode; /** default is 0755 */
|
||||
unsigned int file_mode; /** default is 0644 or 0755 as dictated by blob */
|
||||
int file_open_flags; /** default is O_CREAT | O_TRUNC | O_WRONLY */
|
||||
|
||||
unsigned int notify_flags; /** see `git_checkout_notify_t` above */
|
||||
git_checkout_notify_cb notify_cb;
|
||||
void *notify_payload;
|
||||
|
||||
/* Optional callback to notify the consumer of checkout progress. */
|
||||
git_checkout_progress_cb progress_cb;
|
||||
void *progress_payload;
|
||||
|
||||
/** When not zeroed out, array of fnmatch patterns specifying which
|
||||
* paths should be taken into account, otherwise all files.
|
||||
*/
|
||||
git_strarray paths;
|
||||
|
||||
git_tree *baseline; /** expected content of workdir, defaults to HEAD */
|
||||
} git_checkout_opts;
|
||||
|
||||
#define GIT_CHECKOUT_OPTS_VERSION 1
|
||||
#define GIT_CHECKOUT_OPTS_INIT {GIT_CHECKOUT_OPTS_VERSION}
|
||||
|
||||
/**
|
||||
* Updates files in the index and the working tree to match the content of
|
||||
* the commit pointed at by HEAD.
|
||||
*
|
||||
* @param repo repository to check out (must be non-bare)
|
||||
* @param opts specifies checkout options (may be NULL)
|
||||
* @return 0 on success, GIT_EORPHANEDHEAD when HEAD points to a non existing
|
||||
* branch, GIT_ERROR otherwise (use giterr_last for information
|
||||
* about the error)
|
||||
*/
|
||||
GIT_EXTERN(int) git_checkout_head(
|
||||
git_repository *repo,
|
||||
git_checkout_opts *opts);
|
||||
|
||||
/**
|
||||
* Updates files in the working tree to match the content of the index.
|
||||
*
|
||||
* @param repo repository into which to check out (must be non-bare)
|
||||
* @param index index to be checked out (or NULL to use repository index)
|
||||
* @param opts specifies checkout options (may be NULL)
|
||||
* @return 0 on success, GIT_ERROR otherwise (use giterr_last for information
|
||||
* about the error)
|
||||
*/
|
||||
GIT_EXTERN(int) git_checkout_index(
|
||||
git_repository *repo,
|
||||
git_index *index,
|
||||
git_checkout_opts *opts);
|
||||
|
||||
/**
|
||||
* Updates files in the index and working tree to match the content of the
|
||||
* tree pointed at by the treeish.
|
||||
*
|
||||
* @param repo repository to check out (must be non-bare)
|
||||
* @param treeish a commit, tag or tree which content will be used to update
|
||||
* the working directory
|
||||
* @param opts specifies checkout options (may be NULL)
|
||||
* @return 0 on success, GIT_ERROR otherwise (use giterr_last for information
|
||||
* about the error)
|
||||
*/
|
||||
GIT_EXTERN(int) git_checkout_tree(
|
||||
git_repository *repo,
|
||||
const git_object *treeish,
|
||||
git_checkout_opts *opts);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_clone_h__
|
||||
#define INCLUDE_git_clone_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "indexer.h"
|
||||
#include "checkout.h"
|
||||
#include "remote.h"
|
||||
|
||||
|
||||
/**
|
||||
* @file git2/clone.h
|
||||
* @brief Git cloning routines
|
||||
* @defgroup git_clone Git cloning routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Clone options structure
|
||||
*
|
||||
* Use zeros to indicate default settings. It's easiest to use the
|
||||
* `GIT_CLONE_OPTIONS_INIT` macro:
|
||||
*
|
||||
* git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
|
||||
*
|
||||
* - `checkout_opts` is options for the checkout step. To disable checkout,
|
||||
* set the `checkout_strategy` to GIT_CHECKOUT_DEFAULT.
|
||||
* - `bare` should be set to zero to create a standard repo, non-zero for
|
||||
* a bare repo
|
||||
* - `fetch_progress_cb` is optional callback for fetch progress. Be aware that
|
||||
* this is called inline with network and indexing operations, so performance
|
||||
* may be affected.
|
||||
* - `fetch_progress_payload` is payload for fetch_progress_cb
|
||||
*
|
||||
* ** "origin" remote options: **
|
||||
* - `remote_name` is the name given to the "origin" remote. The default is
|
||||
* "origin".
|
||||
* - `pushurl` is a URL to be used for pushing. NULL means use the fetch url.
|
||||
* - `fetch_spec` is the fetch specification to be used for fetching. NULL
|
||||
* results in the same behavior as GIT_REMOTE_DEFAULT_FETCH.
|
||||
* - `push_spec` is the fetch specification to be used for pushing. NULL means
|
||||
* use the same spec as for fetching.
|
||||
* - `cred_acquire_cb` is a callback to be used if credentials are required
|
||||
* during the initial fetch.
|
||||
* - `cred_acquire_payload` is the payload for the above callback.
|
||||
* - `transport` is a custom transport to be used for the initial fetch. NULL
|
||||
* means use the transport autodetected from the URL.
|
||||
* - `remote_callbacks` may be used to specify custom progress callbacks for
|
||||
* the origin remote before the fetch is initiated.
|
||||
* - `remote_autotag` may be used to specify the autotag setting before the
|
||||
* initial fetch.
|
||||
*/
|
||||
|
||||
typedef struct git_clone_options {
|
||||
unsigned int version;
|
||||
|
||||
git_checkout_opts checkout_opts;
|
||||
int bare;
|
||||
git_transfer_progress_callback fetch_progress_cb;
|
||||
void *fetch_progress_payload;
|
||||
|
||||
const char *remote_name;
|
||||
const char *pushurl;
|
||||
const char *fetch_spec;
|
||||
const char *push_spec;
|
||||
git_cred_acquire_cb cred_acquire_cb;
|
||||
void *cred_acquire_payload;
|
||||
git_transport *transport;
|
||||
git_remote_callbacks *remote_callbacks;
|
||||
git_remote_autotag_option_t remote_autotag;
|
||||
} git_clone_options;
|
||||
|
||||
#define GIT_CLONE_OPTIONS_VERSION 1
|
||||
#define GIT_CLONE_OPTIONS_INIT {GIT_CLONE_OPTIONS_VERSION, {GIT_CHECKOUT_OPTS_VERSION, GIT_CHECKOUT_SAFE}}
|
||||
|
||||
/**
|
||||
* Clone a remote repository, and checkout the branch pointed to by the remote
|
||||
* HEAD.
|
||||
*
|
||||
* @param out pointer that will receive the resulting repository object
|
||||
* @param origin_remote a remote which will act as the initial fetch source
|
||||
* @param local_path local directory to clone to
|
||||
* @param options configuration options for the clone. If NULL, the function
|
||||
* works as though GIT_OPTIONS_INIT were passed.
|
||||
* @return 0 on success, GIT_ERROR otherwise (use giterr_last for information
|
||||
* about the error)
|
||||
*/
|
||||
GIT_EXTERN(int) git_clone(
|
||||
git_repository **out,
|
||||
const char *url,
|
||||
const char *local_path,
|
||||
const git_clone_options *options);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,292 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_commit_h__
|
||||
#define INCLUDE_git_commit_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
#include "object.h"
|
||||
|
||||
/**
|
||||
* @file git2/commit.h
|
||||
* @brief Git commit parsing, formatting routines
|
||||
* @defgroup git_commit Git commit parsing, formatting routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Lookup a commit object from a repository.
|
||||
*
|
||||
* @param commit pointer to the looked up commit
|
||||
* @param repo the repo to use when locating the commit.
|
||||
* @param id identity of the commit to locate. If the object is
|
||||
* an annotated tag it will be peeled back to the commit.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_INLINE(int) git_commit_lookup(git_commit **commit, git_repository *repo, const git_oid *id)
|
||||
{
|
||||
return git_object_lookup((git_object **)commit, repo, id, GIT_OBJ_COMMIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup a commit object from a repository,
|
||||
* given a prefix of its identifier (short id).
|
||||
*
|
||||
* @see git_object_lookup_prefix
|
||||
*
|
||||
* @param commit pointer to the looked up commit
|
||||
* @param repo the repo to use when locating the commit.
|
||||
* @param id identity of the commit to locate. If the object is
|
||||
* an annotated tag it will be peeled back to the commit.
|
||||
* @param len the length of the short identifier
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_INLINE(int) git_commit_lookup_prefix(git_commit **commit, git_repository *repo, const git_oid *id, size_t len)
|
||||
{
|
||||
return git_object_lookup_prefix((git_object **)commit, repo, id, len, GIT_OBJ_COMMIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close an open commit
|
||||
*
|
||||
* This is a wrapper around git_object_free()
|
||||
*
|
||||
* IMPORTANT:
|
||||
* It *is* necessary to call this method when you stop
|
||||
* using a commit. Failure to do so will cause a memory leak.
|
||||
*
|
||||
* @param commit the commit to close
|
||||
*/
|
||||
|
||||
GIT_INLINE(void) git_commit_free(git_commit *commit)
|
||||
{
|
||||
git_object_free((git_object *) commit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id of a commit.
|
||||
*
|
||||
* @param commit a previously loaded commit.
|
||||
* @return object identity for the commit.
|
||||
*/
|
||||
GIT_INLINE(const git_oid *) git_commit_id(const git_commit *commit)
|
||||
{
|
||||
return git_object_id((const git_object *)commit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the encoding for the message of a commit,
|
||||
* as a string representing a standard encoding name.
|
||||
*
|
||||
* The encoding may be NULL if the `encoding` header
|
||||
* in the commit is missing; in that case UTF-8 is assumed.
|
||||
*
|
||||
* @param commit a previously loaded commit.
|
||||
* @return NULL, or the encoding
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_commit_message_encoding(const git_commit *commit);
|
||||
|
||||
/**
|
||||
* Get the full message of a commit.
|
||||
*
|
||||
* @param commit a previously loaded commit.
|
||||
* @return the message of a commit
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_commit_message(const git_commit *commit);
|
||||
|
||||
/**
|
||||
* Get the commit time (i.e. committer time) of a commit.
|
||||
*
|
||||
* @param commit a previously loaded commit.
|
||||
* @return the time of a commit
|
||||
*/
|
||||
GIT_EXTERN(git_time_t) git_commit_time(const git_commit *commit);
|
||||
|
||||
/**
|
||||
* Get the commit timezone offset (i.e. committer's preferred timezone) of a commit.
|
||||
*
|
||||
* @param commit a previously loaded commit.
|
||||
* @return positive or negative timezone offset, in minutes from UTC
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_time_offset(const git_commit *commit);
|
||||
|
||||
/**
|
||||
* Get the committer of a commit.
|
||||
*
|
||||
* @param commit a previously loaded commit.
|
||||
* @return the committer of a commit
|
||||
*/
|
||||
GIT_EXTERN(const git_signature *) git_commit_committer(const git_commit *commit);
|
||||
|
||||
/**
|
||||
* Get the author of a commit.
|
||||
*
|
||||
* @param commit a previously loaded commit.
|
||||
* @return the author of a commit
|
||||
*/
|
||||
GIT_EXTERN(const git_signature *) git_commit_author(const git_commit *commit);
|
||||
|
||||
/**
|
||||
* Get the tree pointed to by a commit.
|
||||
*
|
||||
* @param tree_out pointer where to store the tree object
|
||||
* @param commit a previously loaded commit.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_tree(git_tree **tree_out, const git_commit *commit);
|
||||
|
||||
/**
|
||||
* Get the id of the tree pointed to by a commit. This differs from
|
||||
* `git_commit_tree` in that no attempts are made to fetch an object
|
||||
* from the ODB.
|
||||
*
|
||||
* @param commit a previously loaded commit.
|
||||
* @return the id of tree pointed to by commit.
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_commit_tree_id(const git_commit *commit);
|
||||
|
||||
/**
|
||||
* Get the number of parents of this commit
|
||||
*
|
||||
* @param commit a previously loaded commit.
|
||||
* @return integer of count of parents
|
||||
*/
|
||||
GIT_EXTERN(unsigned int) git_commit_parentcount(const git_commit *commit);
|
||||
|
||||
/**
|
||||
* Get the specified parent of the commit.
|
||||
*
|
||||
* @param out Pointer where to store the parent commit
|
||||
* @param commit a previously loaded commit.
|
||||
* @param n the position of the parent (from 0 to `parentcount`)
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_parent(git_commit **out, git_commit *commit, unsigned int n);
|
||||
|
||||
/**
|
||||
* Get the oid of a specified parent for a commit. This is different from
|
||||
* `git_commit_parent`, which will attempt to load the parent commit from
|
||||
* the ODB.
|
||||
*
|
||||
* @param commit a previously loaded commit.
|
||||
* @param n the position of the parent (from 0 to `parentcount`)
|
||||
* @return the id of the parent, NULL on error.
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_commit_parent_id(git_commit *commit, unsigned int n);
|
||||
|
||||
/**
|
||||
* Get the commit object that is the <n>th generation ancestor
|
||||
* of the named commit object, following only the first parents.
|
||||
* The returned commit has to be freed by the caller.
|
||||
*
|
||||
* Passing `0` as the generation number returns another instance of the
|
||||
* base commit itself.
|
||||
*
|
||||
* @param ancestor Pointer where to store the ancestor commit
|
||||
* @param commit a previously loaded commit.
|
||||
* @param n the requested generation
|
||||
* @return 0 on success; GIT_ENOTFOUND if no matching ancestor exists
|
||||
* or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_nth_gen_ancestor(
|
||||
git_commit **ancestor,
|
||||
const git_commit *commit,
|
||||
unsigned int n);
|
||||
|
||||
/**
|
||||
* Create a new commit in the repository using `git_object`
|
||||
* instances as parameters.
|
||||
*
|
||||
* The message will not be cleaned up. This can be achieved
|
||||
* through `git_message_prettify()`.
|
||||
*
|
||||
* @param id Pointer where to store the OID of the
|
||||
* newly created commit
|
||||
*
|
||||
* @param repo Repository where to store the commit
|
||||
*
|
||||
* @param update_ref If not NULL, name of the reference that
|
||||
* will be updated to point to this commit. If the reference
|
||||
* is not direct, it will be resolved to a direct reference.
|
||||
* Use "HEAD" to update the HEAD of the current branch and
|
||||
* make it point to this commit. If the reference doesn't
|
||||
* exist yet, it will be created.
|
||||
*
|
||||
* @param author Signature representing the author and the authory
|
||||
* time of this commit
|
||||
*
|
||||
* @param committer Signature representing the committer and the
|
||||
* commit time of this commit
|
||||
*
|
||||
* @param message_encoding The encoding for the message in the
|
||||
* commit, represented with a standard encoding name.
|
||||
* E.g. "UTF-8". If NULL, no encoding header is written and
|
||||
* UTF-8 is assumed.
|
||||
*
|
||||
* @param message Full message for this commit
|
||||
*
|
||||
* @param tree An instance of a `git_tree` object that will
|
||||
* be used as the tree for the commit. This tree object must
|
||||
* also be owned by the given `repo`.
|
||||
*
|
||||
* @param parent_count Number of parents for this commit
|
||||
*
|
||||
* @param parents[] Array of `parent_count` pointers to `git_commit`
|
||||
* objects that will be used as the parents for this commit. This
|
||||
* array may be NULL if `parent_count` is 0 (root commit). All the
|
||||
* given commits must be owned by the `repo`.
|
||||
*
|
||||
* @return 0 or an error code
|
||||
* The created commit will be written to the Object Database and
|
||||
* the given reference will be updated to point to it
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_create(
|
||||
git_oid *id,
|
||||
git_repository *repo,
|
||||
const char *update_ref,
|
||||
const git_signature *author,
|
||||
const git_signature *committer,
|
||||
const char *message_encoding,
|
||||
const char *message,
|
||||
const git_tree *tree,
|
||||
int parent_count,
|
||||
const git_commit *parents[]);
|
||||
|
||||
/**
|
||||
* Create a new commit in the repository using a variable
|
||||
* argument list.
|
||||
*
|
||||
* The message will be cleaned up from excess whitespace
|
||||
* it will be made sure that the last line ends with a '\n'.
|
||||
*
|
||||
* The parents for the commit are specified as a variable
|
||||
* list of pointers to `const git_commit *`. Note that this
|
||||
* is a convenience method which may not be safe to export
|
||||
* for certain languages or compilers
|
||||
*
|
||||
* All other parameters remain the same
|
||||
*
|
||||
* @see git_commit_create
|
||||
*/
|
||||
GIT_EXTERN(int) git_commit_create_v(
|
||||
git_oid *id,
|
||||
git_repository *repo,
|
||||
const char *update_ref,
|
||||
const git_signature *author,
|
||||
const git_signature *committer,
|
||||
const char *message_encoding,
|
||||
const char *message,
|
||||
const git_tree *tree,
|
||||
int parent_count,
|
||||
...);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_common_h__
|
||||
#define INCLUDE_git_common_h__
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include "inttypes.h"
|
||||
#else
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define GIT_BEGIN_DECL extern "C" {
|
||||
# define GIT_END_DECL }
|
||||
#else
|
||||
/** Start declarations in C mode */
|
||||
# define GIT_BEGIN_DECL /* empty */
|
||||
/** End declarations in C mode */
|
||||
# define GIT_END_DECL /* empty */
|
||||
#endif
|
||||
|
||||
/** Declare a public function exported for application use. */
|
||||
#if __GNUC__ >= 4
|
||||
# define GIT_EXTERN(type) extern \
|
||||
__attribute__((visibility("default"))) \
|
||||
type
|
||||
#elif defined(_MSC_VER)
|
||||
# define GIT_EXTERN(type) __declspec(dllexport) type
|
||||
#else
|
||||
# define GIT_EXTERN(type) extern type
|
||||
#endif
|
||||
|
||||
/** Declare a function as always inlined. */
|
||||
#if defined(_MSC_VER)
|
||||
# define GIT_INLINE(type) static __inline type
|
||||
#else
|
||||
# define GIT_INLINE(type) static inline type
|
||||
#endif
|
||||
|
||||
/** Declare a function's takes printf style arguments. */
|
||||
#ifdef __GNUC__
|
||||
# define GIT_FORMAT_PRINTF(a,b) __attribute__((format (printf, a, b)))
|
||||
#else
|
||||
# define GIT_FORMAT_PRINTF(a,b) /* empty */
|
||||
#endif
|
||||
|
||||
#if (defined(_WIN32)) && !defined(__CYGWIN__)
|
||||
#define GIT_WIN32 1
|
||||
#endif
|
||||
|
||||
#ifdef __amigaos4__
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file git2/common.h
|
||||
* @brief Git common platform definitions
|
||||
* @defgroup git_common Git common platform definitions
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* The separator used in path list strings (ie like in the PATH
|
||||
* environment variable). A semi-colon ";" is used on Windows, and
|
||||
* a colon ":" for all other systems.
|
||||
*/
|
||||
#ifdef GIT_WIN32
|
||||
#define GIT_PATH_LIST_SEPARATOR ';'
|
||||
#else
|
||||
#define GIT_PATH_LIST_SEPARATOR ':'
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The maximum length of a valid git path.
|
||||
*/
|
||||
#define GIT_PATH_MAX 4096
|
||||
|
||||
/**
|
||||
* The string representation of the null object ID.
|
||||
*/
|
||||
#define GIT_OID_HEX_ZERO "0000000000000000000000000000000000000000"
|
||||
|
||||
/**
|
||||
* Return the version of the libgit2 library
|
||||
* being currently used.
|
||||
*
|
||||
* @param major Store the major version number
|
||||
* @param minor Store the minor version number
|
||||
* @param rev Store the revision (patch) number
|
||||
*/
|
||||
GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev);
|
||||
|
||||
/**
|
||||
* Combinations of these values describe the capabilities of libgit2.
|
||||
*/
|
||||
enum {
|
||||
GIT_CAP_THREADS = ( 1 << 0 ),
|
||||
GIT_CAP_HTTPS = ( 1 << 1 )
|
||||
};
|
||||
|
||||
/**
|
||||
* Query compile time options for libgit2.
|
||||
*
|
||||
* @return A combination of GIT_CAP_* values.
|
||||
*
|
||||
* - GIT_CAP_THREADS
|
||||
* Libgit2 was compiled with thread support. Note that thread support is still to be seen as a
|
||||
* 'work in progress'.
|
||||
*
|
||||
* - GIT_CAP_HTTPS
|
||||
* Libgit2 supports the https:// protocol. This requires the open ssl library to be
|
||||
* found when compiling libgit2.
|
||||
*/
|
||||
GIT_EXTERN(int) git_libgit2_capabilities(void);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
|
||||
#endif
|
||||
@@ -1,554 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_config_h__
|
||||
#define INCLUDE_git_config_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* @file git2/config.h
|
||||
* @brief Git config management routines
|
||||
* @defgroup git_config Git config management routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Priority level of a config file.
|
||||
* These priority levels correspond to the natural escalation logic
|
||||
* (from higher to lower) when searching for config entries in git.git.
|
||||
*
|
||||
* git_config_open_default() and git_repository_config() honor those
|
||||
* priority levels as well.
|
||||
*/
|
||||
enum {
|
||||
GIT_CONFIG_LEVEL_SYSTEM = 1, /**< System-wide configuration file. */
|
||||
GIT_CONFIG_LEVEL_XDG = 2, /**< XDG compatible configuration file (.config/git/config). */
|
||||
GIT_CONFIG_LEVEL_GLOBAL = 3, /**< User-specific configuration file, also called Global configuration file. */
|
||||
GIT_CONFIG_LEVEL_LOCAL = 4, /**< Repository specific configuration file. */
|
||||
GIT_CONFIG_HIGHEST_LEVEL = -1, /**< Represents the highest level of a config file. */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const char *value;
|
||||
unsigned int level;
|
||||
} git_config_entry;
|
||||
|
||||
typedef int (*git_config_foreach_cb)(const git_config_entry *, void *);
|
||||
|
||||
|
||||
/**
|
||||
* Generic backend that implements the interface to
|
||||
* access a configuration file
|
||||
*/
|
||||
struct git_config_backend {
|
||||
unsigned int version;
|
||||
struct git_config *cfg;
|
||||
|
||||
/* Open means open the file/database and parse if necessary */
|
||||
int (*open)(struct git_config_backend *, unsigned int level);
|
||||
int (*get)(const struct git_config_backend *, const char *key, const git_config_entry **entry);
|
||||
int (*get_multivar)(struct git_config_backend *, const char *key, const char *regexp, git_config_foreach_cb callback, void *payload);
|
||||
int (*set)(struct git_config_backend *, const char *key, const char *value);
|
||||
int (*set_multivar)(git_config_backend *cfg, const char *name, const char *regexp, const char *value);
|
||||
int (*del)(struct git_config_backend *, const char *key);
|
||||
int (*foreach)(struct git_config_backend *, const char *, git_config_foreach_cb callback, void *payload);
|
||||
int (*refresh)(struct git_config_backend *);
|
||||
void (*free)(struct git_config_backend *);
|
||||
};
|
||||
#define GIT_CONFIG_BACKEND_VERSION 1
|
||||
#define GIT_CONFIG_BACKEND_INIT {GIT_CONFIG_BACKEND_VERSION}
|
||||
|
||||
typedef enum {
|
||||
GIT_CVAR_FALSE = 0,
|
||||
GIT_CVAR_TRUE = 1,
|
||||
GIT_CVAR_INT32,
|
||||
GIT_CVAR_STRING
|
||||
} git_cvar_t;
|
||||
|
||||
typedef struct {
|
||||
git_cvar_t cvar_type;
|
||||
const char *str_match;
|
||||
int map_value;
|
||||
} git_cvar_map;
|
||||
|
||||
/**
|
||||
* Locate the path to the global configuration file
|
||||
*
|
||||
* The user or global configuration file is usually
|
||||
* located in `$HOME/.gitconfig`.
|
||||
*
|
||||
* This method will try to guess the full path to that
|
||||
* file, if the file exists. The returned path
|
||||
* may be used on any `git_config` call to load the
|
||||
* global configuration file.
|
||||
*
|
||||
* This method will not guess the path to the xdg compatible
|
||||
* config file (.config/git/config).
|
||||
*
|
||||
* @param out Buffer to store the path in
|
||||
* @param length size of the buffer in bytes
|
||||
* @return 0 if a global configuration file has been found. Its path will be stored in `buffer`.
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_find_global(char *out, size_t length);
|
||||
|
||||
/**
|
||||
* Locate the path to the global xdg compatible configuration file
|
||||
*
|
||||
* The xdg compatible configuration file is usually
|
||||
* located in `$HOME/.config/git/config`.
|
||||
*
|
||||
* This method will try to guess the full path to that
|
||||
* file, if the file exists. The returned path
|
||||
* may be used on any `git_config` call to load the
|
||||
* xdg compatible configuration file.
|
||||
*
|
||||
* @param out Buffer to store the path in
|
||||
* @param length size of the buffer in bytes
|
||||
* @return 0 if a xdg compatible configuration file has been
|
||||
* found. Its path will be stored in `buffer`.
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_find_xdg(char *out, size_t length);
|
||||
|
||||
/**
|
||||
* Locate the path to the system configuration file
|
||||
*
|
||||
* If /etc/gitconfig doesn't exist, it will look for
|
||||
* %PROGRAMFILES%\Git\etc\gitconfig.
|
||||
|
||||
* @param global_config_path Buffer to store the path in
|
||||
* @param length size of the buffer in bytes
|
||||
* @return 0 if a system configuration file has been
|
||||
* found. Its path will be stored in `buffer`.
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_find_system(char *out, size_t length);
|
||||
|
||||
/**
|
||||
* Open the global, XDG and system configuration files
|
||||
*
|
||||
* Utility wrapper that finds the global, XDG and system configuration files
|
||||
* and opens them into a single prioritized config object that can be
|
||||
* used when accessing default config data outside a repository.
|
||||
*
|
||||
* @param out Pointer to store the config instance
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_open_default(git_config **out);
|
||||
|
||||
/**
|
||||
* Allocate a new configuration object
|
||||
*
|
||||
* This object is empty, so you have to add a file to it before you
|
||||
* can do anything with it.
|
||||
*
|
||||
* @param out pointer to the new configuration
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_new(git_config **out);
|
||||
|
||||
/**
|
||||
* Add a generic config file instance to an existing config
|
||||
*
|
||||
* Note that the configuration object will free the file
|
||||
* automatically.
|
||||
*
|
||||
* Further queries on this config object will access each
|
||||
* of the config file instances in order (instances with
|
||||
* a higher priority level will be accessed first).
|
||||
*
|
||||
* @param cfg the configuration to add the file to
|
||||
* @param file the configuration file (backend) to add
|
||||
* @param level the priority level of the backend
|
||||
* @param force if a config file already exists for the given
|
||||
* priority level, replace it
|
||||
* @return 0 on success, GIT_EEXISTS when adding more than one file
|
||||
* for a given priority level (and force_replace set to 0), or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_add_backend(
|
||||
git_config *cfg,
|
||||
git_config_backend *file,
|
||||
unsigned int level,
|
||||
int force);
|
||||
|
||||
/**
|
||||
* Add an on-disk config file instance to an existing config
|
||||
*
|
||||
* The on-disk file pointed at by `path` will be opened and
|
||||
* parsed; it's expected to be a native Git config file following
|
||||
* the default Git config syntax (see man git-config).
|
||||
*
|
||||
* Note that the configuration object will free the file
|
||||
* automatically.
|
||||
*
|
||||
* Further queries on this config object will access each
|
||||
* of the config file instances in order (instances with
|
||||
* a higher priority level will be accessed first).
|
||||
*
|
||||
* @param cfg the configuration to add the file to
|
||||
* @param path path to the configuration file (backend) to add
|
||||
* @param level the priority level of the backend
|
||||
* @param force if a config file already exists for the given
|
||||
* priority level, replace it
|
||||
* @return 0 on success, GIT_EEXISTS when adding more than one file
|
||||
* for a given priority level (and force_replace set to 0),
|
||||
* GIT_ENOTFOUND when the file doesn't exist or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_add_file_ondisk(
|
||||
git_config *cfg,
|
||||
const char *path,
|
||||
unsigned int level,
|
||||
int force);
|
||||
|
||||
/**
|
||||
* Create a new config instance containing a single on-disk file
|
||||
*
|
||||
* This method is a simple utility wrapper for the following sequence
|
||||
* of calls:
|
||||
* - git_config_new
|
||||
* - git_config_add_file_ondisk
|
||||
*
|
||||
* @param out The configuration instance to create
|
||||
* @param path Path to the on-disk file to open
|
||||
* @return 0 on success, GIT_ENOTFOUND when the file doesn't exist
|
||||
* or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_open_ondisk(git_config **out, const char *path);
|
||||
|
||||
/**
|
||||
* Build a single-level focused config object from a multi-level one.
|
||||
*
|
||||
* The returned config object can be used to perform get/set/delete operations
|
||||
* on a single specific level.
|
||||
*
|
||||
* Getting several times the same level from the same parent multi-level config
|
||||
* will return different config instances, but containing the same config_file
|
||||
* instance.
|
||||
*
|
||||
* @param out The configuration instance to create
|
||||
* @param parent Multi-level config to search for the given level
|
||||
* @param level Configuration level to search for
|
||||
* @return 0, GIT_ENOTFOUND if the passed level cannot be found in the
|
||||
* multi-level parent config, or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_open_level(
|
||||
git_config **out,
|
||||
const git_config *parent,
|
||||
unsigned int level);
|
||||
|
||||
/**
|
||||
* Reload changed config files
|
||||
*
|
||||
* A config file may be changed on disk out from under the in-memory
|
||||
* config object. This function causes us to look for files that have
|
||||
* been modified since we last loaded them and refresh the config with
|
||||
* the latest information.
|
||||
*
|
||||
* @param cfg The configuration to refresh
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_refresh(git_config *cfg);
|
||||
|
||||
/**
|
||||
* Free the configuration and its associated memory and files
|
||||
*
|
||||
* @param cfg the configuration to free
|
||||
*/
|
||||
GIT_EXTERN(void) git_config_free(git_config *cfg);
|
||||
|
||||
/**
|
||||
* Get the git_config_entry of a config variable.
|
||||
*
|
||||
* The git_config_entry is owned by the config and should not be freed by the
|
||||
* user.
|
||||
|
||||
* @param out pointer to the variable git_config_entry
|
||||
* @param cfg where to look for the variable
|
||||
* @param name the variable's name
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_get_entry(
|
||||
const git_config_entry **out,
|
||||
const git_config *cfg,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* Get the value of an integer config variable.
|
||||
*
|
||||
* All config files will be looked into, in the order of their
|
||||
* defined level. A higher level means a higher priority. The
|
||||
* first occurence of the variable will be returned here.
|
||||
*
|
||||
* @param out pointer to the variable where the value should be stored
|
||||
* @param cfg where to look for the variable
|
||||
* @param name the variable's name
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_get_int32(int32_t *out, const git_config *cfg, const char *name);
|
||||
|
||||
/**
|
||||
* Get the value of a long integer config variable.
|
||||
*
|
||||
* All config files will be looked into, in the order of their
|
||||
* defined level. A higher level means a higher priority. The
|
||||
* first occurrence of the variable will be returned here.
|
||||
*
|
||||
* @param out pointer to the variable where the value should be stored
|
||||
* @param cfg where to look for the variable
|
||||
* @param name the variable's name
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_get_int64(int64_t *out, const git_config *cfg, const char *name);
|
||||
|
||||
/**
|
||||
* Get the value of a boolean config variable.
|
||||
*
|
||||
* This function uses the usual C convention of 0 being false and
|
||||
* anything else true.
|
||||
*
|
||||
* All config files will be looked into, in the order of their
|
||||
* defined level. A higher level means a higher priority. The
|
||||
* first occurrence of the variable will be returned here.
|
||||
*
|
||||
* @param out pointer to the variable where the value should be stored
|
||||
* @param cfg where to look for the variable
|
||||
* @param name the variable's name
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_get_bool(int *out, const git_config *cfg, const char *name);
|
||||
|
||||
/**
|
||||
* Get the value of a string config variable.
|
||||
*
|
||||
* The string is owned by the variable and should not be freed by the
|
||||
* user.
|
||||
*
|
||||
* All config files will be looked into, in the order of their
|
||||
* defined level. A higher level means a higher priority. The
|
||||
* first occurrence of the variable will be returned here.
|
||||
*
|
||||
* @param out pointer to the variable's value
|
||||
* @param cfg where to look for the variable
|
||||
* @param name the variable's name
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_get_string(const char **out, const git_config *cfg, const char *name);
|
||||
|
||||
/**
|
||||
* Get each value of a multivar.
|
||||
*
|
||||
* The callback will be called on each variable found
|
||||
*
|
||||
* @param cfg where to look for the variable
|
||||
* @param name the variable's name
|
||||
* @param regexp regular expression to filter which variables we're
|
||||
* interested in. Use NULL to indicate all
|
||||
* @param fn the function to be called on each value of the variable
|
||||
* @param data opaque pointer to pass to the callback
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_get_multivar(const git_config *cfg, const char *name, const char *regexp, git_config_foreach_cb callback, void *payload);
|
||||
|
||||
/**
|
||||
* Set the value of an integer config variable in the config file
|
||||
* with the highest level (usually the local one).
|
||||
*
|
||||
* @param cfg where to look for the variable
|
||||
* @param name the variable's name
|
||||
* @param value Integer value for the variable
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_set_int32(git_config *cfg, const char *name, int32_t value);
|
||||
|
||||
/**
|
||||
* Set the value of a long integer config variable in the config file
|
||||
* with the highest level (usually the local one).
|
||||
*
|
||||
* @param cfg where to look for the variable
|
||||
* @param name the variable's name
|
||||
* @param value Long integer value for the variable
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_set_int64(git_config *cfg, const char *name, int64_t value);
|
||||
|
||||
/**
|
||||
* Set the value of a boolean config variable in the config file
|
||||
* with the highest level (usually the local one).
|
||||
*
|
||||
* @param cfg where to look for the variable
|
||||
* @param name the variable's name
|
||||
* @param value the value to store
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_set_bool(git_config *cfg, const char *name, int value);
|
||||
|
||||
/**
|
||||
* Set the value of a string config variable in the config file
|
||||
* with the highest level (usually the local one).
|
||||
*
|
||||
* A copy of the string is made and the user is free to use it
|
||||
* afterwards.
|
||||
*
|
||||
* @param cfg where to look for the variable
|
||||
* @param name the variable's name
|
||||
* @param value the string to store.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_set_string(git_config *cfg, const char *name, const char *value);
|
||||
|
||||
/**
|
||||
* Set a multivar in the local config file.
|
||||
*
|
||||
* @param cfg where to look for the variable
|
||||
* @param name the variable's name
|
||||
* @param regexp a regular expression to indicate which values to replace
|
||||
* @param value the new value.
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_set_multivar(git_config *cfg, const char *name, const char *regexp, const char *value);
|
||||
|
||||
/**
|
||||
* Delete a config variable from the config file
|
||||
* with the highest level (usually the local one).
|
||||
*
|
||||
* @param cfg the configuration
|
||||
* @param name the variable to delete
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_delete_entry(git_config *cfg, const char *name);
|
||||
|
||||
/**
|
||||
* Perform an operation on each config variable.
|
||||
*
|
||||
* The callback receives the normalized name and value of each variable
|
||||
* in the config backend, and the data pointer passed to this function.
|
||||
* As soon as one of the callback functions returns something other than 0,
|
||||
* this function stops iterating and returns `GIT_EUSER`.
|
||||
*
|
||||
* @param cfg where to get the variables from
|
||||
* @param callback the function to call on each variable
|
||||
* @param payload the data to pass to the callback
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_foreach(
|
||||
const git_config *cfg,
|
||||
git_config_foreach_cb callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Perform an operation on each config variable matching a regular expression.
|
||||
*
|
||||
* This behaviors like `git_config_foreach` with an additional filter of a
|
||||
* regular expression that filters which config keys are passed to the
|
||||
* callback.
|
||||
*
|
||||
* @param cfg where to get the variables from
|
||||
* @param regexp regular expression to match against config names
|
||||
* @param callback the function to call on each variable
|
||||
* @param payload the data to pass to the callback
|
||||
* @return 0 or the return value of the callback which didn't return 0
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_foreach_match(
|
||||
const git_config *cfg,
|
||||
const char *regexp,
|
||||
git_config_foreach_cb callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Query the value of a config variable and return it mapped to
|
||||
* an integer constant.
|
||||
*
|
||||
* This is a helper method to easily map different possible values
|
||||
* to a variable to integer constants that easily identify them.
|
||||
*
|
||||
* A mapping array looks as follows:
|
||||
*
|
||||
* git_cvar_map autocrlf_mapping[] = {
|
||||
* {GIT_CVAR_FALSE, NULL, GIT_AUTO_CRLF_FALSE},
|
||||
* {GIT_CVAR_TRUE, NULL, GIT_AUTO_CRLF_TRUE},
|
||||
* {GIT_CVAR_STRING, "input", GIT_AUTO_CRLF_INPUT},
|
||||
* {GIT_CVAR_STRING, "default", GIT_AUTO_CRLF_DEFAULT}};
|
||||
*
|
||||
* On any "false" value for the variable (e.g. "false", "FALSE", "no"), the
|
||||
* mapping will store `GIT_AUTO_CRLF_FALSE` in the `out` parameter.
|
||||
*
|
||||
* The same thing applies for any "true" value such as "true", "yes" or "1", storing
|
||||
* the `GIT_AUTO_CRLF_TRUE` variable.
|
||||
*
|
||||
* Otherwise, if the value matches the string "input" (with case insensitive comparison),
|
||||
* the given constant will be stored in `out`, and likewise for "default".
|
||||
*
|
||||
* If not a single match can be made to store in `out`, an error code will be
|
||||
* returned.
|
||||
*
|
||||
* @param out place to store the result of the mapping
|
||||
* @param cfg config file to get the variables from
|
||||
* @param name name of the config variable to lookup
|
||||
* @param maps array of `git_cvar_map` objects specifying the possible mappings
|
||||
* @param map_n number of mapping objects in `maps`
|
||||
* @return 0 on success, error code otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_get_mapped(
|
||||
int *out,
|
||||
const git_config *cfg,
|
||||
const char *name,
|
||||
const git_cvar_map *maps,
|
||||
size_t map_n);
|
||||
|
||||
/**
|
||||
* Maps a string value to an integer constant
|
||||
*
|
||||
* @param out place to store the result of the parsing
|
||||
* @param maps array of `git_cvar_map` objects specifying the possible mappings
|
||||
* @param map_n number of mapping objects in `maps`
|
||||
* @param value value to parse
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_lookup_map_value(
|
||||
int *out,
|
||||
const git_cvar_map *maps,
|
||||
size_t map_n,
|
||||
const char *value);
|
||||
|
||||
/**
|
||||
* Parse a string value as a bool.
|
||||
*
|
||||
* Valid values for true are: 'true', 'yes', 'on', 1 or any
|
||||
* number different from 0
|
||||
* Valid values for false are: 'false', 'no', 'off', 0
|
||||
*
|
||||
* @param out place to store the result of the parsing
|
||||
* @param value value to parse
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_parse_bool(int *out, const char *value);
|
||||
|
||||
/**
|
||||
* Parse a string value as an int32.
|
||||
*
|
||||
* An optional value suffix of 'k', 'm', or 'g' will
|
||||
* cause the value to be multiplied by 1024, 1048576,
|
||||
* or 1073741824 prior to output.
|
||||
*
|
||||
* @param out place to store the result of the parsing
|
||||
* @param value value to parse
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_parse_int32(int32_t *out, const char *value);
|
||||
|
||||
/**
|
||||
* Parse a string value as an int64.
|
||||
*
|
||||
* An optional value suffix of 'k', 'm', or 'g' will
|
||||
* cause the value to be multiplied by 1024, 1048576,
|
||||
* or 1073741824 prior to output.
|
||||
*
|
||||
* @param out place to store the result of the parsing
|
||||
* @param value value to parse
|
||||
*/
|
||||
GIT_EXTERN(int) git_config_parse_int64(int64_t *out, const char *value);
|
||||
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,853 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_diff_h__
|
||||
#define INCLUDE_git_diff_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
#include "tree.h"
|
||||
#include "refs.h"
|
||||
|
||||
/**
|
||||
* @file git2/diff.h
|
||||
* @brief Git tree and file differencing routines.
|
||||
*
|
||||
* Overview
|
||||
* --------
|
||||
*
|
||||
* Calculating diffs is generally done in two phases: building a diff list
|
||||
* then traversing the diff list. This makes is easier to share logic
|
||||
* across the various types of diffs (tree vs tree, workdir vs index, etc.),
|
||||
* and also allows you to insert optional diff list post-processing phases,
|
||||
* such as rename detected, in between the steps. When you are done with a
|
||||
* diff list object, it must be freed.
|
||||
*
|
||||
* Terminology
|
||||
* -----------
|
||||
*
|
||||
* To understand the diff APIs, you should know the following terms:
|
||||
*
|
||||
* - A `diff` or `diff list` represents the cumulative list of differences
|
||||
* between two snapshots of a repository (possibly filtered by a set of
|
||||
* file name patterns). This is the `git_diff_list` object.
|
||||
* - A `delta` is a file pair with an old and new revision. The old version
|
||||
* may be absent if the file was just created and the new version may be
|
||||
* absent if the file was deleted. A diff is mostly just a list of deltas.
|
||||
* - A `binary` file / delta is a file (or pair) for which no text diffs
|
||||
* should be generated. A diff list can contain delta entries that are
|
||||
* binary, but no diff content will be output for those files. There is
|
||||
* a base heuristic for binary detection and you can further tune the
|
||||
* behavior with git attributes or diff flags and option settings.
|
||||
* - A `hunk` is a span of modified lines in a delta along with some stable
|
||||
* surrounding context. You can configure the amount of context and other
|
||||
* properties of how hunks are generated. Each hunk also comes with a
|
||||
* header that described where it starts and ends in both the old and new
|
||||
* versions in the delta.
|
||||
* - A `line` is a range of characters inside a hunk. It could be a context
|
||||
* line (i.e. in both old and new versions), an added line (i.e. only in
|
||||
* the new version), or a removed line (i.e. only in the old version).
|
||||
* Unfortunately, we don't know anything about the encoding of data in the
|
||||
* file being diffed, so we cannot tell you much about the line content.
|
||||
* Line data will not be NUL-byte terminated, however, because it will be
|
||||
* just a span of bytes inside the larger file.
|
||||
*
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Flags for diff options. A combination of these flags can be passed
|
||||
* in via the `flags` value in the `git_diff_options`.
|
||||
*/
|
||||
typedef enum {
|
||||
/** Normal diff, the default */
|
||||
GIT_DIFF_NORMAL = 0,
|
||||
/** Reverse the sides of the diff */
|
||||
GIT_DIFF_REVERSE = (1 << 0),
|
||||
/** Treat all files as text, disabling binary attributes & detection */
|
||||
GIT_DIFF_FORCE_TEXT = (1 << 1),
|
||||
/** Ignore all whitespace */
|
||||
GIT_DIFF_IGNORE_WHITESPACE = (1 << 2),
|
||||
/** Ignore changes in amount of whitespace */
|
||||
GIT_DIFF_IGNORE_WHITESPACE_CHANGE = (1 << 3),
|
||||
/** Ignore whitespace at end of line */
|
||||
GIT_DIFF_IGNORE_WHITESPACE_EOL = (1 << 4),
|
||||
/** Exclude submodules from the diff completely */
|
||||
GIT_DIFF_IGNORE_SUBMODULES = (1 << 5),
|
||||
/** Use the "patience diff" algorithm (currently unimplemented) */
|
||||
GIT_DIFF_PATIENCE = (1 << 6),
|
||||
/** Include ignored files in the diff list */
|
||||
GIT_DIFF_INCLUDE_IGNORED = (1 << 7),
|
||||
/** Include untracked files in the diff list */
|
||||
GIT_DIFF_INCLUDE_UNTRACKED = (1 << 8),
|
||||
/** Include unmodified files in the diff list */
|
||||
GIT_DIFF_INCLUDE_UNMODIFIED = (1 << 9),
|
||||
/** Even with the GIT_DIFF_INCLUDE_UNTRACKED flag, when an untracked
|
||||
* directory is found, only a single entry for the directory is added
|
||||
* to the diff list; with this flag, all files under the directory will
|
||||
* be included, too.
|
||||
*/
|
||||
GIT_DIFF_RECURSE_UNTRACKED_DIRS = (1 << 10),
|
||||
/** If the pathspec is set in the diff options, this flags means to
|
||||
* apply it as an exact match instead of as an fnmatch pattern.
|
||||
*/
|
||||
GIT_DIFF_DISABLE_PATHSPEC_MATCH = (1 << 11),
|
||||
/** Use case insensitive filename comparisons */
|
||||
GIT_DIFF_DELTAS_ARE_ICASE = (1 << 12),
|
||||
/** When generating patch text, include the content of untracked files */
|
||||
GIT_DIFF_INCLUDE_UNTRACKED_CONTENT = (1 << 13),
|
||||
/** Disable updating of the `binary` flag in delta records. This is
|
||||
* useful when iterating over a diff if you don't need hunk and data
|
||||
* callbacks and want to avoid having to load file completely.
|
||||
*/
|
||||
GIT_DIFF_SKIP_BINARY_CHECK = (1 << 14),
|
||||
/** Normally, a type change between files will be converted into a
|
||||
* DELETED record for the old and an ADDED record for the new; this
|
||||
* options enabled the generation of TYPECHANGE delta records.
|
||||
*/
|
||||
GIT_DIFF_INCLUDE_TYPECHANGE = (1 << 15),
|
||||
/** Even with GIT_DIFF_INCLUDE_TYPECHANGE, blob->tree changes still
|
||||
* generally show as a DELETED blob. This flag tries to correctly
|
||||
* label blob->tree transitions as TYPECHANGE records with new_file's
|
||||
* mode set to tree. Note: the tree SHA will not be available.
|
||||
*/
|
||||
GIT_DIFF_INCLUDE_TYPECHANGE_TREES = (1 << 16),
|
||||
/** Ignore file mode changes */
|
||||
GIT_DIFF_IGNORE_FILEMODE = (1 << 17),
|
||||
} git_diff_option_t;
|
||||
|
||||
/**
|
||||
* Structure describing options about how the diff should be executed.
|
||||
*
|
||||
* Setting all values of the structure to zero will yield the default
|
||||
* values. Similarly, passing NULL for the options structure will
|
||||
* give the defaults. The default values are marked below.
|
||||
*
|
||||
* - `flags` is a combination of the `git_diff_option_t` values above
|
||||
* - `context_lines` is the number of unchanged lines that define the
|
||||
* boundary of a hunk (and to display before and after)
|
||||
* - `interhunk_lines` is the maximum number of unchanged lines between
|
||||
* hunk boundaries before the hunks will be merged into a one.
|
||||
* - `old_prefix` is the virtual "directory" to prefix to old file names
|
||||
* in hunk headers (default "a")
|
||||
* - `new_prefix` is the virtual "directory" to prefix to new file names
|
||||
* in hunk headers (default "b")
|
||||
* - `pathspec` is an array of paths / fnmatch patterns to constrain diff
|
||||
* - `max_size` is a file size (in bytes) above which a blob will be marked
|
||||
* as binary automatically; pass a negative value to disable.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int version; /**< version for the struct */
|
||||
uint32_t flags; /**< defaults to GIT_DIFF_NORMAL */
|
||||
uint16_t context_lines; /**< defaults to 3 */
|
||||
uint16_t interhunk_lines; /**< defaults to 0 */
|
||||
const char *old_prefix; /**< defaults to "a" */
|
||||
const char *new_prefix; /**< defaults to "b" */
|
||||
git_strarray pathspec; /**< defaults to include all paths */
|
||||
git_off_t max_size; /**< defaults to 512MB */
|
||||
} git_diff_options;
|
||||
|
||||
#define GIT_DIFF_OPTIONS_VERSION 1
|
||||
#define GIT_DIFF_OPTIONS_INIT {GIT_DIFF_OPTIONS_VERSION}
|
||||
|
||||
/**
|
||||
* The diff list object that contains all individual file deltas.
|
||||
*
|
||||
* This is an opaque structure which will be allocated by one of the diff
|
||||
* generator functions below (such as `git_diff_tree_to_tree`). You are
|
||||
* responsible for releasing the object memory when done, using the
|
||||
* `git_diff_list_free()` function.
|
||||
*/
|
||||
typedef struct git_diff_list git_diff_list;
|
||||
|
||||
/**
|
||||
* Flags for the file object on each side of a diff.
|
||||
*
|
||||
* Note: most of these flags are just for **internal** consumption by
|
||||
* libgit2, but some of them may be interesting to external users.
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_DIFF_FILE_VALID_OID = (1 << 0), /** `oid` value is known correct */
|
||||
GIT_DIFF_FILE_FREE_PATH = (1 << 1), /** `path` is allocated memory */
|
||||
GIT_DIFF_FILE_BINARY = (1 << 2), /** should be considered binary data */
|
||||
GIT_DIFF_FILE_NOT_BINARY = (1 << 3), /** should be considered text data */
|
||||
GIT_DIFF_FILE_FREE_DATA = (1 << 4), /** internal file data is allocated */
|
||||
GIT_DIFF_FILE_UNMAP_DATA = (1 << 5), /** internal file data is mmap'ed */
|
||||
GIT_DIFF_FILE_NO_DATA = (1 << 6), /** file data should not be loaded */
|
||||
} git_diff_file_flag_t;
|
||||
|
||||
/**
|
||||
* What type of change is described by a git_diff_delta?
|
||||
*
|
||||
* `GIT_DELTA_RENAMED` and `GIT_DELTA_COPIED` will only show up if you run
|
||||
* `git_diff_find_similar()` on the diff list object.
|
||||
*
|
||||
* `GIT_DELTA_TYPECHANGE` only shows up given `GIT_DIFF_INCLUDE_TYPECHANGE`
|
||||
* in the option flags (otherwise type changes will be split into ADDED /
|
||||
* DELETED pairs).
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_DELTA_UNMODIFIED = 0, /** no changes */
|
||||
GIT_DELTA_ADDED = 1, /** entry does not exist in old version */
|
||||
GIT_DELTA_DELETED = 2, /** entry does not exist in new version */
|
||||
GIT_DELTA_MODIFIED = 3, /** entry content changed between old and new */
|
||||
GIT_DELTA_RENAMED = 4, /** entry was renamed between old and new */
|
||||
GIT_DELTA_COPIED = 5, /** entry was copied from another old entry */
|
||||
GIT_DELTA_IGNORED = 6, /** entry is ignored item in workdir */
|
||||
GIT_DELTA_UNTRACKED = 7, /** entry is untracked item in workdir */
|
||||
GIT_DELTA_TYPECHANGE = 8, /** type of entry changed between old and new */
|
||||
} git_delta_t;
|
||||
|
||||
/**
|
||||
* Description of one side of a diff entry.
|
||||
*
|
||||
* Although this is called a "file", it may actually represent a file, a
|
||||
* symbolic link, a submodule commit id, or even a tree (although that only
|
||||
* if you are tracking type changes or ignored/untracked directories).
|
||||
*
|
||||
* The `oid` is the `git_oid` of the item. If the entry represents an
|
||||
* absent side of a diff (e.g. the `old_file` of a `GIT_DELTA_ADDED` delta),
|
||||
* then the oid will be zeroes.
|
||||
*
|
||||
* `path` is the NUL-terminated path to the entry relative to the working
|
||||
* directory of the repository.
|
||||
*
|
||||
* `size` is the size of the entry in bytes.
|
||||
*
|
||||
* `flags` is a combination of the `git_diff_file_flag_t` types, but those
|
||||
* are largely internal values.
|
||||
*
|
||||
* `mode` is, roughly, the stat() `st_mode` value for the item. This will
|
||||
* be restricted to one of the `git_filemode_t` values.
|
||||
*/
|
||||
typedef struct {
|
||||
git_oid oid;
|
||||
const char *path;
|
||||
git_off_t size;
|
||||
unsigned int flags;
|
||||
uint16_t mode;
|
||||
} git_diff_file;
|
||||
|
||||
/**
|
||||
* Description of changes to one entry.
|
||||
*
|
||||
* When iterating over a diff list object, this will be passed to most
|
||||
* callback functions and you can use the contents to understand exactly
|
||||
* what has changed.
|
||||
*
|
||||
* The `old_file` represents the "from" side of the diff and the `new_file`
|
||||
* represents to "to" side of the diff. What those means depend on the
|
||||
* function that was used to generate the diff and will be documented below.
|
||||
* You can also use the `GIT_DIFF_REVERSE` flag to flip it around.
|
||||
*
|
||||
* Although the two sides of the delta are named "old_file" and "new_file",
|
||||
* they actually may correspond to entries that represent a file, a symbolic
|
||||
* link, a submodule commit id, or even a tree (if you are tracking type
|
||||
* changes or ignored/untracked directories).
|
||||
*
|
||||
* Under some circumstances, in the name of efficiency, not all fields will
|
||||
* be filled in, but we generally try to fill in as much as possible. One
|
||||
* example is that the "binary" field will not examine file contents if you
|
||||
* do not pass in hunk and/or line callbacks to the diff foreach iteration
|
||||
* function. It will just use the git attributes for those files.
|
||||
*/
|
||||
typedef struct {
|
||||
git_diff_file old_file;
|
||||
git_diff_file new_file;
|
||||
git_delta_t status;
|
||||
unsigned int similarity; /**< for RENAMED and COPIED, value 0-100 */
|
||||
int binary;
|
||||
} git_diff_delta;
|
||||
|
||||
/**
|
||||
* When iterating over a diff, callback that will be made per file.
|
||||
*
|
||||
* @param delta A pointer to the delta data for the file
|
||||
* @param progress Goes from 0 to 1 over the diff list
|
||||
* @param payload User-specified pointer from foreach function
|
||||
*/
|
||||
typedef int (*git_diff_file_cb)(
|
||||
const git_diff_delta *delta,
|
||||
float progress,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Structure describing a hunk of a diff.
|
||||
*/
|
||||
typedef struct {
|
||||
int old_start; /** Starting line number in old_file */
|
||||
int old_lines; /** Number of lines in old_file */
|
||||
int new_start; /** Starting line number in new_file */
|
||||
int new_lines; /** Number of lines in new_file */
|
||||
} git_diff_range;
|
||||
|
||||
/**
|
||||
* When iterating over a diff, callback that will be made per hunk.
|
||||
*/
|
||||
typedef int (*git_diff_hunk_cb)(
|
||||
const git_diff_delta *delta,
|
||||
const git_diff_range *range,
|
||||
const char *header,
|
||||
size_t header_len,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Line origin constants.
|
||||
*
|
||||
* These values describe where a line came from and will be passed to
|
||||
* the git_diff_data_cb when iterating over a diff. There are some
|
||||
* special origin constants at the end that are used for the text
|
||||
* output callbacks to demarcate lines that are actually part of
|
||||
* the file or hunk headers.
|
||||
*/
|
||||
typedef enum {
|
||||
/* These values will be sent to `git_diff_data_cb` along with the line */
|
||||
GIT_DIFF_LINE_CONTEXT = ' ',
|
||||
GIT_DIFF_LINE_ADDITION = '+',
|
||||
GIT_DIFF_LINE_DELETION = '-',
|
||||
GIT_DIFF_LINE_ADD_EOFNL = '\n', /**< Removed line w/o LF & added one with */
|
||||
GIT_DIFF_LINE_DEL_EOFNL = '\0', /**< LF was removed at end of file */
|
||||
|
||||
/* The following values will only be sent to a `git_diff_data_cb` when
|
||||
* the content of a diff is being formatted (eg. through
|
||||
* git_diff_print_patch() or git_diff_print_compact(), for instance).
|
||||
*/
|
||||
GIT_DIFF_LINE_FILE_HDR = 'F',
|
||||
GIT_DIFF_LINE_HUNK_HDR = 'H',
|
||||
GIT_DIFF_LINE_BINARY = 'B'
|
||||
} git_diff_line_t;
|
||||
|
||||
/**
|
||||
* When iterating over a diff, callback that will be made per text diff
|
||||
* line. In this context, the provided range will be NULL.
|
||||
*
|
||||
* When printing a diff, callback that will be made to output each line
|
||||
* of text. This uses some extra GIT_DIFF_LINE_... constants for output
|
||||
* of lines of file and hunk headers.
|
||||
*/
|
||||
typedef int (*git_diff_data_cb)(
|
||||
const git_diff_delta *delta, /** delta that contains this data */
|
||||
const git_diff_range *range, /** range of lines containing this data */
|
||||
char line_origin, /** git_diff_list_t value from above */
|
||||
const char *content, /** diff data - not NUL terminated */
|
||||
size_t content_len, /** number of bytes of diff data */
|
||||
void *payload); /** user reference data */
|
||||
|
||||
/**
|
||||
* The diff patch is used to store all the text diffs for a delta.
|
||||
*
|
||||
* You can easily loop over the content of patches and get information about
|
||||
* them.
|
||||
*/
|
||||
typedef struct git_diff_patch git_diff_patch;
|
||||
|
||||
/**
|
||||
* Flags to control the behavior of diff rename/copy detection.
|
||||
*/
|
||||
typedef enum {
|
||||
/** look for renames? (`--find-renames`) */
|
||||
GIT_DIFF_FIND_RENAMES = (1 << 0),
|
||||
/** consider old size of modified for renames? (`--break-rewrites=N`) */
|
||||
GIT_DIFF_FIND_RENAMES_FROM_REWRITES = (1 << 1),
|
||||
|
||||
/** look for copies? (a la `--find-copies`) */
|
||||
GIT_DIFF_FIND_COPIES = (1 << 2),
|
||||
/** consider unmodified as copy sources? (`--find-copies-harder`) */
|
||||
GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED = (1 << 3),
|
||||
|
||||
/** split large rewrites into delete/add pairs (`--break-rewrites=/M`) */
|
||||
GIT_DIFF_FIND_AND_BREAK_REWRITES = (1 << 4),
|
||||
} git_diff_find_t;
|
||||
|
||||
/**
|
||||
* Control behavior of rename and copy detection
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int version;
|
||||
|
||||
/** Combination of git_diff_find_t values (default FIND_RENAMES) */
|
||||
unsigned int flags;
|
||||
|
||||
/** Similarity to consider a file renamed (default 50) */
|
||||
unsigned int rename_threshold;
|
||||
/** Similarity of modified to be eligible rename source (default 50) */
|
||||
unsigned int rename_from_rewrite_threshold;
|
||||
/** Similarity to consider a file a copy (default 50) */
|
||||
unsigned int copy_threshold;
|
||||
/** Similarity to split modify into delete/add pair (default 60) */
|
||||
unsigned int break_rewrite_threshold;
|
||||
|
||||
/** Maximum similarity sources to examine (a la diff's `-l` option or
|
||||
* the `diff.renameLimit` config) (default 200)
|
||||
*/
|
||||
unsigned int target_limit;
|
||||
} git_diff_find_options;
|
||||
|
||||
#define GIT_DIFF_FIND_OPTIONS_VERSION 1
|
||||
#define GIT_DIFF_FIND_OPTIONS_INIT {GIT_DIFF_FIND_OPTIONS_VERSION}
|
||||
|
||||
/** @name Diff List Generator Functions
|
||||
*
|
||||
* These are the functions you would use to create (or destroy) a
|
||||
* git_diff_list from various objects in a repository.
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
/**
|
||||
* Deallocate a diff list.
|
||||
*/
|
||||
GIT_EXTERN(void) git_diff_list_free(git_diff_list *diff);
|
||||
|
||||
/**
|
||||
* Create a diff list with the difference between two tree objects.
|
||||
*
|
||||
* This is equivalent to `git diff <old-tree> <new-tree>`
|
||||
*
|
||||
* The first tree will be used for the "old_file" side of the delta and the
|
||||
* second tree will be used for the "new_file" side of the delta.
|
||||
*
|
||||
* @param diff Output pointer to a git_diff_list pointer to be allocated.
|
||||
* @param repo The repository containing the trees.
|
||||
* @param old_tree A git_tree object to diff from.
|
||||
* @param new_tree A git_tree object to diff to.
|
||||
* @param opts Structure with options to influence diff or NULL for defaults.
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_tree_to_tree(
|
||||
git_diff_list **diff,
|
||||
git_repository *repo,
|
||||
git_tree *old_tree,
|
||||
git_tree *new_tree,
|
||||
const git_diff_options *opts); /**< can be NULL for defaults */
|
||||
|
||||
/**
|
||||
* Create a diff list between a tree and repository index.
|
||||
*
|
||||
* This is equivalent to `git diff --cached <treeish>` or if you pass
|
||||
* the HEAD tree, then like `git diff --cached`.
|
||||
*
|
||||
* The tree you pass will be used for the "old_file" side of the delta, and
|
||||
* the index will be used for the "new_file" side of the delta.
|
||||
*
|
||||
* @param diff Output pointer to a git_diff_list pointer to be allocated.
|
||||
* @param repo The repository containing the tree and index.
|
||||
* @param old_tree A git_tree object to diff from.
|
||||
* @param index The index to diff with; repo index used if NULL.
|
||||
* @param opts Structure with options to influence diff or NULL for defaults.
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_tree_to_index(
|
||||
git_diff_list **diff,
|
||||
git_repository *repo,
|
||||
git_tree *old_tree,
|
||||
git_index *index,
|
||||
const git_diff_options *opts); /**< can be NULL for defaults */
|
||||
|
||||
/**
|
||||
* Create a diff list between the repository index and the workdir directory.
|
||||
*
|
||||
* This matches the `git diff` command. See the note below on
|
||||
* `git_diff_tree_to_workdir` for a discussion of the difference between
|
||||
* `git diff` and `git diff HEAD` and how to emulate a `git diff <treeish>`
|
||||
* using libgit2.
|
||||
*
|
||||
* The index will be used for the "old_file" side of the delta, and the
|
||||
* working directory will be used for the "new_file" side of the delta.
|
||||
*
|
||||
* @param diff Output pointer to a git_diff_list pointer to be allocated.
|
||||
* @param repo The repository.
|
||||
* @param index The index to diff from; repo index used if NULL.
|
||||
* @param opts Structure with options to influence diff or NULL for defaults.
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_index_to_workdir(
|
||||
git_diff_list **diff,
|
||||
git_repository *repo,
|
||||
git_index *index,
|
||||
const git_diff_options *opts); /**< can be NULL for defaults */
|
||||
|
||||
/**
|
||||
* Create a diff list between a tree and the working directory.
|
||||
*
|
||||
* The tree you provide will be used for the "old_file" side of the delta,
|
||||
* and the working directory will be used for the "new_file" side.
|
||||
*
|
||||
* Please note: this is *NOT* the same as `git diff <treeish>`. Running
|
||||
* `git diff HEAD` or the like actually uses information from the index,
|
||||
* along with the tree and working directory info.
|
||||
*
|
||||
* This function returns strictly the differences between the tree and the
|
||||
* files contained in the working directory, regardless of the state of
|
||||
* files in the index. It may come as a surprise, but there is no direct
|
||||
* equivalent in core git.
|
||||
*
|
||||
* To emulate `git diff <treeish>`, call both `git_diff_tree_to_index` and
|
||||
* `git_diff_index_to_workdir`, then call `git_diff_merge` on the results.
|
||||
* That will yield a `git_diff_list` that matches the git output.
|
||||
*
|
||||
* If this seems confusing, take the case of a file with a staged deletion
|
||||
* where the file has then been put back into the working dir and modified.
|
||||
* The tree-to-workdir diff for that file is 'modified', but core git would
|
||||
* show status 'deleted' since there is a pending deletion in the index.
|
||||
*
|
||||
* @param diff A pointer to a git_diff_list pointer that will be allocated.
|
||||
* @param repo The repository containing the tree.
|
||||
* @param old_tree A git_tree object to diff from.
|
||||
* @param opts Structure with options to influence diff or NULL for defaults.
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_tree_to_workdir(
|
||||
git_diff_list **diff,
|
||||
git_repository *repo,
|
||||
git_tree *old_tree,
|
||||
const git_diff_options *opts); /**< can be NULL for defaults */
|
||||
|
||||
/**
|
||||
* Merge one diff list into another.
|
||||
*
|
||||
* This merges items from the "from" list into the "onto" list. The
|
||||
* resulting diff list will have all items that appear in either list.
|
||||
* If an item appears in both lists, then it will be "merged" to appear
|
||||
* as if the old version was from the "onto" list and the new version
|
||||
* is from the "from" list (with the exception that if the item has a
|
||||
* pending DELETE in the middle, then it will show as deleted).
|
||||
*
|
||||
* @param onto Diff to merge into.
|
||||
* @param from Diff to merge.
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_merge(
|
||||
git_diff_list *onto,
|
||||
const git_diff_list *from);
|
||||
|
||||
/**
|
||||
* Transform a diff list marking file renames, copies, etc.
|
||||
*
|
||||
* This modifies a diff list in place, replacing old entries that look
|
||||
* like renames or copies with new entries reflecting those changes.
|
||||
* This also will, if requested, break modified files into add/remove
|
||||
* pairs if the amount of change is above a threshold.
|
||||
*
|
||||
* @param diff Diff list to run detection algorithms on
|
||||
* @param options Control how detection should be run, NULL for defaults
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_find_similar(
|
||||
git_diff_list *diff,
|
||||
git_diff_find_options *options);
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
||||
/** @name Diff List Processor Functions
|
||||
*
|
||||
* These are the functions you apply to a diff list to process it
|
||||
* or read it in some way.
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
/**
|
||||
* Loop over all deltas in a diff list issuing callbacks.
|
||||
*
|
||||
* This will iterate through all of the files described in a diff. You
|
||||
* should provide a file callback to learn about each file.
|
||||
*
|
||||
* The "hunk" and "line" callbacks are optional, and the text diff of the
|
||||
* files will only be calculated if they are not NULL. Of course, these
|
||||
* callbacks will not be invoked for binary files on the diff list or for
|
||||
* files whose only changed is a file mode change.
|
||||
*
|
||||
* Returning a non-zero value from any of the callbacks will terminate
|
||||
* the iteration and cause this return `GIT_EUSER`.
|
||||
*
|
||||
* @param diff A git_diff_list generated by one of the above functions.
|
||||
* @param file_cb Callback function to make per file in the diff.
|
||||
* @param hunk_cb Optional callback to make per hunk of text diff. This
|
||||
* callback is called to describe a range of lines in the
|
||||
* diff. It will not be issued for binary files.
|
||||
* @param line_cb Optional callback to make per line of diff text. This
|
||||
* same callback will be made for context lines, added, and
|
||||
* removed lines, and even for a deleted trailing newline.
|
||||
* @param payload Reference pointer that will be passed to your callbacks.
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_foreach(
|
||||
git_diff_list *diff,
|
||||
git_diff_file_cb file_cb,
|
||||
git_diff_hunk_cb hunk_cb,
|
||||
git_diff_data_cb line_cb,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Iterate over a diff generating text output like "git diff --name-status".
|
||||
*
|
||||
* Returning a non-zero value from the callbacks will terminate the
|
||||
* iteration and cause this return `GIT_EUSER`.
|
||||
*
|
||||
* @param diff A git_diff_list generated by one of the above functions.
|
||||
* @param print_cb Callback to make per line of diff text.
|
||||
* @param payload Reference pointer that will be passed to your callback.
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_print_compact(
|
||||
git_diff_list *diff,
|
||||
git_diff_data_cb print_cb,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Look up the single character abbreviation for a delta status code.
|
||||
*
|
||||
* When you call `git_diff_print_compact` it prints single letter codes into
|
||||
* the output such as 'A' for added, 'D' for deleted, 'M' for modified, etc.
|
||||
* It is sometimes convenient to convert a git_delta_t value into these
|
||||
* letters for your own purposes. This function does just that. By the
|
||||
* way, unmodified will return a space (i.e. ' ').
|
||||
*
|
||||
* @param delta_t The git_delta_t value to look up
|
||||
* @return The single character label for that code
|
||||
*/
|
||||
GIT_EXTERN(char) git_diff_status_char(git_delta_t status);
|
||||
|
||||
/**
|
||||
* Iterate over a diff generating text output like "git diff".
|
||||
*
|
||||
* This is a super easy way to generate a patch from a diff.
|
||||
*
|
||||
* Returning a non-zero value from the callbacks will terminate the
|
||||
* iteration and cause this return `GIT_EUSER`.
|
||||
*
|
||||
* @param diff A git_diff_list generated by one of the above functions.
|
||||
* @param payload Reference pointer that will be passed to your callbacks.
|
||||
* @param print_cb Callback function to output lines of the diff. This
|
||||
* same function will be called for file headers, hunk
|
||||
* headers, and diff lines. Fortunately, you can probably
|
||||
* use various GIT_DIFF_LINE constants to determine what
|
||||
* text you are given.
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_print_patch(
|
||||
git_diff_list *diff,
|
||||
git_diff_data_cb print_cb,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Query how many diff records are there in a diff list.
|
||||
*
|
||||
* @param diff A git_diff_list generated by one of the above functions
|
||||
* @return Count of number of deltas in the list
|
||||
*/
|
||||
GIT_EXTERN(size_t) git_diff_num_deltas(git_diff_list *diff);
|
||||
|
||||
/**
|
||||
* Query how many diff deltas are there in a diff list filtered by type.
|
||||
*
|
||||
* This works just like `git_diff_entrycount()` with an extra parameter
|
||||
* that is a `git_delta_t` and returns just the count of how many deltas
|
||||
* match that particular type.
|
||||
*
|
||||
* @param diff A git_diff_list generated by one of the above functions
|
||||
* @param type A git_delta_t value to filter the count
|
||||
* @return Count of number of deltas matching delta_t type
|
||||
*/
|
||||
GIT_EXTERN(size_t) git_diff_num_deltas_of_type(
|
||||
git_diff_list *diff,
|
||||
git_delta_t type);
|
||||
|
||||
/**
|
||||
* Return the diff delta and patch for an entry in the diff list.
|
||||
*
|
||||
* The `git_diff_patch` is a newly created object contains the text diffs
|
||||
* for the delta. You have to call `git_diff_patch_free()` when you are
|
||||
* done with it. You can use the patch object to loop over all the hunks
|
||||
* and lines in the diff of the one delta.
|
||||
*
|
||||
* For an unchanged file or a binary file, no `git_diff_patch` will be
|
||||
* created, the output will be set to NULL, and the `binary` flag will be
|
||||
* set true in the `git_diff_delta` structure.
|
||||
*
|
||||
* The `git_diff_delta` pointer points to internal data and you do not have
|
||||
* to release it when you are done with it. It will go away when the
|
||||
* `git_diff_list` and `git_diff_patch` go away.
|
||||
*
|
||||
* It is okay to pass NULL for either of the output parameters; if you pass
|
||||
* NULL for the `git_diff_patch`, then the text diff will not be calculated.
|
||||
*
|
||||
* @param patch_out Output parameter for the delta patch object
|
||||
* @param delta_out Output parameter for the delta object
|
||||
* @param diff Diff list object
|
||||
* @param idx Index into diff list
|
||||
* @return 0 on success, other value < 0 on error
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_get_patch(
|
||||
git_diff_patch **patch_out,
|
||||
const git_diff_delta **delta_out,
|
||||
git_diff_list *diff,
|
||||
size_t idx);
|
||||
|
||||
/**
|
||||
* Free a git_diff_patch object.
|
||||
*/
|
||||
GIT_EXTERN(void) git_diff_patch_free(
|
||||
git_diff_patch *patch);
|
||||
|
||||
/**
|
||||
* Get the delta associated with a patch
|
||||
*/
|
||||
GIT_EXTERN(const git_diff_delta *) git_diff_patch_delta(
|
||||
git_diff_patch *patch);
|
||||
|
||||
/**
|
||||
* Get the number of hunks in a patch
|
||||
*/
|
||||
GIT_EXTERN(size_t) git_diff_patch_num_hunks(
|
||||
git_diff_patch *patch);
|
||||
|
||||
/**
|
||||
* Get the information about a hunk in a patch
|
||||
*
|
||||
* Given a patch and a hunk index into the patch, this returns detailed
|
||||
* information about that hunk. Any of the output pointers can be passed
|
||||
* as NULL if you don't care about that particular piece of information.
|
||||
*
|
||||
* @param range Output pointer to git_diff_range of hunk
|
||||
* @param header Output pointer to header string for hunk. Unlike the
|
||||
* content pointer for each line, this will be NUL-terminated
|
||||
* @param header_len Output value of characters in header string
|
||||
* @param lines_in_hunk Output count of total lines in this hunk
|
||||
* @param patch Input pointer to patch object
|
||||
* @param hunk_idx Input index of hunk to get information about
|
||||
* @return 0 on success, GIT_ENOTFOUND if hunk_idx out of range, <0 on error
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_patch_get_hunk(
|
||||
const git_diff_range **range,
|
||||
const char **header,
|
||||
size_t *header_len,
|
||||
size_t *lines_in_hunk,
|
||||
git_diff_patch *patch,
|
||||
size_t hunk_idx);
|
||||
|
||||
/**
|
||||
* Get the number of lines in a hunk.
|
||||
*
|
||||
* @param patch The git_diff_patch object
|
||||
* @param hunk_idx Index of the hunk
|
||||
* @return Number of lines in hunk or -1 if invalid hunk index
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_patch_num_lines_in_hunk(
|
||||
git_diff_patch *patch,
|
||||
size_t hunk_idx);
|
||||
|
||||
/**
|
||||
* Get data about a line in a hunk of a patch.
|
||||
*
|
||||
* Given a patch, a hunk index, and a line index in the hunk, this
|
||||
* will return a lot of details about that line. If you pass a hunk
|
||||
* index larger than the number of hunks or a line index larger than
|
||||
* the number of lines in the hunk, this will return -1.
|
||||
*
|
||||
* @param line_origin A GIT_DIFF_LINE constant from above
|
||||
* @param content Pointer to content of diff line, not NUL-terminated
|
||||
* @param content_len Number of characters in content
|
||||
* @param old_lineno Line number in old file or -1 if line is added
|
||||
* @param new_lineno Line number in new file or -1 if line is deleted
|
||||
* @param patch The patch to look in
|
||||
* @param hunk_idx The index of the hunk
|
||||
* @param line_of_index The index of the line in the hunk
|
||||
* @return 0 on success, <0 on failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_patch_get_line_in_hunk(
|
||||
char *line_origin,
|
||||
const char **content,
|
||||
size_t *content_len,
|
||||
int *old_lineno,
|
||||
int *new_lineno,
|
||||
git_diff_patch *patch,
|
||||
size_t hunk_idx,
|
||||
size_t line_of_hunk);
|
||||
|
||||
/**
|
||||
* Serialize the patch to text via callback.
|
||||
*
|
||||
* Returning a non-zero value from the callback will terminate the iteration
|
||||
* and cause this return `GIT_EUSER`.
|
||||
*
|
||||
* @param patch A git_diff_patch representing changes to one file
|
||||
* @param print_cb Callback function to output lines of the patch. Will be
|
||||
* called for file headers, hunk headers, and diff lines.
|
||||
* @param payload Reference pointer that will be passed to your callbacks.
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_patch_print(
|
||||
git_diff_patch *patch,
|
||||
git_diff_data_cb print_cb,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Get the content of a patch as a single diff text.
|
||||
*
|
||||
* @param string Allocated string; caller must free.
|
||||
* @param patch A git_diff_patch representing changes to one file
|
||||
* @return 0 on success, <0 on failure.
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_patch_to_str(
|
||||
char **string,
|
||||
git_diff_patch *patch);
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
||||
/*
|
||||
* Misc
|
||||
*/
|
||||
|
||||
/**
|
||||
* Directly run a diff on two blobs.
|
||||
*
|
||||
* Compared to a file, a blob lacks some contextual information. As such,
|
||||
* the `git_diff_file` given to the callback will have some fake data; i.e.
|
||||
* `mode` will be 0 and `path` will be NULL.
|
||||
*
|
||||
* NULL is allowed for either `old_blob` or `new_blob` and will be treated
|
||||
* as an empty blob, with the `oid` set to NULL in the `git_diff_file` data.
|
||||
*
|
||||
* We do run a binary content check on the two blobs and if either of the
|
||||
* blobs looks like binary data, the `git_diff_delta` binary attribute will
|
||||
* be set to 1 and no call to the hunk_cb nor line_cb will be made (unless
|
||||
* you pass `GIT_DIFF_FORCE_TEXT` of course).
|
||||
*
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_blobs(
|
||||
const git_blob *old_blob,
|
||||
const git_blob *new_blob,
|
||||
const git_diff_options *options,
|
||||
git_diff_file_cb file_cb,
|
||||
git_diff_hunk_cb hunk_cb,
|
||||
git_diff_data_cb line_cb,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Directly run a diff between a blob and a buffer.
|
||||
*
|
||||
* As with `git_diff_blobs`, comparing a blob and buffer lacks some context,
|
||||
* so the `git_diff_file` parameters to the callbacks will be faked a la the
|
||||
* rules for `git_diff_blobs()`.
|
||||
*
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_blob_to_buffer(
|
||||
const git_blob *old_blob,
|
||||
const char *buffer,
|
||||
size_t buffer_len,
|
||||
const git_diff_options *options,
|
||||
git_diff_file_cb file_cb,
|
||||
git_diff_hunk_cb hunk_cb,
|
||||
git_diff_data_cb data_cb,
|
||||
void *payload);
|
||||
|
||||
GIT_END_DECL
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_errors_h__
|
||||
#define INCLUDE_git_errors_h__
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* @file git2/errors.h
|
||||
* @brief Git error handling routines and variables
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/** Generic return codes */
|
||||
enum {
|
||||
GIT_OK = 0,
|
||||
GIT_ERROR = -1,
|
||||
GIT_ENOTFOUND = -3,
|
||||
GIT_EEXISTS = -4,
|
||||
GIT_EAMBIGUOUS = -5,
|
||||
GIT_EBUFS = -6,
|
||||
GIT_EUSER = -7,
|
||||
GIT_EBAREREPO = -8,
|
||||
GIT_EORPHANEDHEAD = -9,
|
||||
GIT_EUNMERGED = -10,
|
||||
GIT_ENONFASTFORWARD = -11,
|
||||
GIT_EINVALIDSPEC = -12,
|
||||
|
||||
GIT_PASSTHROUGH = -30,
|
||||
GIT_ITEROVER = -31,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char *message;
|
||||
int klass;
|
||||
} git_error;
|
||||
|
||||
/** Error classes */
|
||||
typedef enum {
|
||||
GITERR_NOMEMORY,
|
||||
GITERR_OS,
|
||||
GITERR_INVALID,
|
||||
GITERR_REFERENCE,
|
||||
GITERR_ZLIB,
|
||||
GITERR_REPOSITORY,
|
||||
GITERR_CONFIG,
|
||||
GITERR_REGEX,
|
||||
GITERR_ODB,
|
||||
GITERR_INDEX,
|
||||
GITERR_OBJECT,
|
||||
GITERR_NET,
|
||||
GITERR_TAG,
|
||||
GITERR_TREE,
|
||||
GITERR_INDEXER,
|
||||
GITERR_SSL,
|
||||
GITERR_SUBMODULE,
|
||||
GITERR_THREAD,
|
||||
GITERR_STASH,
|
||||
GITERR_CHECKOUT,
|
||||
GITERR_FETCHHEAD,
|
||||
GITERR_MERGE,
|
||||
} git_error_t;
|
||||
|
||||
/**
|
||||
* Return the last `git_error` object that was generated for the
|
||||
* current thread or NULL if no error has occurred.
|
||||
*
|
||||
* @return A git_error object.
|
||||
*/
|
||||
GIT_EXTERN(const git_error *) giterr_last(void);
|
||||
|
||||
/**
|
||||
* Clear the last library error that occurred for this thread.
|
||||
*/
|
||||
GIT_EXTERN(void) giterr_clear(void);
|
||||
|
||||
/**
|
||||
* Set the error message string for this thread.
|
||||
*
|
||||
* This function is public so that custom ODB backends and the like can
|
||||
* relay an error message through libgit2. Most regular users of libgit2
|
||||
* will never need to call this function -- actually, calling it in most
|
||||
* circumstances (for example, calling from within a callback function)
|
||||
* will just end up having the value overwritten by libgit2 internals.
|
||||
*
|
||||
* This error message is stored in thread-local storage and only applies
|
||||
* to the particular thread that this libgit2 call is made from.
|
||||
*
|
||||
* NOTE: Passing the `error_class` as GITERR_OS has a special behavior: we
|
||||
* attempt to append the system default error message for the last OS error
|
||||
* that occurred and then clear the last error. The specific implementation
|
||||
* of looking up and clearing this last OS error will vary by platform.
|
||||
*
|
||||
* @param error_class One of the `git_error_t` enum above describing the
|
||||
* general subsystem that is responsible for the error.
|
||||
* @param message The formatted error message to keep
|
||||
*/
|
||||
GIT_EXTERN(void) giterr_set_str(int error_class, const char *string);
|
||||
|
||||
/**
|
||||
* Set the error message to a special value for memory allocation failure.
|
||||
*
|
||||
* The normal `giterr_set_str()` function attempts to `strdup()` the string
|
||||
* that is passed in. This is not a good idea when the error in question
|
||||
* is a memory allocation failure. That circumstance has a special setter
|
||||
* function that sets the error string to a known and statically allocated
|
||||
* internal value.
|
||||
*/
|
||||
GIT_EXTERN(void) giterr_set_oom(void);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_graph_h__
|
||||
#define INCLUDE_git_graph_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
|
||||
/**
|
||||
* @file git2/graph.h
|
||||
* @brief Git graph traversal routines
|
||||
* @defgroup git_revwalk Git graph traversal routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Count the number of unique commits between two commit objects
|
||||
*
|
||||
* @param ahead number of commits, starting at `one`, unique from commits in `two`
|
||||
* @param behind number of commits, starting at `two`, unique from commits in `one`
|
||||
* @param repo the repository where the commits exist
|
||||
* @param one one of the commits
|
||||
* @param two the other commit
|
||||
*/
|
||||
GIT_EXTERN(int) git_graph_ahead_behind(size_t *ahead, size_t *behind, git_repository *repo, const git_oid *one, const git_oid *two);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_ignore_h__
|
||||
#define INCLUDE_git_ignore_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Add ignore rules for a repository.
|
||||
*
|
||||
* Excludesfile rules (i.e. .gitignore rules) are generally read from
|
||||
* .gitignore files in the repository tree or from a shared system file
|
||||
* only if a "core.excludesfile" config value is set. The library also
|
||||
* keeps a set of per-repository internal ignores that can be configured
|
||||
* in-memory and will not persist. This function allows you to add to
|
||||
* that internal rules list.
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* error = git_ignore_add_rule(myrepo, "*.c\ndir/\nFile with space\n");
|
||||
*
|
||||
* This would add three rules to the ignores.
|
||||
*
|
||||
* @param repo The repository to add ignore rules to.
|
||||
* @param rules Text of rules, a la the contents of a .gitignore file.
|
||||
* It is okay to have multiple rules in the text; if so,
|
||||
* each rule should be terminated with a newline.
|
||||
* @return 0 on success
|
||||
*/
|
||||
GIT_EXTERN(int) git_ignore_add_rule(
|
||||
git_repository *repo,
|
||||
const char *rules);
|
||||
|
||||
/**
|
||||
* Clear ignore rules that were explicitly added.
|
||||
*
|
||||
* Resets to the default internal ignore rules. This will not turn off
|
||||
* rules in .gitignore files that actually exist in the filesystem.
|
||||
*
|
||||
* The default internal ignores ignore ".", ".." and ".git" entries.
|
||||
*
|
||||
* @param repo The repository to remove ignore rules from.
|
||||
* @return 0 on success
|
||||
*/
|
||||
GIT_EXTERN(int) git_ignore_clear_internal_rules(
|
||||
git_repository *repo);
|
||||
|
||||
/**
|
||||
* Test if the ignore rules apply to a given path.
|
||||
*
|
||||
* This function checks the ignore rules to see if they would apply to the
|
||||
* given file. This indicates if the file would be ignored regardless of
|
||||
* whether the file is already in the index or committed to the repository.
|
||||
*
|
||||
* One way to think of this is if you were to do "git add ." on the
|
||||
* directory containing the file, would it be added or not?
|
||||
*
|
||||
* @param ignored boolean returning 0 if the file is not ignored, 1 if it is
|
||||
* @param repo a repository object
|
||||
* @param path the file to check ignores for, relative to the repo's workdir.
|
||||
* @return 0 if ignore rules could be processed for the file (regardless
|
||||
* of whether it exists or not), or an error < 0 if they could not.
|
||||
*/
|
||||
GIT_EXTERN(int) git_ignore_path_is_ignored(
|
||||
int *ignored,
|
||||
git_repository *repo,
|
||||
const char *path);
|
||||
|
||||
GIT_END_DECL
|
||||
|
||||
#endif
|
||||
@@ -1,552 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_index_h__
|
||||
#define INCLUDE_git_index_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "indexer.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
|
||||
/**
|
||||
* @file git2/index.h
|
||||
* @brief Git index parsing and manipulation routines
|
||||
* @defgroup git_index Git index parsing and manipulation routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
#define GIT_IDXENTRY_NAMEMASK (0x0fff)
|
||||
#define GIT_IDXENTRY_STAGEMASK (0x3000)
|
||||
#define GIT_IDXENTRY_EXTENDED (0x4000)
|
||||
#define GIT_IDXENTRY_VALID (0x8000)
|
||||
#define GIT_IDXENTRY_STAGESHIFT 12
|
||||
|
||||
/*
|
||||
* Flags are divided into two parts: in-memory flags and
|
||||
* on-disk ones. Flags in GIT_IDXENTRY_EXTENDED_FLAGS
|
||||
* will get saved on-disk.
|
||||
*
|
||||
* In-memory only flags:
|
||||
*/
|
||||
#define GIT_IDXENTRY_UPDATE (1 << 0)
|
||||
#define GIT_IDXENTRY_REMOVE (1 << 1)
|
||||
#define GIT_IDXENTRY_UPTODATE (1 << 2)
|
||||
#define GIT_IDXENTRY_ADDED (1 << 3)
|
||||
|
||||
#define GIT_IDXENTRY_HASHED (1 << 4)
|
||||
#define GIT_IDXENTRY_UNHASHED (1 << 5)
|
||||
#define GIT_IDXENTRY_WT_REMOVE (1 << 6) /* remove in work directory */
|
||||
#define GIT_IDXENTRY_CONFLICTED (1 << 7)
|
||||
|
||||
#define GIT_IDXENTRY_UNPACKED (1 << 8)
|
||||
#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 9)
|
||||
|
||||
/*
|
||||
* Extended on-disk flags:
|
||||
*/
|
||||
#define GIT_IDXENTRY_INTENT_TO_ADD (1 << 13)
|
||||
#define GIT_IDXENTRY_SKIP_WORKTREE (1 << 14)
|
||||
/* GIT_IDXENTRY_EXTENDED2 is for future extension */
|
||||
#define GIT_IDXENTRY_EXTENDED2 (1 << 15)
|
||||
|
||||
#define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_IDXENTRY_INTENT_TO_ADD | GIT_IDXENTRY_SKIP_WORKTREE)
|
||||
|
||||
/** Time used in a git index entry */
|
||||
typedef struct {
|
||||
git_time_t seconds;
|
||||
/* nsec should not be stored as time_t compatible */
|
||||
unsigned int nanoseconds;
|
||||
} git_index_time;
|
||||
|
||||
/** Memory representation of a file entry in the index. */
|
||||
typedef struct git_index_entry {
|
||||
git_index_time ctime;
|
||||
git_index_time mtime;
|
||||
|
||||
unsigned int dev;
|
||||
unsigned int ino;
|
||||
unsigned int mode;
|
||||
unsigned int uid;
|
||||
unsigned int gid;
|
||||
git_off_t file_size;
|
||||
|
||||
git_oid oid;
|
||||
|
||||
unsigned short flags;
|
||||
unsigned short flags_extended;
|
||||
|
||||
char *path;
|
||||
} git_index_entry;
|
||||
|
||||
/** Representation of a resolve undo entry in the index. */
|
||||
typedef struct git_index_reuc_entry {
|
||||
unsigned int mode[3];
|
||||
git_oid oid[3];
|
||||
char *path;
|
||||
} git_index_reuc_entry;
|
||||
|
||||
/** Capabilities of system that affect index actions. */
|
||||
enum {
|
||||
GIT_INDEXCAP_IGNORE_CASE = 1,
|
||||
GIT_INDEXCAP_NO_FILEMODE = 2,
|
||||
GIT_INDEXCAP_NO_SYMLINKS = 4,
|
||||
GIT_INDEXCAP_FROM_OWNER = ~0u
|
||||
};
|
||||
|
||||
/** @name Index File Functions
|
||||
*
|
||||
* These functions work on the index file itself.
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
/**
|
||||
* Create a new bare Git index object as a memory representation
|
||||
* of the Git index file in 'index_path', without a repository
|
||||
* to back it.
|
||||
*
|
||||
* Since there is no ODB or working directory behind this index,
|
||||
* any Index methods which rely on these (e.g. index_add) will
|
||||
* fail with the GIT_EBAREINDEX error code.
|
||||
*
|
||||
* If you need to access the index of an actual repository,
|
||||
* use the `git_repository_index` wrapper.
|
||||
*
|
||||
* The index must be freed once it's no longer in use.
|
||||
*
|
||||
* @param out the pointer for the new index
|
||||
* @param index_path the path to the index file in disk
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_open(git_index **out, const char *index_path);
|
||||
|
||||
/**
|
||||
* Create an in-memory index object.
|
||||
*
|
||||
* This index object cannot be read/written to the filesystem,
|
||||
* but may be used to perform in-memory index operations.
|
||||
*
|
||||
* The index must be freed once it's no longer in use.
|
||||
*
|
||||
* @param out the pointer for the new index
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_new(git_index **out);
|
||||
|
||||
/**
|
||||
* Free an existing index object.
|
||||
*
|
||||
* @param index an existing index object
|
||||
*/
|
||||
GIT_EXTERN(void) git_index_free(git_index *index);
|
||||
|
||||
/**
|
||||
* Get the repository this index relates to
|
||||
*
|
||||
* @param index The index
|
||||
* @return A pointer to the repository
|
||||
*/
|
||||
GIT_EXTERN(git_repository *) git_index_owner(const git_index *index);
|
||||
|
||||
/**
|
||||
* Read index capabilities flags.
|
||||
*
|
||||
* @param index An existing index object
|
||||
* @return A combination of GIT_INDEXCAP values
|
||||
*/
|
||||
GIT_EXTERN(unsigned int) git_index_caps(const git_index *index);
|
||||
|
||||
/**
|
||||
* Set index capabilities flags.
|
||||
*
|
||||
* If you pass `GIT_INDEXCAP_FROM_OWNER` for the caps, then the
|
||||
* capabilities will be read from the config of the owner object,
|
||||
* looking at `core.ignorecase`, `core.filemode`, `core.symlinks`.
|
||||
*
|
||||
* @param index An existing index object
|
||||
* @param caps A combination of GIT_INDEXCAP values
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_set_caps(git_index *index, unsigned int caps);
|
||||
|
||||
/**
|
||||
* Update the contents of an existing index object in memory
|
||||
* by reading from the hard disk.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_read(git_index *index);
|
||||
|
||||
/**
|
||||
* Write an existing index object from memory back to disk
|
||||
* using an atomic file lock.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_write(git_index *index);
|
||||
|
||||
/**
|
||||
* Read a tree into the index file with stats
|
||||
*
|
||||
* The current index contents will be replaced by the specified tree.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param tree tree to read
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_read_tree(git_index *index, const git_tree *tree);
|
||||
|
||||
/**
|
||||
* Write the index as a tree
|
||||
*
|
||||
* This method will scan the index and write a representation
|
||||
* of its current state back to disk; it recursively creates
|
||||
* tree objects for each of the subtrees stored in the index,
|
||||
* but only returns the OID of the root tree. This is the OID
|
||||
* that can be used e.g. to create a commit.
|
||||
*
|
||||
* The index instance cannot be bare, and needs to be associated
|
||||
* to an existing repository.
|
||||
*
|
||||
* The index must not contain any file in conflict.
|
||||
*
|
||||
* @param out Pointer where to store the OID of the written tree
|
||||
* @param index Index to write
|
||||
* @return 0 on success, GIT_EUNMERGED when the index is not clean
|
||||
* or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_write_tree(git_oid *out, git_index *index);
|
||||
|
||||
/**
|
||||
* Write the index as a tree to the given repository
|
||||
*
|
||||
* This method will do the same as `git_index_write_tree`, but
|
||||
* letting the user choose the repository where the tree will
|
||||
* be written.
|
||||
*
|
||||
* The index must not contain any file in conflict.
|
||||
*
|
||||
* @param out Pointer where to store OID of the the written tree
|
||||
* @param index Index to write
|
||||
* @param repo Repository where to write the tree
|
||||
* @return 0 on success, GIT_EUNMERGED when the index is not clean
|
||||
* or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_write_tree_to(git_oid *out, git_index *index, git_repository *repo);
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @name Raw Index Entry Functions
|
||||
*
|
||||
* These functions work on index entries, and allow for raw manipulation
|
||||
* of the entries.
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
/* Index entry manipulation */
|
||||
|
||||
/**
|
||||
* Get the count of entries currently in the index
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @return integer of count of current entries
|
||||
*/
|
||||
GIT_EXTERN(size_t) git_index_entrycount(const git_index *index);
|
||||
|
||||
/**
|
||||
* Clear the contents (all the entries) of an index object.
|
||||
* This clears the index object in memory; changes must be manually
|
||||
* written to disk for them to take effect.
|
||||
*
|
||||
* @param index an existing index object
|
||||
*/
|
||||
GIT_EXTERN(void) git_index_clear(git_index *index);
|
||||
|
||||
/**
|
||||
* Get a pointer to one of the entries in the index
|
||||
*
|
||||
* The values of this entry can be modified (except the path)
|
||||
* and the changes will be written back to disk on the next
|
||||
* write() call.
|
||||
*
|
||||
* The entry should not be freed by the caller.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param n the position of the entry
|
||||
* @return a pointer to the entry; NULL if out of bounds
|
||||
*/
|
||||
GIT_EXTERN(const git_index_entry *) git_index_get_byindex(
|
||||
git_index *index, size_t n);
|
||||
|
||||
/**
|
||||
* Get a pointer to one of the entries in the index
|
||||
*
|
||||
* The values of this entry can be modified (except the path)
|
||||
* and the changes will be written back to disk on the next
|
||||
* write() call.
|
||||
*
|
||||
* The entry should not be freed by the caller.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param path path to search
|
||||
* @param stage stage to search
|
||||
* @return a pointer to the entry; NULL if it was not found
|
||||
*/
|
||||
GIT_EXTERN(const git_index_entry *) git_index_get_bypath(
|
||||
git_index *index, const char *path, int stage);
|
||||
|
||||
/**
|
||||
* Remove an entry from the index
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param path path to search
|
||||
* @param stage stage to search
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_remove(git_index *index, const char *path, int stage);
|
||||
|
||||
/**
|
||||
* Remove all entries from the index under a given directory
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param dir container directory path
|
||||
* @param stage stage to search
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_remove_directory(
|
||||
git_index *index, const char *dir, int stage);
|
||||
|
||||
/**
|
||||
* Add or update an index entry from an in-memory struct
|
||||
*
|
||||
* If a previous index entry exists that has the same path and stage
|
||||
* as the given 'source_entry', it will be replaced. Otherwise, the
|
||||
* 'source_entry' will be added.
|
||||
*
|
||||
* A full copy (including the 'path' string) of the given
|
||||
* 'source_entry' will be inserted on the index.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param source_entry new entry object
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_add(git_index *index, const git_index_entry *source_entry);
|
||||
|
||||
/**
|
||||
* Return the stage number from a git index entry
|
||||
*
|
||||
* This entry is calculated from the entry's flag
|
||||
* attribute like this:
|
||||
*
|
||||
* (entry->flags & GIT_IDXENTRY_STAGEMASK) >> GIT_IDXENTRY_STAGESHIFT
|
||||
*
|
||||
* @param entry The entry
|
||||
* @returns the stage number
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_entry_stage(const git_index_entry *entry);
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @name Workdir Index Entry Functions
|
||||
*
|
||||
* These functions work on index entries specifically in the working
|
||||
* directory (ie, stage 0).
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
/**
|
||||
* Add or update an index entry from a file in disk
|
||||
*
|
||||
* The file `path` must be relative to the repository's
|
||||
* working folder and must be readable.
|
||||
*
|
||||
* This method will fail in bare index instances.
|
||||
*
|
||||
* This forces the file to be added to the index, not looking
|
||||
* at gitignore rules. Those rules can be evaluated through
|
||||
* the git_status APIs (in status.h) before calling this.
|
||||
*
|
||||
* If this file currently is the result of a merge conflict, this
|
||||
* file will no longer be marked as conflicting. The data about
|
||||
* the conflict will be moved to the "resolve undo" (REUC) section.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param path filename to add
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_add_from_workdir(git_index *index, const char *path);
|
||||
|
||||
/**
|
||||
* Find the first index of any entries which point to given
|
||||
* path in the Git index.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param path path to search
|
||||
* @return an index >= 0 if found, -1 otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_find(git_index *index, const char *path);
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @name Conflict Index Entry Functions
|
||||
*
|
||||
* These functions work on conflict index entries specifically (ie, stages 1-3)
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
/**
|
||||
* Add or update index entries to represent a conflict
|
||||
*
|
||||
* The entries are the entries from the tree included in the merge. Any
|
||||
* entry may be null to indicate that that file was not present in the
|
||||
* trees during the merge. For example, ancestor_entry may be NULL to
|
||||
* indicate that a file was added in both branches and must be resolved.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param ancestor_entry the entry data for the ancestor of the conflict
|
||||
* @param our_entry the entry data for our side of the merge conflict
|
||||
* @param their_entry the entry data for their side of the merge conflict
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_conflict_add(
|
||||
git_index *index,
|
||||
const git_index_entry *ancestor_entry,
|
||||
const git_index_entry *our_entry,
|
||||
const git_index_entry *their_entry);
|
||||
|
||||
/**
|
||||
* Get the index entries that represent a conflict of a single file.
|
||||
*
|
||||
* The values of this entry can be modified (except the paths)
|
||||
* and the changes will be written back to disk on the next
|
||||
* write() call.
|
||||
*
|
||||
* @param ancestor_out Pointer to store the ancestor entry
|
||||
* @param our_out Pointer to store the our entry
|
||||
* @param their_out Pointer to store the their entry
|
||||
* @param index an existing index object
|
||||
* @param path path to search
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_conflict_get(git_index_entry **ancestor_out, git_index_entry **our_out, git_index_entry **their_out, git_index *index, const char *path);
|
||||
|
||||
/**
|
||||
* Removes the index entries that represent a conflict of a single file.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param path to search
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_conflict_remove(git_index *index, const char *path);
|
||||
|
||||
/**
|
||||
* Remove all conflicts in the index (entries with a stage greater than 0.)
|
||||
*
|
||||
* @param index an existing index object
|
||||
*/
|
||||
GIT_EXTERN(void) git_index_conflict_cleanup(git_index *index);
|
||||
|
||||
/**
|
||||
* Determine if the index contains entries representing file conflicts.
|
||||
*
|
||||
* @return 1 if at least one conflict is found, 0 otherwise.
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_has_conflicts(const git_index *index);
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @name Resolve Undo (REUC) index entry manipulation.
|
||||
*
|
||||
* These functions work on the Resolve Undo index extension and contains
|
||||
* data about the original files that led to a merge conflict.
|
||||
*/
|
||||
/**@{*/
|
||||
|
||||
/**
|
||||
* Get the count of resolve undo entries currently in the index.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @return integer of count of current resolve undo entries
|
||||
*/
|
||||
GIT_EXTERN(unsigned int) git_index_reuc_entrycount(git_index *index);
|
||||
|
||||
/**
|
||||
* Finds the resolve undo entry that points to the given path in the Git
|
||||
* index.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param path path to search
|
||||
* @return an index >= 0 if found, -1 otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_reuc_find(git_index *index, const char *path);
|
||||
|
||||
/**
|
||||
* Get a resolve undo entry from the index.
|
||||
*
|
||||
* The returned entry is read-only and should not be modified
|
||||
* or freed by the caller.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param path path to search
|
||||
* @return the resolve undo entry; NULL if not found
|
||||
*/
|
||||
GIT_EXTERN(const git_index_reuc_entry *) git_index_reuc_get_bypath(git_index *index, const char *path);
|
||||
|
||||
/**
|
||||
* Get a resolve undo entry from the index.
|
||||
*
|
||||
* The returned entry is read-only and should not be modified
|
||||
* or freed by the caller.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param n the position of the entry
|
||||
* @return a pointer to the resolve undo entry; NULL if out of bounds
|
||||
*/
|
||||
GIT_EXTERN(const git_index_reuc_entry *) git_index_reuc_get_byindex(git_index *index, size_t n);
|
||||
|
||||
/**
|
||||
* Adds a resolve undo entry for a file based on the given parameters.
|
||||
*
|
||||
* The resolve undo entry contains the OIDs of files that were involved
|
||||
* in a merge conflict after the conflict has been resolved. This allows
|
||||
* conflicts to be re-resolved later.
|
||||
*
|
||||
* If there exists a resolve undo entry for the given path in the index,
|
||||
* it will be removed.
|
||||
*
|
||||
* This method will fail in bare index instances.
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param path filename to add
|
||||
* @param ancestor_mode mode of the ancestor file
|
||||
* @param ancestor_id oid of the ancestor file
|
||||
* @param our_mode mode of our file
|
||||
* @param our_id oid of our file
|
||||
* @param their_mode mode of their file
|
||||
* @param their_id oid of their file
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_reuc_add(git_index *index, const char *path,
|
||||
int ancestor_mode, git_oid *ancestor_id,
|
||||
int our_mode, git_oid *our_id,
|
||||
int their_mode, git_oid *their_id);
|
||||
|
||||
/**
|
||||
* Remove an resolve undo entry from the index
|
||||
*
|
||||
* @param index an existing index object
|
||||
* @param n position of the resolve undo entry to remove
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_reuc_remove(git_index *index, size_t n);
|
||||
|
||||
/**@}*/
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,134 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef _INCLUDE_git_indexer_h__
|
||||
#define _INCLUDE_git_indexer_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "oid.h"
|
||||
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* This is passed as the first argument to the callback to allow the
|
||||
* user to see the progress.
|
||||
*/
|
||||
typedef struct git_transfer_progress {
|
||||
unsigned int total_objects;
|
||||
unsigned int indexed_objects;
|
||||
unsigned int received_objects;
|
||||
size_t received_bytes;
|
||||
} git_transfer_progress;
|
||||
|
||||
|
||||
/**
|
||||
* Type for progress callbacks during indexing
|
||||
*/
|
||||
typedef void (*git_transfer_progress_callback)(const git_transfer_progress *stats, void *payload);
|
||||
|
||||
typedef struct git_indexer git_indexer;
|
||||
typedef struct git_indexer_stream git_indexer_stream;
|
||||
|
||||
/**
|
||||
* Create a new streaming indexer instance
|
||||
*
|
||||
* @param out where to store the indexer instance
|
||||
* @param path to the directory where the packfile should be stored
|
||||
* @param progress_cb function to call with progress information
|
||||
* @param progress_payload payload for the progress callback
|
||||
*/
|
||||
GIT_EXTERN(int) git_indexer_stream_new(
|
||||
git_indexer_stream **out,
|
||||
const char *path,
|
||||
git_transfer_progress_callback progress_cb,
|
||||
void *progress_cb_payload);
|
||||
|
||||
/**
|
||||
* Add data to the indexer
|
||||
*
|
||||
* @param idx the indexer
|
||||
* @param data the data to add
|
||||
* @param size the size of the data in bytes
|
||||
* @param stats stat storage
|
||||
*/
|
||||
GIT_EXTERN(int) git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t size, git_transfer_progress *stats);
|
||||
|
||||
/**
|
||||
* Finalize the pack and index
|
||||
*
|
||||
* Resolve any pending deltas and write out the index file
|
||||
*
|
||||
* @param idx the indexer
|
||||
*/
|
||||
GIT_EXTERN(int) git_indexer_stream_finalize(git_indexer_stream *idx, git_transfer_progress *stats);
|
||||
|
||||
/**
|
||||
* Get the packfile's hash
|
||||
*
|
||||
* A packfile's name is derived from the sorted hashing of all object
|
||||
* names. This is only correct after the index has been finalized.
|
||||
*
|
||||
* @param idx the indexer instance
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_indexer_stream_hash(const git_indexer_stream *idx);
|
||||
|
||||
/**
|
||||
* Free the indexer and its resources
|
||||
*
|
||||
* @param idx the indexer to free
|
||||
*/
|
||||
GIT_EXTERN(void) git_indexer_stream_free(git_indexer_stream *idx);
|
||||
|
||||
/**
|
||||
* Create a new indexer instance
|
||||
*
|
||||
* @param out where to store the indexer instance
|
||||
* @param packname the absolute filename of the packfile to index
|
||||
*/
|
||||
GIT_EXTERN(int) git_indexer_new(git_indexer **out, const char *packname);
|
||||
|
||||
/**
|
||||
* Iterate over the objects in the packfile and extract the information
|
||||
*
|
||||
* Indexing a packfile can be very expensive so this function is
|
||||
* expected to be run in a worker thread and the stats used to provide
|
||||
* feedback the user.
|
||||
*
|
||||
* @param idx the indexer instance
|
||||
* @param stats storage for the running state
|
||||
*/
|
||||
GIT_EXTERN(int) git_indexer_run(git_indexer *idx, git_transfer_progress *stats);
|
||||
|
||||
/**
|
||||
* Write the index file to disk.
|
||||
*
|
||||
* The file will be stored as pack-$hash.idx in the same directory as
|
||||
* the packfile.
|
||||
*
|
||||
* @param idx the indexer instance
|
||||
*/
|
||||
GIT_EXTERN(int) git_indexer_write(git_indexer *idx);
|
||||
|
||||
/**
|
||||
* Get the packfile's hash
|
||||
*
|
||||
* A packfile's name is derived from the sorted hashing of all object
|
||||
* names. This is only correct after the index has been written to disk.
|
||||
*
|
||||
* @param idx the indexer instance
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_indexer_hash(const git_indexer *idx);
|
||||
|
||||
/**
|
||||
* Free the indexer and its resources
|
||||
*
|
||||
* @param idx the indexer to free
|
||||
*/
|
||||
GIT_EXTERN(void) git_indexer_free(git_indexer *idx);
|
||||
|
||||
GIT_END_DECL
|
||||
|
||||
#endif
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_merge_h__
|
||||
#define INCLUDE_git_merge_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
|
||||
/**
|
||||
* @file git2/merge.h
|
||||
* @brief Git merge-base routines
|
||||
* @defgroup git_revwalk Git merge-base routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Find a merge base between two commits
|
||||
*
|
||||
* @param out the OID of a merge base between 'one' and 'two'
|
||||
* @param repo the repository where the commits exist
|
||||
* @param one one of the commits
|
||||
* @param two the other commit
|
||||
* @return Zero on success; GIT_ENOTFOUND or -1 on failure.
|
||||
*/
|
||||
GIT_EXTERN(int) git_merge_base(
|
||||
git_oid *out,
|
||||
git_repository *repo,
|
||||
const git_oid *one,
|
||||
const git_oid *two);
|
||||
|
||||
/**
|
||||
* Find a merge base given a list of commits
|
||||
*
|
||||
* @param out the OID of a merge base considering all the commits
|
||||
* @param repo the repository where the commits exist
|
||||
* @param input_array oids of the commits
|
||||
* @param length The number of commits in the provided `input_array`
|
||||
* @return Zero on success; GIT_ENOTFOUND or -1 on failure.
|
||||
*/
|
||||
GIT_EXTERN(int) git_merge_base_many(
|
||||
git_oid *out,
|
||||
git_repository *repo,
|
||||
const git_oid input_array[],
|
||||
size_t length);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_message_h__
|
||||
#define INCLUDE_git_message_h__
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* @file git2/message.h
|
||||
* @brief Git message management routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Clean up message from excess whitespace and make sure that the last line
|
||||
* ends with a '\n'.
|
||||
*
|
||||
* Optionally, can remove lines starting with a "#".
|
||||
*
|
||||
* @param out The user-allocated buffer which will be filled with the
|
||||
* cleaned up message. Pass NULL if you just want to get the needed
|
||||
* size of the prettified message as the output value.
|
||||
*
|
||||
* @param out_size Size of the `out` buffer in bytes.
|
||||
*
|
||||
* @param message The message to be prettified.
|
||||
*
|
||||
* @param strip_comments Non-zero to remove lines starting with "#", 0 to
|
||||
* leave them in.
|
||||
*
|
||||
* @return -1 on error, else number of characters in prettified message
|
||||
* including the trailing NUL byte
|
||||
*/
|
||||
GIT_EXTERN(int) git_message_prettify(
|
||||
char *out,
|
||||
size_t out_size,
|
||||
const char *message,
|
||||
int strip_comments);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
|
||||
#endif /* INCLUDE_git_message_h__ */
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_net_h__
|
||||
#define INCLUDE_git_net_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "oid.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* @file git2/net.h
|
||||
* @brief Git networking declarations
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
#define GIT_DEFAULT_PORT "9418"
|
||||
|
||||
/*
|
||||
* We need this because we need to know whether we should call
|
||||
* git-upload-pack or git-receive-pack on the remote end when get_refs
|
||||
* gets called.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
GIT_DIRECTION_FETCH = 0,
|
||||
GIT_DIRECTION_PUSH = 1
|
||||
} git_direction;
|
||||
|
||||
|
||||
/**
|
||||
* Remote head description, given out on `ls` calls.
|
||||
*/
|
||||
struct git_remote_head {
|
||||
int local:1; /* available locally */
|
||||
git_oid oid;
|
||||
git_oid loid;
|
||||
char *name;
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback for listing the remote heads
|
||||
*/
|
||||
typedef int (*git_headlist_cb)(git_remote_head *rhead, void *payload);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,154 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_note_h__
|
||||
#define INCLUDE_git_note_h__
|
||||
|
||||
#include "oid.h"
|
||||
|
||||
/**
|
||||
* @file git2/notes.h
|
||||
* @brief Git notes management routines
|
||||
* @defgroup git_note Git notes management routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Callback for git_note_foreach.
|
||||
*
|
||||
* Receives:
|
||||
* - blob_id: Oid of the blob containing the message
|
||||
* - annotated_object_id: Oid of the git object being annotated
|
||||
* - payload: Payload data passed to `git_note_foreach`
|
||||
*/
|
||||
typedef int (*git_note_foreach_cb)(
|
||||
const git_oid *blob_id, const git_oid *annotated_object_id, void *payload);
|
||||
|
||||
/**
|
||||
* Read the note for an object
|
||||
*
|
||||
* The note must be freed manually by the user.
|
||||
*
|
||||
* @param out pointer to the read note; NULL in case of error
|
||||
* @param repo repository where to look up the note
|
||||
* @param notes_ref canonical name of the reference to use (optional); defaults to
|
||||
* "refs/notes/commits"
|
||||
* @param oid OID of the git object to read the note from
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_note_read(
|
||||
git_note **out,
|
||||
git_repository *repo,
|
||||
const char *notes_ref,
|
||||
const git_oid *oid);
|
||||
|
||||
/**
|
||||
* Get the note message
|
||||
*
|
||||
* @param note
|
||||
* @return the note message
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_note_message(const git_note *note);
|
||||
|
||||
|
||||
/**
|
||||
* Get the note object OID
|
||||
*
|
||||
* @param note
|
||||
* @return the note object OID
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_note_oid(const git_note *note);
|
||||
|
||||
/**
|
||||
* Add a note for an object
|
||||
*
|
||||
* @param out pointer to store the OID (optional); NULL in case of error
|
||||
* @param repo repository where to store the note
|
||||
* @param author signature of the notes commit author
|
||||
* @param committer signature of the notes commit committer
|
||||
* @param notes_ref canonical name of the reference to use (optional);
|
||||
* defaults to "refs/notes/commits"
|
||||
* @param oid OID of the git object to decorate
|
||||
* @param note Content of the note to add for object oid
|
||||
* @param force Overwrite existing note
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_note_create(
|
||||
git_oid *out,
|
||||
git_repository *repo,
|
||||
const git_signature *author,
|
||||
const git_signature *committer,
|
||||
const char *notes_ref,
|
||||
const git_oid *oid,
|
||||
const char *note,
|
||||
int force);
|
||||
|
||||
|
||||
/**
|
||||
* Remove the note for an object
|
||||
*
|
||||
* @param repo repository where the note lives
|
||||
* @param notes_ref canonical name of the reference to use (optional);
|
||||
* defaults to "refs/notes/commits"
|
||||
* @param author signature of the notes commit author
|
||||
* @param committer signature of the notes commit committer
|
||||
* @param oid OID of the git object to remove the note from
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_note_remove(
|
||||
git_repository *repo,
|
||||
const char *notes_ref,
|
||||
const git_signature *author,
|
||||
const git_signature *committer,
|
||||
const git_oid *oid);
|
||||
|
||||
/**
|
||||
* Free a git_note object
|
||||
*
|
||||
* @param note git_note object
|
||||
*/
|
||||
GIT_EXTERN(void) git_note_free(git_note *note);
|
||||
|
||||
/**
|
||||
* Get the default notes reference for a repository
|
||||
*
|
||||
* @param out Pointer to the default notes reference
|
||||
* @param repo The Git repository
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_note_default_ref(const char **out, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Loop over all the notes within a specified namespace
|
||||
* and issue a callback for each one.
|
||||
*
|
||||
* @param repo Repository where to find the notes.
|
||||
*
|
||||
* @param notes_ref Reference to read from (optional); defaults to
|
||||
* "refs/notes/commits".
|
||||
*
|
||||
* @param note_cb Callback to invoke per found annotation. Return non-zero
|
||||
* to stop looping.
|
||||
*
|
||||
* @param payload Extra parameter to callback function.
|
||||
*
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_note_foreach(
|
||||
git_repository *repo,
|
||||
const char *notes_ref,
|
||||
git_note_foreach_cb note_cb,
|
||||
void *payload);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,194 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_object_h__
|
||||
#define INCLUDE_git_object_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
|
||||
/**
|
||||
* @file git2/object.h
|
||||
* @brief Git revision object management routines
|
||||
* @defgroup git_object Git revision object management routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Lookup a reference to one of the objects in a repository.
|
||||
*
|
||||
* The generated reference is owned by the repository and
|
||||
* should be closed with the `git_object_free` method
|
||||
* instead of free'd manually.
|
||||
*
|
||||
* The 'type' parameter must match the type of the object
|
||||
* in the odb; the method will fail otherwise.
|
||||
* The special value 'GIT_OBJ_ANY' may be passed to let
|
||||
* the method guess the object's type.
|
||||
*
|
||||
* @param object pointer to the looked-up object
|
||||
* @param repo the repository to look up the object
|
||||
* @param id the unique identifier for the object
|
||||
* @param type the type of the object
|
||||
* @return a reference to the object
|
||||
*/
|
||||
GIT_EXTERN(int) git_object_lookup(
|
||||
git_object **object,
|
||||
git_repository *repo,
|
||||
const git_oid *id,
|
||||
git_otype type);
|
||||
|
||||
/**
|
||||
* Lookup a reference to one of the objects in a repository,
|
||||
* given a prefix of its identifier (short id).
|
||||
*
|
||||
* The object obtained will be so that its identifier
|
||||
* matches the first 'len' hexadecimal characters
|
||||
* (packets of 4 bits) of the given 'id'.
|
||||
* 'len' must be at least GIT_OID_MINPREFIXLEN, and
|
||||
* long enough to identify a unique object matching
|
||||
* the prefix; otherwise the method will fail.
|
||||
*
|
||||
* The generated reference is owned by the repository and
|
||||
* should be closed with the `git_object_free` method
|
||||
* instead of free'd manually.
|
||||
*
|
||||
* The 'type' parameter must match the type of the object
|
||||
* in the odb; the method will fail otherwise.
|
||||
* The special value 'GIT_OBJ_ANY' may be passed to let
|
||||
* the method guess the object's type.
|
||||
*
|
||||
* @param object_out pointer where to store the looked-up object
|
||||
* @param repo the repository to look up the object
|
||||
* @param id a short identifier for the object
|
||||
* @param len the length of the short identifier
|
||||
* @param type the type of the object
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_object_lookup_prefix(
|
||||
git_object **object_out,
|
||||
git_repository *repo,
|
||||
const git_oid *id,
|
||||
size_t len,
|
||||
git_otype type);
|
||||
|
||||
/**
|
||||
* Get the id (SHA1) of a repository object
|
||||
*
|
||||
* @param obj the repository object
|
||||
* @return the SHA1 id
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_object_id(const git_object *obj);
|
||||
|
||||
/**
|
||||
* Get the object type of an object
|
||||
*
|
||||
* @param obj the repository object
|
||||
* @return the object's type
|
||||
*/
|
||||
GIT_EXTERN(git_otype) git_object_type(const git_object *obj);
|
||||
|
||||
/**
|
||||
* Get the repository that owns this object
|
||||
*
|
||||
* Freeing or calling `git_repository_close` on the
|
||||
* returned pointer will invalidate the actual object.
|
||||
*
|
||||
* Any other operation may be run on the repository without
|
||||
* affecting the object.
|
||||
*
|
||||
* @param obj the object
|
||||
* @return the repository who owns this object
|
||||
*/
|
||||
GIT_EXTERN(git_repository *) git_object_owner(const git_object *obj);
|
||||
|
||||
/**
|
||||
* Close an open object
|
||||
*
|
||||
* This method instructs the library to close an existing
|
||||
* object; note that git_objects are owned and cached by the repository
|
||||
* so the object may or may not be freed after this library call,
|
||||
* depending on how aggressive is the caching mechanism used
|
||||
* by the repository.
|
||||
*
|
||||
* IMPORTANT:
|
||||
* It *is* necessary to call this method when you stop using
|
||||
* an object. Failure to do so will cause a memory leak.
|
||||
*
|
||||
* @param object the object to close
|
||||
*/
|
||||
GIT_EXTERN(void) git_object_free(git_object *object);
|
||||
|
||||
/**
|
||||
* Convert an object type to it's string representation.
|
||||
*
|
||||
* The result is a pointer to a string in static memory and
|
||||
* should not be free()'ed.
|
||||
*
|
||||
* @param type object type to convert.
|
||||
* @return the corresponding string representation.
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_object_type2string(git_otype type);
|
||||
|
||||
/**
|
||||
* Convert a string object type representation to it's git_otype.
|
||||
*
|
||||
* @param str the string to convert.
|
||||
* @return the corresponding git_otype.
|
||||
*/
|
||||
GIT_EXTERN(git_otype) git_object_string2type(const char *str);
|
||||
|
||||
/**
|
||||
* Determine if the given git_otype is a valid loose object type.
|
||||
*
|
||||
* @param type object type to test.
|
||||
* @return true if the type represents a valid loose object type,
|
||||
* false otherwise.
|
||||
*/
|
||||
GIT_EXTERN(int) git_object_typeisloose(git_otype type);
|
||||
|
||||
/**
|
||||
* Get the size in bytes for the structure which
|
||||
* acts as an in-memory representation of any given
|
||||
* object type.
|
||||
*
|
||||
* For all the core types, this would the equivalent
|
||||
* of calling `sizeof(git_commit)` if the core types
|
||||
* were not opaque on the external API.
|
||||
*
|
||||
* @param type object type to get its size
|
||||
* @return size in bytes of the object
|
||||
*/
|
||||
GIT_EXTERN(size_t) git_object__size(git_otype type);
|
||||
|
||||
/**
|
||||
* Recursively peel an object until an object of the specified type is met.
|
||||
*
|
||||
* The retrieved `peeled` object is owned by the repository and should be
|
||||
* closed with the `git_object_free` method.
|
||||
*
|
||||
* If you pass `GIT_OBJ_ANY` as the target type, then the object will be
|
||||
* peeled until the type changes (e.g. a tag will be chased until the
|
||||
* referenced object is no longer a tag).
|
||||
*
|
||||
* @param peeled Pointer to the peeled git_object
|
||||
* @param object The object to be processed
|
||||
* @param target_type The type of the requested object (GIT_OBJ_COMMIT,
|
||||
* GIT_OBJ_TAG, GIT_OBJ_TREE, GIT_OBJ_BLOB or GIT_OBJ_ANY).
|
||||
* @return 0 on success, GIT_EAMBIGUOUS, GIT_ENOTFOUND or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_object_peel(
|
||||
git_object **peeled,
|
||||
const git_object *object,
|
||||
git_otype target_type);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
|
||||
#endif
|
||||
@@ -1,391 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_odb_h__
|
||||
#define INCLUDE_git_odb_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
#include "odb_backend.h"
|
||||
#include "indexer.h"
|
||||
|
||||
/**
|
||||
* @file git2/odb.h
|
||||
* @brief Git object database routines
|
||||
* @defgroup git_odb Git object database routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Create a new object database with no backends.
|
||||
*
|
||||
* Before the ODB can be used for read/writing, a custom database
|
||||
* backend must be manually added using `git_odb_add_backend()`
|
||||
*
|
||||
* @param out location to store the database pointer, if opened.
|
||||
* Set to NULL if the open failed.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_new(git_odb **out);
|
||||
|
||||
/**
|
||||
* Create a new object database and automatically add
|
||||
* the two default backends:
|
||||
*
|
||||
* - git_odb_backend_loose: read and write loose object files
|
||||
* from disk, assuming `objects_dir` as the Objects folder
|
||||
*
|
||||
* - git_odb_backend_pack: read objects from packfiles,
|
||||
* assuming `objects_dir` as the Objects folder which
|
||||
* contains a 'pack/' folder with the corresponding data
|
||||
*
|
||||
* @param out location to store the database pointer, if opened.
|
||||
* Set to NULL if the open failed.
|
||||
* @param objects_dir path of the backends' "objects" directory.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_open(git_odb **out, const char *objects_dir);
|
||||
|
||||
/**
|
||||
* Add a custom backend to an existing Object DB
|
||||
*
|
||||
* The backends are checked in relative ordering, based on the
|
||||
* value of the `priority` parameter.
|
||||
*
|
||||
* Read <odb_backends.h> for more information.
|
||||
*
|
||||
* @param odb database to add the backend to
|
||||
* @param backend pointer to a git_odb_backend instance
|
||||
* @param priority Value for ordering the backends queue
|
||||
* @return 0 on success; error code otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_add_backend(git_odb *odb, git_odb_backend *backend, int priority);
|
||||
|
||||
/**
|
||||
* Add a custom backend to an existing Object DB; this
|
||||
* backend will work as an alternate.
|
||||
*
|
||||
* Alternate backends are always checked for objects *after*
|
||||
* all the main backends have been exhausted.
|
||||
*
|
||||
* The backends are checked in relative ordering, based on the
|
||||
* value of the `priority` parameter.
|
||||
*
|
||||
* Writing is disabled on alternate backends.
|
||||
*
|
||||
* Read <odb_backends.h> for more information.
|
||||
*
|
||||
* @param odb database to add the backend to
|
||||
* @param backend pointer to a git_odb_backend instance
|
||||
* @param priority Value for ordering the backends queue
|
||||
* @return 0 on success; error code otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_add_alternate(git_odb *odb, git_odb_backend *backend, int priority);
|
||||
|
||||
/**
|
||||
* Add an on-disk alternate to an existing Object DB.
|
||||
*
|
||||
* Note that the added path must point to an `objects`, not
|
||||
* to a full repository, to use it as an alternate store.
|
||||
*
|
||||
* Alternate backends are always checked for objects *after*
|
||||
* all the main backends have been exhausted.
|
||||
*
|
||||
* Writing is disabled on alternate backends.
|
||||
*
|
||||
* @param odb database to add the backend to
|
||||
* @param path path to the objects folder for the alternate
|
||||
* @return 0 on success; error code otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_add_disk_alternate(git_odb *odb, const char *path);
|
||||
|
||||
/**
|
||||
* Close an open object database.
|
||||
*
|
||||
* @param db database pointer to close. If NULL no action is taken.
|
||||
*/
|
||||
GIT_EXTERN(void) git_odb_free(git_odb *db);
|
||||
|
||||
/**
|
||||
* Read an object from the database.
|
||||
*
|
||||
* This method queries all available ODB backends
|
||||
* trying to read the given OID.
|
||||
*
|
||||
* The returned object is reference counted and
|
||||
* internally cached, so it should be closed
|
||||
* by the user once it's no longer in use.
|
||||
*
|
||||
* @param out pointer where to store the read object
|
||||
* @param db database to search for the object in.
|
||||
* @param id identity of the object to read.
|
||||
* @return
|
||||
* - 0 if the object was read;
|
||||
* - GIT_ENOTFOUND if the object is not in the database.
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_read(git_odb_object **out, git_odb *db, const git_oid *id);
|
||||
|
||||
/**
|
||||
* Read an object from the database, given a prefix
|
||||
* of its identifier.
|
||||
*
|
||||
* This method queries all available ODB backends
|
||||
* trying to match the 'len' first hexadecimal
|
||||
* characters of the 'short_id'.
|
||||
* The remaining (GIT_OID_HEXSZ-len)*4 bits of
|
||||
* 'short_id' must be 0s.
|
||||
* 'len' must be at least GIT_OID_MINPREFIXLEN,
|
||||
* and the prefix must be long enough to identify
|
||||
* a unique object in all the backends; the
|
||||
* method will fail otherwise.
|
||||
*
|
||||
* The returned object is reference counted and
|
||||
* internally cached, so it should be closed
|
||||
* by the user once it's no longer in use.
|
||||
*
|
||||
* @param out pointer where to store the read object
|
||||
* @param db database to search for the object in.
|
||||
* @param short_id a prefix of the id of the object to read.
|
||||
* @param len the length of the prefix
|
||||
* @return
|
||||
* - 0 if the object was read;
|
||||
* - GIT_ENOTFOUND if the object is not in the database.
|
||||
* - GIT_EAMBIGUOUS if the prefix is ambiguous (several objects match the prefix)
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_read_prefix(git_odb_object **out, git_odb *db, const git_oid *short_id, size_t len);
|
||||
|
||||
/**
|
||||
* Read the header of an object from the database, without
|
||||
* reading its full contents.
|
||||
*
|
||||
* The header includes the length and the type of an object.
|
||||
*
|
||||
* Note that most backends do not support reading only the header
|
||||
* of an object, so the whole object will be read and then the
|
||||
* header will be returned.
|
||||
*
|
||||
* @param len_out pointer where to store the length
|
||||
* @param type_out pointer where to store the type
|
||||
* @param db database to search for the object in.
|
||||
* @param id identity of the object to read.
|
||||
* @return
|
||||
* - 0 if the object was read;
|
||||
* - GIT_ENOTFOUND if the object is not in the database.
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_read_header(size_t *len_out, git_otype *type_out, git_odb *db, const git_oid *id);
|
||||
|
||||
/**
|
||||
* Determine if the given object can be found in the object database.
|
||||
*
|
||||
* @param db database to be searched for the given object.
|
||||
* @param id the object to search for.
|
||||
* @return
|
||||
* - 1, if the object was found
|
||||
* - 0, otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_exists(git_odb *db, const git_oid *id);
|
||||
|
||||
/**
|
||||
* List all objects available in the database
|
||||
*
|
||||
* The callback will be called for each object available in the
|
||||
* database. Note that the objects are likely to be returned in the index
|
||||
* order, which would make accessing the objects in that order inefficient.
|
||||
* Return a non-zero value from the callback to stop looping.
|
||||
*
|
||||
* @param db database to use
|
||||
* @param cb the callback to call for each object
|
||||
* @param payload data to pass to the callback
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_foreach(git_odb *db, git_odb_foreach_cb cb, void *payload);
|
||||
|
||||
/**
|
||||
* Write an object directly into the ODB
|
||||
*
|
||||
* This method writes a full object straight into the ODB.
|
||||
* For most cases, it is preferred to write objects through a write
|
||||
* stream, which is both faster and less memory intensive, specially
|
||||
* for big objects.
|
||||
*
|
||||
* This method is provided for compatibility with custom backends
|
||||
* which are not able to support streaming writes
|
||||
*
|
||||
* @param out pointer to store the OID result of the write
|
||||
* @param odb object database where to store the object
|
||||
* @param data buffer with the data to store
|
||||
* @param len size of the buffer
|
||||
* @param type type of the data to store
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_write(git_oid *out, git_odb *odb, const void *data, size_t len, git_otype type);
|
||||
|
||||
/**
|
||||
* Open a stream to write an object into the ODB
|
||||
*
|
||||
* The type and final length of the object must be specified
|
||||
* when opening the stream.
|
||||
*
|
||||
* The returned stream will be of type `GIT_STREAM_WRONLY` and
|
||||
* will have the following methods:
|
||||
*
|
||||
* - stream->write: write `n` bytes into the stream
|
||||
* - stream->finalize_write: close the stream and store the object in
|
||||
* the odb
|
||||
* - stream->free: free the stream
|
||||
*
|
||||
* The streaming write won't be effective until `stream->finalize_write`
|
||||
* is called and returns without an error
|
||||
*
|
||||
* The stream must always be free'd or will leak memory.
|
||||
*
|
||||
* @see git_odb_stream
|
||||
*
|
||||
* @param out pointer where to store the stream
|
||||
* @param db object database where the stream will write
|
||||
* @param size final size of the object that will be written
|
||||
* @param type type of the object that will be written
|
||||
* @return 0 if the stream was created; error code otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_open_wstream(git_odb_stream **out, git_odb *db, size_t size, git_otype type);
|
||||
|
||||
/**
|
||||
* Open a stream to read an object from the ODB
|
||||
*
|
||||
* Note that most backends do *not* support streaming reads
|
||||
* because they store their objects as compressed/delta'ed blobs.
|
||||
*
|
||||
* It's recommended to use `git_odb_read` instead, which is
|
||||
* assured to work on all backends.
|
||||
*
|
||||
* The returned stream will be of type `GIT_STREAM_RDONLY` and
|
||||
* will have the following methods:
|
||||
*
|
||||
* - stream->read: read `n` bytes from the stream
|
||||
* - stream->free: free the stream
|
||||
*
|
||||
* The stream must always be free'd or will leak memory.
|
||||
*
|
||||
* @see git_odb_stream
|
||||
*
|
||||
* @param out pointer where to store the stream
|
||||
* @param db object database where the stream will read from
|
||||
* @param oid oid of the object the stream will read from
|
||||
* @return 0 if the stream was created; error code otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_open_rstream(git_odb_stream **out, git_odb *db, const git_oid *oid);
|
||||
|
||||
/**
|
||||
* Open a stream for writing a pack file to the ODB.
|
||||
*
|
||||
* If the ODB layer understands pack files, then the given
|
||||
* packfile will likely be streamed directly to disk (and a
|
||||
* corresponding index created). If the ODB layer does not
|
||||
* understand pack files, the objects will be stored in whatever
|
||||
* format the ODB layer uses.
|
||||
*
|
||||
* @see git_odb_writepack
|
||||
*
|
||||
* @param out pointer to the writepack functions
|
||||
* @param db object database where the stream will read from
|
||||
* @param progress_cb function to call with progress information.
|
||||
* Be aware that this is called inline with network and indexing operations,
|
||||
* so performance may be affected.
|
||||
* @param progress_payload payload for the progress callback
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_write_pack(
|
||||
git_odb_writepack **out,
|
||||
git_odb *db,
|
||||
git_transfer_progress_callback progress_cb,
|
||||
void *progress_payload);
|
||||
|
||||
/**
|
||||
* Determine the object-ID (sha1 hash) of a data buffer
|
||||
*
|
||||
* The resulting SHA-1 OID will be the identifier for the data
|
||||
* buffer as if the data buffer it were to written to the ODB.
|
||||
*
|
||||
* @param out the resulting object-ID.
|
||||
* @param data data to hash
|
||||
* @param len size of the data
|
||||
* @param type of the data to hash
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_hash(git_oid *out, const void *data, size_t len, git_otype type);
|
||||
|
||||
/**
|
||||
* Read a file from disk and fill a git_oid with the object id
|
||||
* that the file would have if it were written to the Object
|
||||
* Database as an object of the given type (w/o applying filters).
|
||||
* Similar functionality to git.git's `git hash-object` without
|
||||
* the `-w` flag, however, with the --no-filters flag.
|
||||
* If you need filters, see git_repository_hashfile.
|
||||
*
|
||||
* @param out oid structure the result is written into.
|
||||
* @param path file to read and determine object id for
|
||||
* @param type the type of the object that will be hashed
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_hashfile(git_oid *out, const char *path, git_otype type);
|
||||
|
||||
/**
|
||||
* Close an ODB object
|
||||
*
|
||||
* This method must always be called once a `git_odb_object` is no
|
||||
* longer needed, otherwise memory will leak.
|
||||
*
|
||||
* @param object object to close
|
||||
*/
|
||||
GIT_EXTERN(void) git_odb_object_free(git_odb_object *object);
|
||||
|
||||
/**
|
||||
* Return the OID of an ODB object
|
||||
*
|
||||
* This is the OID from which the object was read from
|
||||
*
|
||||
* @param object the object
|
||||
* @return a pointer to the OID
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_odb_object_id(git_odb_object *object);
|
||||
|
||||
/**
|
||||
* Return the data of an ODB object
|
||||
*
|
||||
* This is the uncompressed, raw data as read from the ODB,
|
||||
* without the leading header.
|
||||
*
|
||||
* This pointer is owned by the object and shall not be free'd.
|
||||
*
|
||||
* @param object the object
|
||||
* @return a pointer to the data
|
||||
*/
|
||||
GIT_EXTERN(const void *) git_odb_object_data(git_odb_object *object);
|
||||
|
||||
/**
|
||||
* Return the size of an ODB object
|
||||
*
|
||||
* This is the real size of the `data` buffer, not the
|
||||
* actual size of the object.
|
||||
*
|
||||
* @param object the object
|
||||
* @return the size
|
||||
*/
|
||||
GIT_EXTERN(size_t) git_odb_object_size(git_odb_object *object);
|
||||
|
||||
/**
|
||||
* Return the type of an ODB object
|
||||
*
|
||||
* @param object the object
|
||||
* @return the type
|
||||
*/
|
||||
GIT_EXTERN(git_otype) git_odb_object_type(git_odb_object *object);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_odb_backend_h__
|
||||
#define INCLUDE_git_odb_backend_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
#include "indexer.h"
|
||||
|
||||
/**
|
||||
* @file git2/backend.h
|
||||
* @brief Git custom backend functions
|
||||
* @defgroup git_backend Git custom backend API
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
struct git_odb_stream;
|
||||
struct git_odb_writepack;
|
||||
|
||||
/**
|
||||
* Function type for callbacks from git_odb_foreach.
|
||||
*/
|
||||
typedef int (*git_odb_foreach_cb)(const git_oid *id, void *payload);
|
||||
|
||||
/**
|
||||
* An instance for a custom backend
|
||||
*/
|
||||
struct git_odb_backend {
|
||||
unsigned int version;
|
||||
git_odb *odb;
|
||||
|
||||
/* read and read_prefix each return to libgit2 a buffer which
|
||||
* will be freed later. The buffer should be allocated using
|
||||
* the function git_odb_backend_malloc to ensure that it can
|
||||
* be safely freed later. */
|
||||
int (* read)(
|
||||
void **, size_t *, git_otype *,
|
||||
struct git_odb_backend *,
|
||||
const git_oid *);
|
||||
|
||||
/* To find a unique object given a prefix
|
||||
* of its oid.
|
||||
* The oid given must be so that the
|
||||
* remaining (GIT_OID_HEXSZ - len)*4 bits
|
||||
* are 0s.
|
||||
*/
|
||||
int (* read_prefix)(
|
||||
git_oid *,
|
||||
void **, size_t *, git_otype *,
|
||||
struct git_odb_backend *,
|
||||
const git_oid *,
|
||||
size_t);
|
||||
|
||||
int (* read_header)(
|
||||
size_t *, git_otype *,
|
||||
struct git_odb_backend *,
|
||||
const git_oid *);
|
||||
|
||||
/* The writer may assume that the object
|
||||
* has already been hashed and is passed
|
||||
* in the first parameter.
|
||||
*/
|
||||
int (* write)(
|
||||
git_oid *,
|
||||
struct git_odb_backend *,
|
||||
const void *,
|
||||
size_t,
|
||||
git_otype);
|
||||
|
||||
int (* writestream)(
|
||||
struct git_odb_stream **,
|
||||
struct git_odb_backend *,
|
||||
size_t,
|
||||
git_otype);
|
||||
|
||||
int (* readstream)(
|
||||
struct git_odb_stream **,
|
||||
struct git_odb_backend *,
|
||||
const git_oid *);
|
||||
|
||||
int (* exists)(
|
||||
struct git_odb_backend *,
|
||||
const git_oid *);
|
||||
|
||||
int (* foreach)(
|
||||
struct git_odb_backend *,
|
||||
git_odb_foreach_cb cb,
|
||||
void *payload);
|
||||
|
||||
int (* writepack)(
|
||||
struct git_odb_writepack **,
|
||||
struct git_odb_backend *,
|
||||
git_transfer_progress_callback progress_cb,
|
||||
void *progress_payload);
|
||||
|
||||
void (* free)(struct git_odb_backend *);
|
||||
};
|
||||
|
||||
#define GIT_ODB_BACKEND_VERSION 1
|
||||
#define GIT_ODB_BACKEND_INIT {GIT_ODB_BACKEND_VERSION}
|
||||
|
||||
/** Streaming mode */
|
||||
enum {
|
||||
GIT_STREAM_RDONLY = (1 << 1),
|
||||
GIT_STREAM_WRONLY = (1 << 2),
|
||||
GIT_STREAM_RW = (GIT_STREAM_RDONLY | GIT_STREAM_WRONLY),
|
||||
};
|
||||
|
||||
/** A stream to read/write from a backend */
|
||||
struct git_odb_stream {
|
||||
struct git_odb_backend *backend;
|
||||
unsigned int mode;
|
||||
|
||||
int (*read)(struct git_odb_stream *stream, char *buffer, size_t len);
|
||||
int (*write)(struct git_odb_stream *stream, const char *buffer, size_t len);
|
||||
int (*finalize_write)(git_oid *oid_p, struct git_odb_stream *stream);
|
||||
void (*free)(struct git_odb_stream *stream);
|
||||
};
|
||||
|
||||
/** A stream to write a pack file to the ODB */
|
||||
struct git_odb_writepack {
|
||||
struct git_odb_backend *backend;
|
||||
|
||||
int (*add)(struct git_odb_writepack *writepack, const void *data, size_t size, git_transfer_progress *stats);
|
||||
int (*commit)(struct git_odb_writepack *writepack, git_transfer_progress *stats);
|
||||
void (*free)(struct git_odb_writepack *writepack);
|
||||
};
|
||||
|
||||
GIT_EXTERN(void *) git_odb_backend_malloc(git_odb_backend *backend, size_t len);
|
||||
|
||||
/**
|
||||
* Constructors for in-box ODB backends.
|
||||
*/
|
||||
GIT_EXTERN(int) git_odb_backend_pack(git_odb_backend **out, const char *objects_dir);
|
||||
GIT_EXTERN(int) git_odb_backend_loose(git_odb_backend **out, const char *objects_dir, int compression_level, int do_fsync);
|
||||
GIT_EXTERN(int) git_odb_backend_one_pack(git_odb_backend **out, const char *index_file);
|
||||
|
||||
GIT_END_DECL
|
||||
|
||||
#endif
|
||||
@@ -1,248 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_oid_h__
|
||||
#define INCLUDE_git_oid_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* @file git2/oid.h
|
||||
* @brief Git object id routines
|
||||
* @defgroup git_oid Git object id routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/** Size (in bytes) of a raw/binary oid */
|
||||
#define GIT_OID_RAWSZ 20
|
||||
|
||||
/** Size (in bytes) of a hex formatted oid */
|
||||
#define GIT_OID_HEXSZ (GIT_OID_RAWSZ * 2)
|
||||
|
||||
/** Minimum length (in number of hex characters,
|
||||
* i.e. packets of 4 bits) of an oid prefix */
|
||||
#define GIT_OID_MINPREFIXLEN 4
|
||||
|
||||
/** Unique identity of any object (commit, tree, blob, tag). */
|
||||
typedef struct git_oid {
|
||||
/** raw binary formatted id */
|
||||
unsigned char id[GIT_OID_RAWSZ];
|
||||
} git_oid;
|
||||
|
||||
/**
|
||||
* Parse a hex formatted object id into a git_oid.
|
||||
*
|
||||
* @param out oid structure the result is written into.
|
||||
* @param str input hex string; must be pointing at the start of
|
||||
* the hex sequence and have at least the number of bytes
|
||||
* needed for an oid encoded in hex (40 bytes).
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_oid_fromstr(git_oid *out, const char *str);
|
||||
|
||||
/**
|
||||
* Parse N characters of a hex formatted object id into a git_oid
|
||||
*
|
||||
* If N is odd, N-1 characters will be parsed instead.
|
||||
* The remaining space in the git_oid will be set to zero.
|
||||
*
|
||||
* @param out oid structure the result is written into.
|
||||
* @param str input hex string of at least size `length`
|
||||
* @param length length of the input string
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_oid_fromstrn(git_oid *out, const char *str, size_t length);
|
||||
|
||||
/**
|
||||
* Copy an already raw oid into a git_oid structure.
|
||||
*
|
||||
* @param out oid structure the result is written into.
|
||||
* @param raw the raw input bytes to be copied.
|
||||
*/
|
||||
GIT_EXTERN(void) git_oid_fromraw(git_oid *out, const unsigned char *raw);
|
||||
|
||||
/**
|
||||
* Format a git_oid into a hex string.
|
||||
*
|
||||
* @param out output hex string; must be pointing at the start of
|
||||
* the hex sequence and have at least the number of bytes
|
||||
* needed for an oid encoded in hex (40 bytes). Only the
|
||||
* oid digits are written; a '\\0' terminator must be added
|
||||
* by the caller if it is required.
|
||||
* @param oid oid structure to format.
|
||||
*/
|
||||
GIT_EXTERN(void) git_oid_fmt(char *out, const git_oid *id);
|
||||
|
||||
/**
|
||||
* Format a git_oid into a loose-object path string.
|
||||
*
|
||||
* The resulting string is "aa/...", where "aa" is the first two
|
||||
* hex digits of the oid and "..." is the remaining 38 digits.
|
||||
*
|
||||
* @param out output hex string; must be pointing at the start of
|
||||
* the hex sequence and have at least the number of bytes
|
||||
* needed for an oid encoded in hex (41 bytes). Only the
|
||||
* oid digits are written; a '\\0' terminator must be added
|
||||
* by the caller if it is required.
|
||||
* @param id oid structure to format.
|
||||
*/
|
||||
GIT_EXTERN(void) git_oid_pathfmt(char *out, const git_oid *id);
|
||||
|
||||
/**
|
||||
* Format a git_oid into a newly allocated c-string.
|
||||
*
|
||||
* @param oid the oid structure to format
|
||||
* @return the c-string; NULL if memory is exhausted. Caller must
|
||||
* deallocate the string with git__free().
|
||||
*/
|
||||
GIT_EXTERN(char *) git_oid_allocfmt(const git_oid *id);
|
||||
|
||||
/**
|
||||
* Format a git_oid into a buffer as a hex format c-string.
|
||||
*
|
||||
* If the buffer is smaller than GIT_OID_HEXSZ+1, then the resulting
|
||||
* oid c-string will be truncated to n-1 characters. If there are
|
||||
* any input parameter errors (out == NULL, n == 0, oid == NULL),
|
||||
* then a pointer to an empty string is returned, so that the return
|
||||
* value can always be printed.
|
||||
*
|
||||
* @param out the buffer into which the oid string is output.
|
||||
* @param n the size of the out buffer.
|
||||
* @param id the oid structure to format.
|
||||
* @return the out buffer pointer, assuming no input parameter
|
||||
* errors, otherwise a pointer to an empty string.
|
||||
*/
|
||||
GIT_EXTERN(char *) git_oid_tostr(char *out, size_t n, const git_oid *id);
|
||||
|
||||
/**
|
||||
* Copy an oid from one structure to another.
|
||||
*
|
||||
* @param out oid structure the result is written into.
|
||||
* @param src oid structure to copy from.
|
||||
*/
|
||||
GIT_EXTERN(void) git_oid_cpy(git_oid *out, const git_oid *src);
|
||||
|
||||
/**
|
||||
* Compare two oid structures.
|
||||
*
|
||||
* @param a first oid structure.
|
||||
* @param b second oid structure.
|
||||
* @return <0, 0, >0 if a < b, a == b, a > b.
|
||||
*/
|
||||
GIT_INLINE(int) git_oid_cmp(const git_oid *a, const git_oid *b)
|
||||
{
|
||||
const unsigned char *sha1 = a->id;
|
||||
const unsigned char *sha2 = b->id;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < GIT_OID_RAWSZ; i++, sha1++, sha2++) {
|
||||
if (*sha1 != *sha2)
|
||||
return *sha1 - *sha2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two oid structures for equality
|
||||
*
|
||||
* @param a first oid structure.
|
||||
* @param b second oid structure.
|
||||
* @return true if equal, false otherwise
|
||||
*/
|
||||
GIT_INLINE(int) git_oid_equal(const git_oid *a, const git_oid *b)
|
||||
{
|
||||
return !git_oid_cmp(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the first 'len' hexadecimal characters (packets of 4 bits)
|
||||
* of two oid structures.
|
||||
*
|
||||
* @param a first oid structure.
|
||||
* @param b second oid structure.
|
||||
* @param len the number of hex chars to compare
|
||||
* @return 0 in case of a match
|
||||
*/
|
||||
GIT_EXTERN(int) git_oid_ncmp(const git_oid *a, const git_oid *b, size_t len);
|
||||
|
||||
/**
|
||||
* Check if an oid equals an hex formatted object id.
|
||||
*
|
||||
* @param id oid structure.
|
||||
* @param str input hex string of an object id.
|
||||
* @return GIT_ENOTOID if str is not a valid hex string,
|
||||
* 0 in case of a match, GIT_ERROR otherwise.
|
||||
*/
|
||||
GIT_EXTERN(int) git_oid_streq(const git_oid *id, const char *str);
|
||||
|
||||
/**
|
||||
* Check is an oid is all zeros.
|
||||
*
|
||||
* @return 1 if all zeros, 0 otherwise.
|
||||
*/
|
||||
GIT_EXTERN(int) git_oid_iszero(const git_oid *id);
|
||||
|
||||
/**
|
||||
* OID Shortener object
|
||||
*/
|
||||
typedef struct git_oid_shorten git_oid_shorten;
|
||||
|
||||
/**
|
||||
* Create a new OID shortener.
|
||||
*
|
||||
* The OID shortener is used to process a list of OIDs
|
||||
* in text form and return the shortest length that would
|
||||
* uniquely identify all of them.
|
||||
*
|
||||
* E.g. look at the result of `git log --abbrev`.
|
||||
*
|
||||
* @param min_length The minimal length for all identifiers,
|
||||
* which will be used even if shorter OIDs would still
|
||||
* be unique.
|
||||
* @return a `git_oid_shorten` instance, NULL if OOM
|
||||
*/
|
||||
GIT_EXTERN(git_oid_shorten *) git_oid_shorten_new(size_t min_length);
|
||||
|
||||
/**
|
||||
* Add a new OID to set of shortened OIDs and calculate
|
||||
* the minimal length to uniquely identify all the OIDs in
|
||||
* the set.
|
||||
*
|
||||
* The OID is expected to be a 40-char hexadecimal string.
|
||||
* The OID is owned by the user and will not be modified
|
||||
* or freed.
|
||||
*
|
||||
* For performance reasons, there is a hard-limit of how many
|
||||
* OIDs can be added to a single set (around ~22000, assuming
|
||||
* a mostly randomized distribution), which should be enough
|
||||
* for any kind of program, and keeps the algorithm fast and
|
||||
* memory-efficient.
|
||||
*
|
||||
* Attempting to add more than those OIDs will result in a
|
||||
* GIT_ENOMEM error
|
||||
*
|
||||
* @param os a `git_oid_shorten` instance
|
||||
* @param text_id an OID in text form
|
||||
* @return the minimal length to uniquely identify all OIDs
|
||||
* added so far to the set; or an error code (<0) if an
|
||||
* error occurs.
|
||||
*/
|
||||
GIT_EXTERN(int) git_oid_shorten_add(git_oid_shorten *os, const char *text_id);
|
||||
|
||||
/**
|
||||
* Free an OID shortener instance
|
||||
*
|
||||
* @param os a `git_oid_shorten` instance
|
||||
*/
|
||||
GIT_EXTERN(void) git_oid_shorten_free(git_oid_shorten *os);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,117 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_pack_h__
|
||||
#define INCLUDE_git_pack_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "oid.h"
|
||||
|
||||
/**
|
||||
* @file git2/pack.h
|
||||
* @brief Git pack management routines
|
||||
* @defgroup git_pack Git pack management routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Initialize a new packbuilder
|
||||
*
|
||||
* @param out The new packbuilder object
|
||||
* @param repo The repository
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_packbuilder_new(git_packbuilder **out, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Set number of threads to spawn
|
||||
*
|
||||
* By default, libgit2 won't spawn any threads at all;
|
||||
* when set to 0, libgit2 will autodetect the number of
|
||||
* CPUs.
|
||||
*
|
||||
* @param pb The packbuilder
|
||||
* @param n Number of threads to spawn
|
||||
* @return number of actual threads to be used
|
||||
*/
|
||||
GIT_EXTERN(unsigned int) git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n);
|
||||
|
||||
/**
|
||||
* Insert a single object
|
||||
*
|
||||
* For an optimal pack it's mandatory to insert objects in recency order,
|
||||
* commits followed by trees and blobs.
|
||||
*
|
||||
* @param pb The packbuilder
|
||||
* @param id The oid of the commit
|
||||
* @param name The name; might be NULL
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_packbuilder_insert(git_packbuilder *pb, const git_oid *id, const char *name);
|
||||
|
||||
/**
|
||||
* Insert a root tree object
|
||||
*
|
||||
* This will add the tree as well as all referenced trees and blobs.
|
||||
*
|
||||
* @param pb The packbuilder
|
||||
* @param id The oid of the root tree
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *id);
|
||||
|
||||
/**
|
||||
* Write the new pack and the corresponding index to path
|
||||
*
|
||||
* @param pb The packbuilder
|
||||
* @param path Directory to store the new pack and index
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_packbuilder_write(git_packbuilder *pb, const char *file);
|
||||
|
||||
/**
|
||||
* Create the new pack and pass each object to the callback
|
||||
*
|
||||
* @param pb the packbuilder
|
||||
* @param cb the callback to call with each packed object's buffer
|
||||
* @param payload the callback's data
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
typedef int (*git_packbuilder_foreach_cb)(void *buf, size_t size, void *payload);
|
||||
GIT_EXTERN(int) git_packbuilder_foreach(git_packbuilder *pb, git_packbuilder_foreach_cb cb, void *payload);
|
||||
|
||||
/**
|
||||
* Get the total number of objects the packbuilder will write out
|
||||
*
|
||||
* @param pb the packbuilder
|
||||
* @return
|
||||
*/
|
||||
GIT_EXTERN(uint32_t) git_packbuilder_object_count(git_packbuilder *pb);
|
||||
|
||||
/**
|
||||
* Get the number of objects the packbuilder has already written out
|
||||
*
|
||||
* @param pb the packbuilder
|
||||
* @return
|
||||
*/
|
||||
GIT_EXTERN(uint32_t) git_packbuilder_written(git_packbuilder *pb);
|
||||
|
||||
/**
|
||||
* Free the packbuilder and all associated data
|
||||
*
|
||||
* @param pb The packbuilder
|
||||
*/
|
||||
GIT_EXTERN(void) git_packbuilder_free(git_packbuilder *pb);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_push_h__
|
||||
#define INCLUDE_git_push_h__
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* @file git2/push.h
|
||||
* @brief Git push management functions
|
||||
* @defgroup git_push push management functions
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Create a new push object
|
||||
*
|
||||
* @param out New push object
|
||||
* @param remote Remote instance
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_push_new(git_push **out, git_remote *remote);
|
||||
|
||||
/**
|
||||
* Add a refspec to be pushed
|
||||
*
|
||||
* @param push The push object
|
||||
* @param refspec Refspec string
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_push_add_refspec(git_push *push, const char *refspec);
|
||||
|
||||
/**
|
||||
* Actually push all given refspecs
|
||||
*
|
||||
* @param push The push object
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_push_finish(git_push *push);
|
||||
|
||||
/**
|
||||
* Check if remote side successfully unpacked
|
||||
*
|
||||
* @param push The push object
|
||||
*
|
||||
* @return true if equal, false otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_push_unpack_ok(git_push *push);
|
||||
|
||||
/**
|
||||
* Call callback `cb' on each status
|
||||
*
|
||||
* @param push The push object
|
||||
* @param cb The callback to call on each object
|
||||
*
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_push_status_foreach(git_push *push,
|
||||
int (*cb)(const char *ref, const char *msg, void *data),
|
||||
void *data);
|
||||
|
||||
/**
|
||||
* Free the given push object
|
||||
*
|
||||
* @param push The push object
|
||||
*/
|
||||
GIT_EXTERN(void) git_push_free(git_push *push);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,167 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_reflog_h__
|
||||
#define INCLUDE_git_reflog_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
|
||||
/**
|
||||
* @file git2/reflog.h
|
||||
* @brief Git reflog management routines
|
||||
* @defgroup git_reflog Git reflog management routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Read the reflog for the given reference
|
||||
*
|
||||
* If there is no reflog file for the given
|
||||
* reference yet, an empty reflog object will
|
||||
* be returned.
|
||||
*
|
||||
* The reflog must be freed manually by using
|
||||
* git_reflog_free().
|
||||
*
|
||||
* @param out pointer to reflog
|
||||
* @param ref reference to read the reflog for
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reflog_read(git_reflog **out, const git_reference *ref);
|
||||
|
||||
/**
|
||||
* Write an existing in-memory reflog object back to disk
|
||||
* using an atomic file lock.
|
||||
*
|
||||
* @param reflog an existing reflog object
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reflog_write(git_reflog *reflog);
|
||||
|
||||
/**
|
||||
* Add a new entry to the reflog.
|
||||
*
|
||||
* `msg` is optional and can be NULL.
|
||||
*
|
||||
* @param reflog an existing reflog object
|
||||
* @param id the OID the reference is now pointing to
|
||||
* @param committer the signature of the committer
|
||||
* @param msg the reflog message
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reflog_append(git_reflog *reflog, const git_oid *id, const git_signature *committer, const char *msg);
|
||||
|
||||
/**
|
||||
* Rename the reflog for the given reference
|
||||
*
|
||||
* The reflog to be renamed is expected to already exist
|
||||
*
|
||||
* The new name will be checked for validity.
|
||||
* See `git_reference_create_symbolic()` for rules about valid names.
|
||||
*
|
||||
* @param ref the reference
|
||||
* @param name the new name of the reference
|
||||
* @return 0 on success, GIT_EINVALIDSPEC or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reflog_rename(git_reference *ref, const char *name);
|
||||
|
||||
/**
|
||||
* Delete the reflog for the given reference
|
||||
*
|
||||
* @param ref the reference
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reflog_delete(git_reference *ref);
|
||||
|
||||
/**
|
||||
* Get the number of log entries in a reflog
|
||||
*
|
||||
* @param reflog the previously loaded reflog
|
||||
* @return the number of log entries
|
||||
*/
|
||||
GIT_EXTERN(size_t) git_reflog_entrycount(git_reflog *reflog);
|
||||
|
||||
/**
|
||||
* Lookup an entry by its index
|
||||
*
|
||||
* Requesting the reflog entry with an index of 0 (zero) will
|
||||
* return the most recently created entry.
|
||||
*
|
||||
* @param reflog a previously loaded reflog
|
||||
* @param idx the position of the entry to lookup. Should be greater than or
|
||||
* equal to 0 (zero) and less than `git_reflog_entrycount()`.
|
||||
* @return the entry; NULL if not found
|
||||
*/
|
||||
GIT_EXTERN(const git_reflog_entry *) git_reflog_entry_byindex(git_reflog *reflog, size_t idx);
|
||||
|
||||
/**
|
||||
* Remove an entry from the reflog by its index
|
||||
*
|
||||
* To ensure there's no gap in the log history, set `rewrite_previous_entry`
|
||||
* param value to 1. When deleting entry `n`, member old_oid of entry `n-1`
|
||||
* (if any) will be updated with the value of member new_oid of entry `n+1`.
|
||||
*
|
||||
* @param reflog a previously loaded reflog.
|
||||
*
|
||||
* @param idx the position of the entry to remove. Should be greater than or
|
||||
* equal to 0 (zero) and less than `git_reflog_entrycount()`.
|
||||
*
|
||||
* @param rewrite_previous_entry 1 to rewrite the history; 0 otherwise.
|
||||
*
|
||||
* @return 0 on success, GIT_ENOTFOUND if the entry doesn't exist
|
||||
* or an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_reflog_drop(
|
||||
git_reflog *reflog,
|
||||
size_t idx,
|
||||
int rewrite_previous_entry);
|
||||
|
||||
/**
|
||||
* Get the old oid
|
||||
*
|
||||
* @param entry a reflog entry
|
||||
* @return the old oid
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_reflog_entry_id_old(const git_reflog_entry *entry);
|
||||
|
||||
/**
|
||||
* Get the new oid
|
||||
*
|
||||
* @param entry a reflog entry
|
||||
* @return the new oid at this time
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_reflog_entry_id_new(const git_reflog_entry *entry);
|
||||
|
||||
/**
|
||||
* Get the committer of this entry
|
||||
*
|
||||
* @param entry a reflog entry
|
||||
* @return the committer
|
||||
*/
|
||||
GIT_EXTERN(const git_signature *) git_reflog_entry_committer(const git_reflog_entry *entry);
|
||||
|
||||
/**
|
||||
* Get the log message
|
||||
*
|
||||
* @param entry a reflog entry
|
||||
* @return the log msg
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_reflog_entry_message(const git_reflog_entry *entry);
|
||||
|
||||
/**
|
||||
* Free the reflog
|
||||
*
|
||||
* @param reflog reflog to free
|
||||
*/
|
||||
GIT_EXTERN(void) git_reflog_free(git_reflog *reflog);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,509 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_refs_h__
|
||||
#define INCLUDE_git_refs_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
#include "strarray.h"
|
||||
|
||||
/**
|
||||
* @file git2/refs.h
|
||||
* @brief Git reference management routines
|
||||
* @defgroup git_reference Git reference management routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Lookup a reference by name in a repository.
|
||||
*
|
||||
* The returned reference must be freed by the user.
|
||||
*
|
||||
* The name will be checked for validity.
|
||||
* See `git_reference_create_symbolic()` for rules about valid names.
|
||||
*
|
||||
* @param out pointer to the looked-up reference
|
||||
* @param repo the repository to look up the reference
|
||||
* @param name the long name for the reference (e.g. HEAD, refs/heads/master, refs/tags/v0.1.0, ...)
|
||||
* @return 0 on success, ENOTFOUND, EINVALIDSPEC or an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_lookup(git_reference **out, git_repository *repo, const char *name);
|
||||
|
||||
/**
|
||||
* Lookup a reference by name and resolve immediately to OID.
|
||||
*
|
||||
* This function provides a quick way to resolve a reference name straight
|
||||
* through to the object id that it refers to. This avoids having to
|
||||
* allocate or free any `git_reference` objects for simple situations.
|
||||
*
|
||||
* The name will be checked for validity.
|
||||
* See `git_reference_create_symbolic()` for rules about valid names.
|
||||
*
|
||||
* @param out Pointer to oid to be filled in
|
||||
* @param repo The repository in which to look up the reference
|
||||
* @param name The long name for the reference
|
||||
* @return 0 on success, ENOTFOUND, EINVALIDSPEC or an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_name_to_id(
|
||||
git_oid *out, git_repository *repo, const char *name);
|
||||
|
||||
/**
|
||||
* Create a new symbolic reference.
|
||||
*
|
||||
* A symbolic reference is a reference name that refers to another
|
||||
* reference name. If the other name moves, the symbolic name will move,
|
||||
* too. As a simple example, the "HEAD" reference might refer to
|
||||
* "refs/heads/master" while on the "master" branch of a repository.
|
||||
*
|
||||
* The symbolic reference will be created in the repository and written to
|
||||
* the disk. The generated reference object must be freed by the user.
|
||||
*
|
||||
* Valid reference names must follow one of two patterns:
|
||||
*
|
||||
* 1. Top-level names must contain only capital letters and underscores,
|
||||
* and must begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD").
|
||||
* 2. Names prefixed with "refs/" can be almost anything. You must avoid
|
||||
* the characters '~', '^', ':', '\\', '?', '[', and '*', and the
|
||||
* sequences ".." and "@{" which have special meaning to revparse.
|
||||
*
|
||||
* This function will return an error if a reference already exists with the
|
||||
* given name unless `force` is true, in which case it will be overwritten.
|
||||
*
|
||||
* @param out Pointer to the newly created reference
|
||||
* @param repo Repository where that reference will live
|
||||
* @param name The name of the reference
|
||||
* @param target The target of the reference
|
||||
* @param force Overwrite existing references
|
||||
* @return 0 on success, EEXISTS, EINVALIDSPEC or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_symbolic_create(git_reference **out, git_repository *repo, const char *name, const char *target, int force);
|
||||
|
||||
/**
|
||||
* Create a new direct reference.
|
||||
*
|
||||
* A direct reference (also called an object id reference) refers directly
|
||||
* to a specific object id (a.k.a. OID or SHA) in the repository. The id
|
||||
* permanently refers to the object (although the reference itself can be
|
||||
* moved). For example, in libgit2 the direct ref "refs/tags/v0.17.0"
|
||||
* refers to OID 5b9fac39d8a76b9139667c26a63e6b3f204b3977.
|
||||
*
|
||||
* The direct reference will be created in the repository and written to
|
||||
* the disk. The generated reference object must be freed by the user.
|
||||
*
|
||||
* Valid reference names must follow one of two patterns:
|
||||
*
|
||||
* 1. Top-level names must contain only capital letters and underscores,
|
||||
* and must begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD").
|
||||
* 2. Names prefixed with "refs/" can be almost anything. You must avoid
|
||||
* the characters '~', '^', ':', '\\', '?', '[', and '*', and the
|
||||
* sequences ".." and "@{" which have special meaning to revparse.
|
||||
*
|
||||
* This function will return an error if a reference already exists with the
|
||||
* given name unless `force` is true, in which case it will be overwritten.
|
||||
*
|
||||
* @param out Pointer to the newly created reference
|
||||
* @param repo Repository where that reference will live
|
||||
* @param name The name of the reference
|
||||
* @param id The object id pointed to by the reference.
|
||||
* @param force Overwrite existing references
|
||||
* @return 0 on success, EEXISTS, EINVALIDSPEC or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_create(git_reference **out, git_repository *repo, const char *name, const git_oid *id, int force);
|
||||
|
||||
/**
|
||||
* Get the OID pointed to by a direct reference.
|
||||
*
|
||||
* Only available if the reference is direct (i.e. an object id reference,
|
||||
* not a symbolic one).
|
||||
*
|
||||
* To find the OID of a symbolic ref, call `git_reference_resolve()` and
|
||||
* then this function (or maybe use `git_reference_name_to_oid()` to
|
||||
* directly resolve a reference name all the way through to an OID).
|
||||
*
|
||||
* @param ref The reference
|
||||
* @return a pointer to the oid if available, NULL otherwise
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_reference_target(const git_reference *ref);
|
||||
|
||||
/**
|
||||
* Get full name to the reference pointed to by a symbolic reference.
|
||||
*
|
||||
* Only available if the reference is symbolic.
|
||||
*
|
||||
* @param ref The reference
|
||||
* @return a pointer to the name if available, NULL otherwise
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_reference_symbolic_target(const git_reference *ref);
|
||||
|
||||
/**
|
||||
* Get the type of a reference.
|
||||
*
|
||||
* Either direct (GIT_REF_OID) or symbolic (GIT_REF_SYMBOLIC)
|
||||
*
|
||||
* @param ref The reference
|
||||
* @return the type
|
||||
*/
|
||||
GIT_EXTERN(git_ref_t) git_reference_type(const git_reference *ref);
|
||||
|
||||
/**
|
||||
* Get the full name of a reference.
|
||||
*
|
||||
* See `git_reference_create_symbolic()` for rules about valid names.
|
||||
*
|
||||
* @param ref The reference
|
||||
* @return the full name for the ref
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_reference_name(const git_reference *ref);
|
||||
|
||||
/**
|
||||
* Resolve a symbolic reference to a direct reference.
|
||||
*
|
||||
* This method iteratively peels a symbolic reference until it resolves to
|
||||
* a direct reference to an OID.
|
||||
*
|
||||
* The peeled reference is returned in the `resolved_ref` argument, and
|
||||
* must be freed manually once it's no longer needed.
|
||||
*
|
||||
* If a direct reference is passed as an argument, a copy of that
|
||||
* reference is returned. This copy must be manually freed too.
|
||||
*
|
||||
* @param resolved_ref Pointer to the peeled reference
|
||||
* @param ref The reference
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_resolve(git_reference **out, const git_reference *ref);
|
||||
|
||||
/**
|
||||
* Get the repository where a reference resides.
|
||||
*
|
||||
* @param ref The reference
|
||||
* @return a pointer to the repo
|
||||
*/
|
||||
GIT_EXTERN(git_repository *) git_reference_owner(const git_reference *ref);
|
||||
|
||||
/**
|
||||
* Set the symbolic target of a reference.
|
||||
*
|
||||
* The reference must be a symbolic reference, otherwise this will fail.
|
||||
*
|
||||
* The reference will be automatically updated in memory and on disk.
|
||||
*
|
||||
* The target name will be checked for validity.
|
||||
* See `git_reference_create_symbolic()` for rules about valid names.
|
||||
*
|
||||
* @param ref The reference
|
||||
* @param target The new target for the reference
|
||||
* @return 0 on success, EINVALIDSPEC or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_symbolic_set_target(git_reference *ref, const char *target);
|
||||
|
||||
/**
|
||||
* Set the OID target of a reference.
|
||||
*
|
||||
* The reference must be a direct reference, otherwise this will fail.
|
||||
*
|
||||
* The reference will be automatically updated in memory and on disk.
|
||||
*
|
||||
* @param ref The reference
|
||||
* @param id The new target OID for the reference
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_set_target(git_reference *ref, const git_oid *id);
|
||||
|
||||
/**
|
||||
* Rename an existing reference.
|
||||
*
|
||||
* This method works for both direct and symbolic references.
|
||||
*
|
||||
* The new name will be checked for validity.
|
||||
* See `git_reference_create_symbolic()` for rules about valid names.
|
||||
*
|
||||
* The given git_reference will be updated in place.
|
||||
*
|
||||
* The reference will be immediately renamed in-memory and on disk.
|
||||
*
|
||||
* If the `force` flag is not enabled, and there's already
|
||||
* a reference with the given name, the renaming will fail.
|
||||
*
|
||||
* IMPORTANT:
|
||||
* The user needs to write a proper reflog entry if the
|
||||
* reflog is enabled for the repository. We only rename
|
||||
* the reflog if it exists.
|
||||
*
|
||||
* @param ref The reference to rename
|
||||
* @param name The new name for the reference
|
||||
* @param force Overwrite an existing reference
|
||||
* @return 0 on success, EINVALIDSPEC, EEXISTS or an error code
|
||||
*
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_rename(git_reference *ref, const char *name, int force);
|
||||
|
||||
/**
|
||||
* Delete an existing reference.
|
||||
*
|
||||
* This method works for both direct and symbolic references.
|
||||
*
|
||||
* The reference will be immediately removed on disk and from memory
|
||||
* (i.e. freed). The given reference pointer will no longer be valid.
|
||||
*
|
||||
* @param ref The reference to remove
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_delete(git_reference *ref);
|
||||
|
||||
/**
|
||||
* Pack all the loose references in the repository.
|
||||
*
|
||||
* This method will load into the cache all the loose
|
||||
* references on the repository and update the
|
||||
* `packed-refs` file with them.
|
||||
*
|
||||
* Once the `packed-refs` file has been written properly,
|
||||
* the loose references will be removed from disk.
|
||||
*
|
||||
* @param repo Repository where the loose refs will be packed
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_packall(git_repository *repo);
|
||||
|
||||
/**
|
||||
* Fill a list with all the references that can be found in a repository.
|
||||
*
|
||||
* Using the `list_flags` parameter, the listed references may be filtered
|
||||
* by type (`GIT_REF_OID` or `GIT_REF_SYMBOLIC`) or using a bitwise OR of
|
||||
* `git_ref_t` values. To include packed refs, include `GIT_REF_PACKED`.
|
||||
* For convenience, use the value `GIT_REF_LISTALL` to obtain all
|
||||
* references, including packed ones.
|
||||
*
|
||||
* The string array will be filled with the names of all references; these
|
||||
* values are owned by the user and should be free'd manually when no
|
||||
* longer needed, using `git_strarray_free()`.
|
||||
*
|
||||
* @param array Pointer to a git_strarray structure where
|
||||
* the reference names will be stored
|
||||
* @param repo Repository where to find the refs
|
||||
* @param list_flags Filtering flags for the reference listing
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_list(git_strarray *array, git_repository *repo, unsigned int list_flags);
|
||||
|
||||
typedef int (*git_reference_foreach_cb)(const char *refname, void *payload);
|
||||
|
||||
/**
|
||||
* Perform a callback on each reference in the repository.
|
||||
*
|
||||
* Using the `list_flags` parameter, the references may be filtered by
|
||||
* type (`GIT_REF_OID` or `GIT_REF_SYMBOLIC`) or using a bitwise OR of
|
||||
* `git_ref_t` values. To include packed refs, include `GIT_REF_PACKED`.
|
||||
* For convenience, use the value `GIT_REF_LISTALL` to obtain all
|
||||
* references, including packed ones.
|
||||
*
|
||||
* The `callback` function will be called for each reference in the
|
||||
* repository, receiving the name of the reference and the `payload` value
|
||||
* passed to this method. Returning a non-zero value from the callback
|
||||
* will terminate the iteration.
|
||||
*
|
||||
* @param repo Repository where to find the refs
|
||||
* @param list_flags Filtering flags for the reference listing.
|
||||
* @param callback Function which will be called for every listed ref
|
||||
* @param payload Additional data to pass to the callback
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_foreach(
|
||||
git_repository *repo,
|
||||
unsigned int list_flags,
|
||||
git_reference_foreach_cb callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Check if a reference has been loaded from a packfile.
|
||||
*
|
||||
* @param ref A git reference
|
||||
* @return 0 in case it's not packed; 1 otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_is_packed(git_reference *ref);
|
||||
|
||||
/**
|
||||
* Reload a reference from disk.
|
||||
*
|
||||
* Reference pointers can become outdated if the Git repository is
|
||||
* accessed simultaneously by other clients while the library is open.
|
||||
*
|
||||
* This method forces a reload of the reference from disk, to ensure that
|
||||
* the provided information is still reliable.
|
||||
*
|
||||
* If the reload fails (e.g. the reference no longer exists on disk, or
|
||||
* has become corrupted), an error code will be returned and the reference
|
||||
* pointer will be invalidated and freed.
|
||||
*
|
||||
* @param ref The reference to reload
|
||||
* @return 0 on success, or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_reload(git_reference *ref);
|
||||
|
||||
/**
|
||||
* Free the given reference.
|
||||
*
|
||||
* @param ref git_reference
|
||||
*/
|
||||
GIT_EXTERN(void) git_reference_free(git_reference *ref);
|
||||
|
||||
/**
|
||||
* Compare two references.
|
||||
*
|
||||
* @param ref1 The first git_reference
|
||||
* @param ref2 The second git_reference
|
||||
* @return 0 if the same, else a stable but meaningless ordering.
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_cmp(git_reference *ref1, git_reference *ref2);
|
||||
|
||||
/**
|
||||
* Perform a callback on each reference in the repository whose name
|
||||
* matches the given pattern.
|
||||
*
|
||||
* This function acts like `git_reference_foreach()` with an additional
|
||||
* pattern match being applied to the reference name before issuing the
|
||||
* callback function. See that function for more information.
|
||||
*
|
||||
* The pattern is matched using fnmatch or "glob" style where a '*' matches
|
||||
* any sequence of letters, a '?' matches any letter, and square brackets
|
||||
* can be used to define character ranges (such as "[0-9]" for digits).
|
||||
*
|
||||
* @param repo Repository where to find the refs
|
||||
* @param glob Pattern to match (fnmatch-style) against reference name.
|
||||
* @param list_flags Filtering flags for the reference listing.
|
||||
* @param callback Function which will be called for every listed ref
|
||||
* @param payload Additional data to pass to the callback
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_foreach_glob(
|
||||
git_repository *repo,
|
||||
const char *glob,
|
||||
unsigned int list_flags,
|
||||
git_reference_foreach_cb callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Check if a reflog exists for the specified reference.
|
||||
*
|
||||
* @param ref A git reference
|
||||
*
|
||||
* @return 0 when no reflog can be found, 1 when it exists;
|
||||
* otherwise an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_has_log(git_reference *ref);
|
||||
|
||||
/**
|
||||
* Check if a reference is a local branch.
|
||||
*
|
||||
* @param ref A git reference
|
||||
*
|
||||
* @return 1 when the reference lives in the refs/heads
|
||||
* namespace; 0 otherwise.
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_is_branch(git_reference *ref);
|
||||
|
||||
/**
|
||||
* Check if a reference is a remote tracking branch
|
||||
*
|
||||
* @param ref A git reference
|
||||
*
|
||||
* @return 1 when the reference lives in the refs/remotes
|
||||
* namespace; 0 otherwise.
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_is_remote(git_reference *ref);
|
||||
|
||||
|
||||
typedef enum {
|
||||
GIT_REF_FORMAT_NORMAL = 0,
|
||||
|
||||
/**
|
||||
* Control whether one-level refnames are accepted
|
||||
* (i.e., refnames that do not contain multiple /-separated
|
||||
* components). Those are expected to be written only using
|
||||
* uppercase letters and underscore (FETCH_HEAD, ...)
|
||||
*/
|
||||
GIT_REF_FORMAT_ALLOW_ONELEVEL = (1 << 0),
|
||||
|
||||
/**
|
||||
* Interpret the provided name as a reference pattern for a
|
||||
* refspec (as used with remote repositories). If this option
|
||||
* is enabled, the name is allowed to contain a single * (<star>)
|
||||
* in place of a one full pathname component
|
||||
* (e.g., foo/<star>/bar but not foo/bar<star>).
|
||||
*/
|
||||
GIT_REF_FORMAT_REFSPEC_PATTERN = (1 << 1),
|
||||
} git_reference_normalize_t;
|
||||
|
||||
/**
|
||||
* Normalize reference name and check validity.
|
||||
*
|
||||
* This will normalize the reference name by removing any leading slash
|
||||
* '/' characters and collapsing runs of adjacent slashes between name
|
||||
* components into a single slash.
|
||||
*
|
||||
* Once normalized, if the reference name is valid, it will be returned in
|
||||
* the user allocated buffer.
|
||||
*
|
||||
* See `git_reference_create_symbolic()` for rules about valid names.
|
||||
*
|
||||
* @param buffer_out User allocated buffer to store normalized name
|
||||
* @param buffer_size Size of buffer_out
|
||||
* @param name Reference name to be checked.
|
||||
* @param flags Flags to constrain name validation rules - see the
|
||||
* GIT_REF_FORMAT constants above.
|
||||
* @return 0 on success, GIT_EBUFS if buffer is too small, EINVALIDSPEC
|
||||
* or an error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_normalize_name(
|
||||
char *buffer_out,
|
||||
size_t buffer_size,
|
||||
const char *name,
|
||||
unsigned int flags);
|
||||
|
||||
/**
|
||||
* Recursively peel reference until object of the specified type is found.
|
||||
*
|
||||
* The retrieved `peeled` object is owned by the repository
|
||||
* and should be closed with the `git_object_free` method.
|
||||
*
|
||||
* If you pass `GIT_OBJ_ANY` as the target type, then the object
|
||||
* will be peeled until a non-tag object is met.
|
||||
*
|
||||
* @param peeled Pointer to the peeled git_object
|
||||
* @param ref The reference to be processed
|
||||
* @param target_type The type of the requested object (GIT_OBJ_COMMIT,
|
||||
* GIT_OBJ_TAG, GIT_OBJ_TREE, GIT_OBJ_BLOB or GIT_OBJ_ANY).
|
||||
* @return 0 on success, GIT_EAMBIGUOUS, GIT_ENOTFOUND or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_peel(
|
||||
git_object **out,
|
||||
git_reference *ref,
|
||||
git_otype type);
|
||||
|
||||
/**
|
||||
* Ensure the reference name is well-formed.
|
||||
*
|
||||
* Valid reference names must follow one of two patterns:
|
||||
*
|
||||
* 1. Top-level names must contain only capital letters and underscores,
|
||||
* and must begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD").
|
||||
* 2. Names prefixed with "refs/" can be almost anything. You must avoid
|
||||
* the characters '~', '^', ':', '\\', '?', '[', and '*', and the
|
||||
* sequences ".." and "@{" which have special meaning to revparse.
|
||||
*
|
||||
* @param refname name to be checked.
|
||||
* @return 1 if the reference name is acceptable; 0 if it isn't
|
||||
*/
|
||||
GIT_EXTERN(int) git_reference_is_valid_name(const char *refname);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_refspec_h__
|
||||
#define INCLUDE_git_refspec_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* @file git2/refspec.h
|
||||
* @brief Git refspec attributes
|
||||
* @defgroup git_refspec Git refspec attributes
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Get the source specifier
|
||||
*
|
||||
* @param refspec the refspec
|
||||
* @return the refspec's source specifier
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_refspec_src(const git_refspec *refspec);
|
||||
|
||||
/**
|
||||
* Get the destination specifier
|
||||
*
|
||||
* @param refspec the refspec
|
||||
* @return the refspec's destination specifier
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_refspec_dst(const git_refspec *refspec);
|
||||
|
||||
/**
|
||||
* Get the force update setting
|
||||
*
|
||||
* @param refspec the refspec
|
||||
* @return 1 if force update has been set, 0 otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_refspec_force(const git_refspec *refspec);
|
||||
|
||||
/**
|
||||
* Check if a refspec's source descriptor matches a reference
|
||||
*
|
||||
* @param refspec the refspec
|
||||
* @param refname the name of the reference to check
|
||||
* @return 1 if the refspec matches, 0 otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_refspec_src_matches(const git_refspec *refspec, const char *refname);
|
||||
|
||||
/**
|
||||
* Transform a reference to its target following the refspec's rules
|
||||
*
|
||||
* @param out where to store the target name
|
||||
* @param outlen the size of the `out` buffer
|
||||
* @param spec the refspec
|
||||
* @param name the name of the reference to transform
|
||||
* @return 0, GIT_EBUFS or another error
|
||||
*/
|
||||
GIT_EXTERN(int) git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, const char *name);
|
||||
|
||||
GIT_END_DECL
|
||||
|
||||
#endif
|
||||
@@ -1,465 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_remote_h__
|
||||
#define INCLUDE_git_remote_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "repository.h"
|
||||
#include "refspec.h"
|
||||
#include "net.h"
|
||||
#include "indexer.h"
|
||||
#include "strarray.h"
|
||||
#include "transport.h"
|
||||
|
||||
/**
|
||||
* @file git2/remote.h
|
||||
* @brief Git remote management functions
|
||||
* @defgroup git_remote remote management functions
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
typedef int (*git_remote_rename_problem_cb)(const char *problematic_refspec, void *payload);
|
||||
/*
|
||||
* TODO: This functions still need to be implemented:
|
||||
* - _listcb/_foreach
|
||||
* - _add
|
||||
* - _rename
|
||||
* - _del (needs support from config)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add a remote with the default fetch refspec to the repository's configuration. This
|
||||
* calls git_remote_save before returning.
|
||||
*
|
||||
* @param out the resulting remote
|
||||
* @param repo the repository in which to create the remote
|
||||
* @param name the remote's name
|
||||
* @param url the remote's url
|
||||
* @return 0, GIT_EINVALIDSPEC, GIT_EEXISTS or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_create(
|
||||
git_remote **out,
|
||||
git_repository *repo,
|
||||
const char *name,
|
||||
const char *url);
|
||||
|
||||
/**
|
||||
* Create a remote in memory
|
||||
*
|
||||
* Create a remote with the given refspec in memory. You can use
|
||||
* this when you have a URL instead of a remote's name. Note that in-memory
|
||||
* remotes cannot be converted to persisted remotes.
|
||||
*
|
||||
* The name, when provided, will be checked for validity.
|
||||
* See `git_tag_create()` for rules about valid names.
|
||||
*
|
||||
* @param out pointer to the new remote object
|
||||
* @param repo the associated repository. May be NULL for a "dangling" remote.
|
||||
* @param fetch the fetch refspec to use for this remote. May be NULL for defaults.
|
||||
* @param url the remote repository's URL
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_create_inmemory(
|
||||
git_remote **out,
|
||||
git_repository *repo,
|
||||
const char *fetch,
|
||||
const char *url);
|
||||
|
||||
/**
|
||||
* Sets the owning repository for the remote. This is only allowed on
|
||||
* dangling remotes.
|
||||
*
|
||||
* @param remote the remote to configure
|
||||
* @param repo the repository that will own the remote
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_set_repository(git_remote *remote, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Get the information for a particular remote
|
||||
*
|
||||
* The name will be checked for validity.
|
||||
* See `git_tag_create()` for rules about valid names.
|
||||
*
|
||||
* @param out pointer to the new remote object
|
||||
* @param repo the associated repository
|
||||
* @param name the remote's name
|
||||
* @return 0, GIT_ENOTFOUND, GIT_EINVALIDSPEC or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_load(git_remote **out, git_repository *repo, const char *name);
|
||||
|
||||
/**
|
||||
* Save a remote to its repository's configuration
|
||||
*
|
||||
* One can't save a in-memory remote. Doing so will
|
||||
* result in a GIT_EINVALIDSPEC being returned.
|
||||
*
|
||||
* @param remote the remote to save to config
|
||||
* @return 0, GIT_EINVALIDSPEC or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_save(const git_remote *remote);
|
||||
|
||||
/**
|
||||
* Get the remote's name
|
||||
*
|
||||
* @param remote the remote
|
||||
* @return a pointer to the name or NULL for in-memory remotes
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_remote_name(const git_remote *remote);
|
||||
|
||||
/**
|
||||
* Get the remote's url
|
||||
*
|
||||
* @param remote the remote
|
||||
* @return a pointer to the url
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_remote_url(const git_remote *remote);
|
||||
|
||||
/**
|
||||
* Get the remote's url for pushing
|
||||
*
|
||||
* @param remote the remote
|
||||
* @return a pointer to the url or NULL if no special url for pushing is set
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_remote_pushurl(const git_remote *remote);
|
||||
|
||||
/**
|
||||
* Set the remote's url
|
||||
*
|
||||
* Existing connections will not be updated.
|
||||
*
|
||||
* @param remote the remote
|
||||
* @param url the url to set
|
||||
* @return 0 or an error value
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_set_url(git_remote *remote, const char* url);
|
||||
|
||||
/**
|
||||
* Set the remote's url for pushing
|
||||
*
|
||||
* Existing connections will not be updated.
|
||||
*
|
||||
* @param remote the remote
|
||||
* @param url the url to set or NULL to clear the pushurl
|
||||
* @return 0 or an error value
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_set_pushurl(git_remote *remote, const char* url);
|
||||
|
||||
/**
|
||||
* Set the remote's fetch refspec
|
||||
*
|
||||
* @param remote the remote
|
||||
* @apram spec the new fetch refspec
|
||||
* @return 0 or an error value
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_set_fetchspec(git_remote *remote, const char *spec);
|
||||
|
||||
/**
|
||||
* Get the fetch refspec
|
||||
*
|
||||
* @param remote the remote
|
||||
* @return a pointer to the fetch refspec or NULL if it doesn't exist
|
||||
*/
|
||||
GIT_EXTERN(const git_refspec *) git_remote_fetchspec(const git_remote *remote);
|
||||
|
||||
/**
|
||||
* Set the remote's push refspec
|
||||
*
|
||||
* @param remote the remote
|
||||
* @param spec the new push refspec
|
||||
* @return 0 or an error value
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_set_pushspec(git_remote *remote, const char *spec);
|
||||
|
||||
/**
|
||||
* Get the push refspec
|
||||
*
|
||||
* @param remote the remote
|
||||
* @return a pointer to the push refspec or NULL if it doesn't exist
|
||||
*/
|
||||
|
||||
GIT_EXTERN(const git_refspec *) git_remote_pushspec(const git_remote *remote);
|
||||
|
||||
/**
|
||||
* Open a connection to a remote
|
||||
*
|
||||
* The transport is selected based on the URL. The direction argument
|
||||
* is due to a limitation of the git protocol (over TCP or SSH) which
|
||||
* starts up a specific binary which can only do the one or the other.
|
||||
*
|
||||
* @param remote the remote to connect to
|
||||
* @param direction whether you want to receive or send data
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_connect(git_remote *remote, git_direction direction);
|
||||
|
||||
/**
|
||||
* Get a list of refs at the remote
|
||||
*
|
||||
* The remote (or more exactly its transport) must be connected. The
|
||||
* memory belongs to the remote.
|
||||
*
|
||||
* If you a return a non-zero value from the callback, this will stop
|
||||
* looping over the refs.
|
||||
*
|
||||
* @param remote the remote
|
||||
* @param list_cb function to call with each ref discovered at the remote
|
||||
* @param payload additional data to pass to the callback
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_ls(git_remote *remote, git_headlist_cb list_cb, void *payload);
|
||||
|
||||
/**
|
||||
* Download the packfile
|
||||
*
|
||||
* Negotiate what objects should be downloaded and download the
|
||||
* packfile with those objects. The packfile is downloaded with a
|
||||
* temporary filename, as it's final name is not known yet. If there
|
||||
* was no packfile needed (all the objects were available locally),
|
||||
* filename will be NULL and the function will return success.
|
||||
*
|
||||
* @param remote the remote to download from
|
||||
* @param progress_cb function to call with progress information. Be aware that
|
||||
* this is called inline with network and indexing operations, so performance
|
||||
* may be affected.
|
||||
* @param progress_payload payload for the progress callback
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_download(
|
||||
git_remote *remote,
|
||||
git_transfer_progress_callback progress_cb,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Check whether the remote is connected
|
||||
*
|
||||
* Check whether the remote's underlying transport is connected to the
|
||||
* remote host.
|
||||
*
|
||||
* @param remote the remote
|
||||
* @return 1 if it's connected, 0 otherwise.
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_connected(git_remote *remote);
|
||||
|
||||
/**
|
||||
* Cancel the operation
|
||||
*
|
||||
* At certain points in its operation, the network code checks whether
|
||||
* the operation has been cancelled and if so stops the operation.
|
||||
*
|
||||
* @param remote the remote
|
||||
*/
|
||||
GIT_EXTERN(void) git_remote_stop(git_remote *remote);
|
||||
|
||||
/**
|
||||
* Disconnect from the remote
|
||||
*
|
||||
* Close the connection to the remote and free the underlying
|
||||
* transport.
|
||||
*
|
||||
* @param remote the remote to disconnect from
|
||||
*/
|
||||
GIT_EXTERN(void) git_remote_disconnect(git_remote *remote);
|
||||
|
||||
/**
|
||||
* Free the memory associated with a remote
|
||||
*
|
||||
* This also disconnects from the remote, if the connection
|
||||
* has not been closed yet (using git_remote_disconnect).
|
||||
*
|
||||
* @param remote the remote to free
|
||||
*/
|
||||
GIT_EXTERN(void) git_remote_free(git_remote *remote);
|
||||
|
||||
/**
|
||||
* Update the tips to the new state
|
||||
*
|
||||
* @param remote the remote to update
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_update_tips(git_remote *remote);
|
||||
|
||||
/**
|
||||
* Return whether a string is a valid remote URL
|
||||
*
|
||||
* @param url the url to check
|
||||
* @param 1 if the url is valid, 0 otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_valid_url(const char *url);
|
||||
|
||||
/**
|
||||
* Return whether the passed URL is supported by this version of the library.
|
||||
*
|
||||
* @param url the url to check
|
||||
* @return 1 if the url is supported, 0 otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_supported_url(const char* url);
|
||||
|
||||
/**
|
||||
* Get a list of the configured remotes for a repo
|
||||
*
|
||||
* The string array must be freed by the user.
|
||||
*
|
||||
* @param out a string array which receives the names of the remotes
|
||||
* @param repo the repository to query
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_list(git_strarray *out, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Choose whether to check the server's certificate (applies to HTTPS only)
|
||||
*
|
||||
* @param remote the remote to configure
|
||||
* @param check whether to check the server's certificate (defaults to yes)
|
||||
*/
|
||||
GIT_EXTERN(void) git_remote_check_cert(git_remote *remote, int check);
|
||||
|
||||
/**
|
||||
* Set a credentials acquisition callback for this remote. If the remote is
|
||||
* not available for anonymous access, then you must set this callback in order
|
||||
* to provide credentials to the transport at the time of authentication
|
||||
* failure so that retry can be performed.
|
||||
*
|
||||
* @param remote the remote to configure
|
||||
* @param cred_acquire_cb The credentials acquisition callback to use (defaults
|
||||
* to NULL)
|
||||
*/
|
||||
GIT_EXTERN(void) git_remote_set_cred_acquire_cb(
|
||||
git_remote *remote,
|
||||
git_cred_acquire_cb cred_acquire_cb,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Sets a custom transport for the remote. The caller can use this function
|
||||
* to bypass the automatic discovery of a transport by URL scheme (i.e.
|
||||
* http://, https://, git://) and supply their own transport to be used
|
||||
* instead. After providing the transport to a remote using this function,
|
||||
* the transport object belongs exclusively to that remote, and the remote will
|
||||
* free it when it is freed with git_remote_free.
|
||||
*
|
||||
* @param remote the remote to configure
|
||||
* @param transport the transport object for the remote to use
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_set_transport(
|
||||
git_remote *remote,
|
||||
git_transport *transport);
|
||||
|
||||
/**
|
||||
* Argument to the completion callback which tells it which operation
|
||||
* finished.
|
||||
*/
|
||||
typedef enum git_remote_completion_type {
|
||||
GIT_REMOTE_COMPLETION_DOWNLOAD,
|
||||
GIT_REMOTE_COMPLETION_INDEXING,
|
||||
GIT_REMOTE_COMPLETION_ERROR,
|
||||
} git_remote_completion_type;
|
||||
|
||||
/**
|
||||
* The callback settings structure
|
||||
*
|
||||
* Set the calbacks to be called by the remote.
|
||||
*/
|
||||
struct git_remote_callbacks {
|
||||
unsigned int version;
|
||||
void (*progress)(const char *str, int len, void *data);
|
||||
int (*completion)(git_remote_completion_type type, void *data);
|
||||
int (*update_tips)(const char *refname, const git_oid *a, const git_oid *b, void *data);
|
||||
void *payload;
|
||||
};
|
||||
|
||||
#define GIT_REMOTE_CALLBACKS_VERSION 1
|
||||
#define GIT_REMOTE_CALLBACKS_INIT {GIT_REMOTE_CALLBACKS_VERSION}
|
||||
|
||||
/**
|
||||
* Set the callbacks for a remote
|
||||
*
|
||||
* Note that the remote keeps its own copy of the data and you need to
|
||||
* call this function again if you want to change the callbacks.
|
||||
*
|
||||
* @param remote the remote to configure
|
||||
* @param callbacks a pointer to the user's callback settings
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_set_callbacks(git_remote *remote, git_remote_callbacks *callbacks);
|
||||
|
||||
/**
|
||||
* Get the statistics structure that is filled in by the fetch operation.
|
||||
*/
|
||||
GIT_EXTERN(const git_transfer_progress *) git_remote_stats(git_remote *remote);
|
||||
|
||||
typedef enum {
|
||||
GIT_REMOTE_DOWNLOAD_TAGS_UNSET,
|
||||
GIT_REMOTE_DOWNLOAD_TAGS_NONE,
|
||||
GIT_REMOTE_DOWNLOAD_TAGS_AUTO,
|
||||
GIT_REMOTE_DOWNLOAD_TAGS_ALL
|
||||
} git_remote_autotag_option_t;
|
||||
|
||||
/**
|
||||
* Retrieve the tag auto-follow setting
|
||||
*
|
||||
* @param remote the remote to query
|
||||
* @return the auto-follow setting
|
||||
*/
|
||||
GIT_EXTERN(git_remote_autotag_option_t) git_remote_autotag(git_remote *remote);
|
||||
|
||||
/**
|
||||
* Set the tag auto-follow setting
|
||||
*
|
||||
* @param remote the remote to configure
|
||||
* @param value a GIT_REMOTE_DOWNLOAD_TAGS value
|
||||
*/
|
||||
GIT_EXTERN(void) git_remote_set_autotag(
|
||||
git_remote *remote,
|
||||
git_remote_autotag_option_t value);
|
||||
|
||||
/**
|
||||
* Give the remote a new name
|
||||
*
|
||||
* All remote-tracking branches and configuration settings
|
||||
* for the remote are updated.
|
||||
*
|
||||
* The new name will be checked for validity.
|
||||
* See `git_tag_create()` for rules about valid names.
|
||||
*
|
||||
* A temporary in-memory remote cannot be given a name with this method.
|
||||
*
|
||||
* @param remote the remote to rename
|
||||
* @param new_name the new name the remote should bear
|
||||
* @param callback Optional callback to notify the consumer of fetch refspecs
|
||||
* that haven't been automatically updated and need potential manual tweaking.
|
||||
* @param payload Additional data to pass to the callback
|
||||
* @return 0, GIT_EINVALIDSPEC, GIT_EEXISTS or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_rename(
|
||||
git_remote *remote,
|
||||
const char *new_name,
|
||||
git_remote_rename_problem_cb callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Retrieve the update FETCH_HEAD setting.
|
||||
*
|
||||
* @param remote the remote to query
|
||||
* @return the update FETCH_HEAD setting
|
||||
*/
|
||||
GIT_EXTERN(int) git_remote_update_fetchhead(git_remote *remote);
|
||||
|
||||
/**
|
||||
* Sets the update FETCH_HEAD setting. By default, FETCH_HEAD will be
|
||||
* updated on every fetch. Set to 0 to disable.
|
||||
*
|
||||
* @param remote the remote to configure
|
||||
* @param value 0 to disable updating FETCH_HEAD
|
||||
*/
|
||||
GIT_EXTERN(void) git_remote_set_update_fetchhead(git_remote *remote, int value);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,647 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_repository_h__
|
||||
#define INCLUDE_git_repository_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
|
||||
/**
|
||||
* @file git2/repository.h
|
||||
* @brief Git repository management routines
|
||||
* @defgroup git_repository Git repository management routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Open a git repository.
|
||||
*
|
||||
* The 'path' argument must point to either a git repository
|
||||
* folder, or an existing work dir.
|
||||
*
|
||||
* The method will automatically detect if 'path' is a normal
|
||||
* or bare repository or fail is 'path' is neither.
|
||||
*
|
||||
* @param out pointer to the repo which will be opened
|
||||
* @param path the path to the repository
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_open(git_repository **out, const char *path);
|
||||
|
||||
/**
|
||||
* Create a "fake" repository to wrap an object database
|
||||
*
|
||||
* Create a repository object to wrap an object database to be used
|
||||
* with the API when all you have is an object database. This doesn't
|
||||
* have any paths associated with it, so use with care.
|
||||
*
|
||||
* @param out pointer to the repo
|
||||
* @param odb the object database to wrap
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_wrap_odb(git_repository **out, git_odb *odb);
|
||||
|
||||
/**
|
||||
* Look for a git repository and copy its path in the given buffer.
|
||||
* The lookup start from base_path and walk across parent directories
|
||||
* if nothing has been found. The lookup ends when the first repository
|
||||
* is found, or when reaching a directory referenced in ceiling_dirs
|
||||
* or when the filesystem changes (in case across_fs is true).
|
||||
*
|
||||
* The method will automatically detect if the repository is bare
|
||||
* (if there is a repository).
|
||||
*
|
||||
* @param path_out The user allocated buffer which will
|
||||
* contain the found path.
|
||||
*
|
||||
* @param path_size repository_path size
|
||||
*
|
||||
* @param start_path The base path where the lookup starts.
|
||||
*
|
||||
* @param across_fs If true, then the lookup will not stop when a
|
||||
* filesystem device change is detected while exploring parent directories.
|
||||
*
|
||||
* @param ceiling_dirs A GIT_PATH_LIST_SEPARATOR separated list of
|
||||
* absolute symbolic link free paths. The lookup will stop when any
|
||||
* of this paths is reached. Note that the lookup always performs on
|
||||
* start_path no matter start_path appears in ceiling_dirs ceiling_dirs
|
||||
* might be NULL (which is equivalent to an empty string)
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_discover(
|
||||
char *path_out,
|
||||
size_t path_size,
|
||||
const char *start_path,
|
||||
int across_fs,
|
||||
const char *ceiling_dirs);
|
||||
|
||||
/**
|
||||
* Option flags for `git_repository_open_ext`.
|
||||
*
|
||||
* * GIT_REPOSITORY_OPEN_NO_SEARCH - Only open the repository if it can be
|
||||
* immediately found in the start_path. Do not walk up from the
|
||||
* start_path looking at parent directories.
|
||||
* * GIT_REPOSITORY_OPEN_CROSS_FS - Unless this flag is set, open will not
|
||||
* continue searching across filesystem boundaries (i.e. when `st_dev`
|
||||
* changes from the `stat` system call). (E.g. Searching in a user's home
|
||||
* directory "/home/user/source/" will not return "/.git/" as the found
|
||||
* repo if "/" is a different filesystem than "/home".)
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_REPOSITORY_OPEN_NO_SEARCH = (1 << 0),
|
||||
GIT_REPOSITORY_OPEN_CROSS_FS = (1 << 1),
|
||||
} git_repository_open_flag_t;
|
||||
|
||||
/**
|
||||
* Find and open a repository with extended controls.
|
||||
*
|
||||
* @param out Pointer to the repo which will be opened. This can
|
||||
* actually be NULL if you only want to use the error code to
|
||||
* see if a repo at this path could be opened.
|
||||
* @param path Path to open as git repository. If the flags
|
||||
* permit "searching", then this can be a path to a subdirectory
|
||||
* inside the working directory of the repository.
|
||||
* @param flags A combination of the GIT_REPOSITORY_OPEN flags above.
|
||||
* @param ceiling_dirs A GIT_PATH_LIST_SEPARATOR delimited list of path
|
||||
* prefixes at which the search for a containing repository should
|
||||
* terminate.
|
||||
* @return 0 on success, GIT_ENOTFOUND if no repository could be found,
|
||||
* or -1 if there was a repository but open failed for some reason
|
||||
* (such as repo corruption or system errors).
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_open_ext(
|
||||
git_repository **out,
|
||||
const char *path,
|
||||
unsigned int flags,
|
||||
const char *ceiling_dirs);
|
||||
|
||||
/**
|
||||
* Free a previously allocated repository
|
||||
*
|
||||
* Note that after a repository is free'd, all the objects it has spawned
|
||||
* will still exist until they are manually closed by the user
|
||||
* with `git_object_free`, but accessing any of the attributes of
|
||||
* an object without a backing repository will result in undefined
|
||||
* behavior
|
||||
*
|
||||
* @param repo repository handle to close. If NULL nothing occurs.
|
||||
*/
|
||||
GIT_EXTERN(void) git_repository_free(git_repository *repo);
|
||||
|
||||
/**
|
||||
* Creates a new Git repository in the given folder.
|
||||
*
|
||||
* TODO:
|
||||
* - Reinit the repository
|
||||
*
|
||||
* @param out pointer to the repo which will be created or reinitialized
|
||||
* @param path the path to the repository
|
||||
* @param is_bare if true, a Git repository without a working directory is
|
||||
* created at the pointed path. If false, provided path will be
|
||||
* considered as the working directory into which the .git directory
|
||||
* will be created.
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_init(
|
||||
git_repository **out,
|
||||
const char *path,
|
||||
unsigned is_bare);
|
||||
|
||||
/**
|
||||
* Option flags for `git_repository_init_ext`.
|
||||
*
|
||||
* These flags configure extra behaviors to `git_repository_init_ext`.
|
||||
* In every case, the default behavior is the zero value (i.e. flag is
|
||||
* not set). Just OR the flag values together for the `flags` parameter
|
||||
* when initializing a new repo. Details of individual values are:
|
||||
*
|
||||
* * BARE - Create a bare repository with no working directory.
|
||||
* * NO_REINIT - Return an EEXISTS error if the repo_path appears to
|
||||
* already be an git repository.
|
||||
* * NO_DOTGIT_DIR - Normally a "/.git/" will be appended to the repo
|
||||
* path for non-bare repos (if it is not already there), but
|
||||
* passing this flag prevents that behavior.
|
||||
* * MKDIR - Make the repo_path (and workdir_path) as needed. Init is
|
||||
* always willing to create the ".git" directory even without this
|
||||
* flag. This flag tells init to create the trailing component of
|
||||
* the repo and workdir paths as needed.
|
||||
* * MKPATH - Recursively make all components of the repo and workdir
|
||||
* paths as necessary.
|
||||
* * EXTERNAL_TEMPLATE - libgit2 normally uses internal templates to
|
||||
* initialize a new repo. This flags enables external templates,
|
||||
* looking the "template_path" from the options if set, or the
|
||||
* `init.templatedir` global config if not, or falling back on
|
||||
* "/usr/share/git-core/templates" if it exists.
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_REPOSITORY_INIT_BARE = (1u << 0),
|
||||
GIT_REPOSITORY_INIT_NO_REINIT = (1u << 1),
|
||||
GIT_REPOSITORY_INIT_NO_DOTGIT_DIR = (1u << 2),
|
||||
GIT_REPOSITORY_INIT_MKDIR = (1u << 3),
|
||||
GIT_REPOSITORY_INIT_MKPATH = (1u << 4),
|
||||
GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE = (1u << 5),
|
||||
} git_repository_init_flag_t;
|
||||
|
||||
/**
|
||||
* Mode options for `git_repository_init_ext`.
|
||||
*
|
||||
* Set the mode field of the `git_repository_init_options` structure
|
||||
* either to the custom mode that you would like, or to one of the
|
||||
* following modes:
|
||||
*
|
||||
* * SHARED_UMASK - Use permissions configured by umask - the default.
|
||||
* * SHARED_GROUP - Use "--shared=group" behavior, chmod'ing the new repo
|
||||
* to be group writable and "g+sx" for sticky group assignment.
|
||||
* * SHARED_ALL - Use "--shared=all" behavior, adding world readability.
|
||||
* * Anything else - Set to custom value.
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_REPOSITORY_INIT_SHARED_UMASK = 0,
|
||||
GIT_REPOSITORY_INIT_SHARED_GROUP = 0002775,
|
||||
GIT_REPOSITORY_INIT_SHARED_ALL = 0002777,
|
||||
} git_repository_init_mode_t;
|
||||
|
||||
/**
|
||||
* Extended options structure for `git_repository_init_ext`.
|
||||
*
|
||||
* This contains extra options for `git_repository_init_ext` that enable
|
||||
* additional initialization features. The fields are:
|
||||
*
|
||||
* * flags - Combination of GIT_REPOSITORY_INIT flags above.
|
||||
* * mode - Set to one of the standard GIT_REPOSITORY_INIT_SHARED_...
|
||||
* constants above, or to a custom value that you would like.
|
||||
* * workdir_path - The path to the working dir or NULL for default (i.e.
|
||||
* repo_path parent on non-bare repos). IF THIS IS RELATIVE PATH,
|
||||
* IT WILL BE EVALUATED RELATIVE TO THE REPO_PATH. If this is not
|
||||
* the "natural" working directory, a .git gitlink file will be
|
||||
* created here linking to the repo_path.
|
||||
* * description - If set, this will be used to initialize the "description"
|
||||
* file in the repository, instead of using the template content.
|
||||
* * template_path - When GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE is set,
|
||||
* this contains the path to use for the template directory. If
|
||||
* this is NULL, the config or default directory options will be
|
||||
* used instead.
|
||||
* * initial_head - The name of the head to point HEAD at. If NULL, then
|
||||
* this will be treated as "master" and the HEAD ref will be set
|
||||
* to "refs/heads/master". If this begins with "refs/" it will be
|
||||
* used verbatim; otherwise "refs/heads/" will be prefixed.
|
||||
* * origin_url - If this is non-NULL, then after the rest of the
|
||||
* repository initialization is completed, an "origin" remote
|
||||
* will be added pointing to this URL.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int version;
|
||||
uint32_t flags;
|
||||
uint32_t mode;
|
||||
const char *workdir_path;
|
||||
const char *description;
|
||||
const char *template_path;
|
||||
const char *initial_head;
|
||||
const char *origin_url;
|
||||
} git_repository_init_options;
|
||||
|
||||
#define GIT_REPOSITORY_INIT_OPTIONS_VERSION 1
|
||||
#define GIT_REPOSITORY_INIT_OPTIONS_INIT {GIT_REPOSITORY_INIT_OPTIONS_VERSION}
|
||||
|
||||
/**
|
||||
* Create a new Git repository in the given folder with extended controls.
|
||||
*
|
||||
* This will initialize a new git repository (creating the repo_path
|
||||
* if requested by flags) and working directory as needed. It will
|
||||
* auto-detect the case sensitivity of the file system and if the
|
||||
* file system supports file mode bits correctly.
|
||||
*
|
||||
* @param out Pointer to the repo which will be created or reinitialized.
|
||||
* @param repo_path The path to the repository.
|
||||
* @param opts Pointer to git_repository_init_options struct.
|
||||
* @return 0 or an error code on failure.
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_init_ext(
|
||||
git_repository **out,
|
||||
const char *repo_path,
|
||||
git_repository_init_options *opts);
|
||||
|
||||
/**
|
||||
* Retrieve and resolve the reference pointed at by HEAD.
|
||||
*
|
||||
* The returned `git_reference` will be owned by caller and
|
||||
* `git_reference_free()` must be called when done with it to release the
|
||||
* allocated memory and prevent a leak.
|
||||
*
|
||||
* @param out pointer to the reference which will be retrieved
|
||||
* @param repo a repository object
|
||||
*
|
||||
* @return 0 on success, GIT_EORPHANEDHEAD when HEAD points to a non existing
|
||||
* branch, GIT_ENOTFOUND when HEAD is missing; an error code otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_head(git_reference **out, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Check if a repository's HEAD is detached
|
||||
*
|
||||
* A repository's HEAD is detached when it points directly to a commit
|
||||
* instead of a branch.
|
||||
*
|
||||
* @param repo Repo to test
|
||||
* @return 1 if HEAD is detached, 0 if it's not; error code if there
|
||||
* was an error.
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_head_detached(git_repository *repo);
|
||||
|
||||
/**
|
||||
* Check if the current branch is an orphan
|
||||
*
|
||||
* An orphan branch is one named from HEAD but which doesn't exist in
|
||||
* the refs namespace, because it doesn't have any commit to point to.
|
||||
*
|
||||
* @param repo Repo to test
|
||||
* @return 1 if the current branch is an orphan, 0 if it's not; error
|
||||
* code if there was an error
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_head_orphan(git_repository *repo);
|
||||
|
||||
/**
|
||||
* Check if a repository is empty
|
||||
*
|
||||
* An empty repository has just been initialized and contains
|
||||
* no references.
|
||||
*
|
||||
* @param repo Repo to test
|
||||
* @return 1 if the repository is empty, 0 if it isn't, error code
|
||||
* if the repository is corrupted
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_is_empty(git_repository *repo);
|
||||
|
||||
/**
|
||||
* Get the path of this repository
|
||||
*
|
||||
* This is the path of the `.git` folder for normal repositories,
|
||||
* or of the repository itself for bare repositories.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @return the path to the repository
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_repository_path(git_repository *repo);
|
||||
|
||||
/**
|
||||
* Get the path of the working directory for this repository
|
||||
*
|
||||
* If the repository is bare, this function will always return
|
||||
* NULL.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @return the path to the working dir, if it exists
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_repository_workdir(git_repository *repo);
|
||||
|
||||
/**
|
||||
* Set the path to the working directory for this repository
|
||||
*
|
||||
* The working directory doesn't need to be the same one
|
||||
* that contains the `.git` folder for this repository.
|
||||
*
|
||||
* If this repository is bare, setting its working directory
|
||||
* will turn it into a normal repository, capable of performing
|
||||
* all the common workdir operations (checkout, status, index
|
||||
* manipulation, etc).
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param workdir The path to a working directory
|
||||
* @param update_gitlink Create/update gitlink in workdir and set config
|
||||
* "core.worktree" (if workdir is not the parent of the .git directory)
|
||||
* @return 0, or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_set_workdir(
|
||||
git_repository *repo, const char *workdir, int update_gitlink);
|
||||
|
||||
/**
|
||||
* Check if a repository is bare
|
||||
*
|
||||
* @param repo Repo to test
|
||||
* @return 1 if the repository is bare, 0 otherwise.
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_is_bare(git_repository *repo);
|
||||
|
||||
/**
|
||||
* Get the configuration file for this repository.
|
||||
*
|
||||
* If a configuration file has not been set, the default
|
||||
* config set for the repository will be returned, including
|
||||
* global and system configurations (if they are available).
|
||||
*
|
||||
* The configuration file must be freed once it's no longer
|
||||
* being used by the user.
|
||||
*
|
||||
* @param out Pointer to store the loaded config file
|
||||
* @param repo A repository object
|
||||
* @return 0, or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_config(git_config **out, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Set the configuration file for this repository
|
||||
*
|
||||
* This configuration file will be used for all configuration
|
||||
* queries involving this repository.
|
||||
*
|
||||
* The repository will keep a reference to the config file;
|
||||
* the user must still free the config after setting it
|
||||
* to the repository, or it will leak.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param config A Config object
|
||||
*/
|
||||
GIT_EXTERN(void) git_repository_set_config(git_repository *repo, git_config *config);
|
||||
|
||||
/**
|
||||
* Get the Object Database for this repository.
|
||||
*
|
||||
* If a custom ODB has not been set, the default
|
||||
* database for the repository will be returned (the one
|
||||
* located in `.git/objects`).
|
||||
*
|
||||
* The ODB must be freed once it's no longer being used by
|
||||
* the user.
|
||||
*
|
||||
* @param out Pointer to store the loaded ODB
|
||||
* @param repo A repository object
|
||||
* @return 0, or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_odb(git_odb **out, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Set the Object Database for this repository
|
||||
*
|
||||
* The ODB will be used for all object-related operations
|
||||
* involving this repository.
|
||||
*
|
||||
* The repository will keep a reference to the ODB; the user
|
||||
* must still free the ODB object after setting it to the
|
||||
* repository, or it will leak.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param odb An ODB object
|
||||
*/
|
||||
GIT_EXTERN(void) git_repository_set_odb(git_repository *repo, git_odb *odb);
|
||||
|
||||
/**
|
||||
* Get the Index file for this repository.
|
||||
*
|
||||
* If a custom index has not been set, the default
|
||||
* index for the repository will be returned (the one
|
||||
* located in `.git/index`).
|
||||
*
|
||||
* The index must be freed once it's no longer being used by
|
||||
* the user.
|
||||
*
|
||||
* @param out Pointer to store the loaded index
|
||||
* @param repo A repository object
|
||||
* @return 0, or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_index(git_index **out, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Set the index file for this repository
|
||||
*
|
||||
* This index will be used for all index-related operations
|
||||
* involving this repository.
|
||||
*
|
||||
* The repository will keep a reference to the index file;
|
||||
* the user must still free the index after setting it
|
||||
* to the repository, or it will leak.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param index An index object
|
||||
*/
|
||||
GIT_EXTERN(void) git_repository_set_index(git_repository *repo, git_index *index);
|
||||
|
||||
/**
|
||||
* Retrieve git's prepared message
|
||||
*
|
||||
* Operations such as git revert/cherry-pick/merge with the -n option
|
||||
* stop just short of creating a commit with the changes and save
|
||||
* their prepared message in .git/MERGE_MSG so the next git-commit
|
||||
* execution can present it to the user for them to amend if they
|
||||
* wish.
|
||||
*
|
||||
* Use this function to get the contents of this file. Don't forget to
|
||||
* remove the file after you create the commit.
|
||||
*
|
||||
* @param out Buffer to write data into or NULL to just read required size
|
||||
* @param len Length of buffer in bytes
|
||||
* @param repo Repository to read prepared message from
|
||||
* @return Bytes written to buffer, GIT_ENOTFOUND if no message, or -1 on error
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_message(char *out, size_t len, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Remove git's prepared message.
|
||||
*
|
||||
* Remove the message that `git_repository_message` retrieves.
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_message_remove(git_repository *repo);
|
||||
|
||||
/**
|
||||
* Remove all the metadata associated with an ongoing git merge, including
|
||||
* MERGE_HEAD, MERGE_MSG, etc.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @return 0 on success, or error
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_merge_cleanup(git_repository *repo);
|
||||
|
||||
typedef int (*git_repository_fetchhead_foreach_cb)(const char *ref_name,
|
||||
const char *remote_url,
|
||||
const git_oid *oid,
|
||||
unsigned int is_merge,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Call callback 'callback' for each entry in the given FETCH_HEAD file.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param callback Callback function
|
||||
* @param payload Pointer to callback data (optional)
|
||||
* @return 0 on success, GIT_ENOTFOUND, GIT_EUSER or error
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_fetchhead_foreach(git_repository *repo,
|
||||
git_repository_fetchhead_foreach_cb callback,
|
||||
void *payload);
|
||||
|
||||
typedef int (*git_repository_mergehead_foreach_cb)(const git_oid *oid,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* If a merge is in progress, call callback 'cb' for each commit ID in the
|
||||
* MERGE_HEAD file.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param callback Callback function
|
||||
* @param apyload Pointer to callback data (optional)
|
||||
* @return 0 on success, GIT_ENOTFOUND, GIT_EUSER or error
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_mergehead_foreach(git_repository *repo,
|
||||
git_repository_mergehead_foreach_cb callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Calculate hash of file using repository filtering rules.
|
||||
*
|
||||
* If you simply want to calculate the hash of a file on disk with no filters,
|
||||
* you can just use the `git_odb_hashfile()` API. However, if you want to
|
||||
* hash a file in the repository and you want to apply filtering rules (e.g.
|
||||
* crlf filters) before generating the SHA, then use this function.
|
||||
*
|
||||
* @param out Output value of calculated SHA
|
||||
* @param repo Repository pointer
|
||||
* @param path Path to file on disk whose contents should be hashed. If the
|
||||
* repository is not NULL, this can be a relative path.
|
||||
* @param type The object type to hash as (e.g. GIT_OBJ_BLOB)
|
||||
* @param as_path The path to use to look up filtering rules. If this is
|
||||
* NULL, then the `path` parameter will be used instead. If
|
||||
* this is passed as the empty string, then no filters will be
|
||||
* applied when calculating the hash.
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_hashfile(
|
||||
git_oid *out,
|
||||
git_repository *repo,
|
||||
const char *path,
|
||||
git_otype type,
|
||||
const char *as_path);
|
||||
|
||||
/**
|
||||
* Make the repository HEAD point to the specified reference.
|
||||
*
|
||||
* If the provided reference points to a Tree or a Blob, the HEAD is
|
||||
* unaltered and -1 is returned.
|
||||
*
|
||||
* If the provided reference points to a branch, the HEAD will point
|
||||
* to that branch, staying attached, or become attached if it isn't yet.
|
||||
* If the branch doesn't exist yet, no error will be return. The HEAD
|
||||
* will then be attached to an unborn branch.
|
||||
*
|
||||
* Otherwise, the HEAD will be detached and will directly point to
|
||||
* the Commit.
|
||||
*
|
||||
* @param repo Repository pointer
|
||||
* @param refname Canonical name of the reference the HEAD should point at
|
||||
* @return 0 on success, or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_set_head(
|
||||
git_repository* repo,
|
||||
const char* refname);
|
||||
|
||||
/**
|
||||
* Make the repository HEAD directly point to the Commit.
|
||||
*
|
||||
* If the provided committish cannot be found in the repository, the HEAD
|
||||
* is unaltered and GIT_ENOTFOUND is returned.
|
||||
*
|
||||
* If the provided commitish cannot be peeled into a commit, the HEAD
|
||||
* is unaltered and -1 is returned.
|
||||
*
|
||||
* Otherwise, the HEAD will eventually be detached and will directly point to
|
||||
* the peeled Commit.
|
||||
*
|
||||
* @param repo Repository pointer
|
||||
* @param commitish Object id of the Commit the HEAD should point to
|
||||
* @return 0 on success, or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_set_head_detached(
|
||||
git_repository* repo,
|
||||
const git_oid* commitish);
|
||||
|
||||
/**
|
||||
* Detach the HEAD.
|
||||
*
|
||||
* If the HEAD is already detached and points to a Commit, 0 is returned.
|
||||
*
|
||||
* If the HEAD is already detached and points to a Tag, the HEAD is
|
||||
* updated into making it point to the peeled Commit, and 0 is returned.
|
||||
*
|
||||
* If the HEAD is already detached and points to a non commitish, the HEAD is
|
||||
* unaltered, and -1 is returned.
|
||||
*
|
||||
* Otherwise, the HEAD will be detached and point to the peeled Commit.
|
||||
*
|
||||
* @param repo Repository pointer
|
||||
* @return 0 on success, GIT_EORPHANEDHEAD when HEAD points to a non existing
|
||||
* branch or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_detach_head(
|
||||
git_repository* repo);
|
||||
|
||||
typedef enum {
|
||||
GIT_REPOSITORY_STATE_NONE,
|
||||
GIT_REPOSITORY_STATE_MERGE,
|
||||
GIT_REPOSITORY_STATE_REVERT,
|
||||
GIT_REPOSITORY_STATE_CHERRY_PICK,
|
||||
GIT_REPOSITORY_STATE_BISECT,
|
||||
GIT_REPOSITORY_STATE_REBASE,
|
||||
GIT_REPOSITORY_STATE_REBASE_INTERACTIVE,
|
||||
GIT_REPOSITORY_STATE_REBASE_MERGE,
|
||||
GIT_REPOSITORY_STATE_APPLY_MAILBOX,
|
||||
GIT_REPOSITORY_STATE_APPLY_MAILBOX_OR_REBASE,
|
||||
} git_repository_state_t;
|
||||
|
||||
/**
|
||||
* Determines the status of a git repository - ie, whether an operation
|
||||
* (merge, cherry-pick, etc) is in progress.
|
||||
*
|
||||
* @param repo Repository pointer
|
||||
* @return The state of the repository
|
||||
*/
|
||||
GIT_EXTERN(int) git_repository_state(git_repository *repo);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_reset_h__
|
||||
#define INCLUDE_git_reset_h__
|
||||
|
||||
/**
|
||||
* @file git2/reset.h
|
||||
* @brief Git reset management routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Kinds of reset operation
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_RESET_SOFT = 1, /** Move the head to the given commit */
|
||||
GIT_RESET_MIXED = 2, /** SOFT plus reset index to the commit */
|
||||
GIT_RESET_HARD = 3, /** MIXED plus changes in working tree discarded */
|
||||
} git_reset_t;
|
||||
|
||||
/**
|
||||
* Sets the current head to the specified commit oid and optionally
|
||||
* resets the index and working tree to match.
|
||||
*
|
||||
* SOFT reset means the head will be moved to the commit.
|
||||
*
|
||||
* MIXED reset will trigger a SOFT reset, plus the index will be replaced
|
||||
* with the content of the commit tree.
|
||||
*
|
||||
* HARD reset will trigger a MIXED reset and the working directory will be
|
||||
* replaced with the content of the index. (Untracked and ignored files
|
||||
* will be left alone, however.)
|
||||
*
|
||||
* TODO: Implement remaining kinds of resets.
|
||||
*
|
||||
* @param repo Repository where to perform the reset operation.
|
||||
*
|
||||
* @param target Object to which the Head should be moved to. This object
|
||||
* must belong to the given `repo` and can either be a git_commit or a
|
||||
* git_tag. When a git_tag is being passed, it should be dereferencable
|
||||
* to a git_commit which oid will be used as the target of the branch.
|
||||
*
|
||||
* @param reset_type Kind of reset operation to perform.
|
||||
*
|
||||
* @return 0 on success or an error code < 0
|
||||
*/
|
||||
GIT_EXTERN(int) git_reset(
|
||||
git_repository *repo, git_object *target, git_reset_t reset_type);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_revparse_h__
|
||||
#define INCLUDE_git_revparse_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
|
||||
|
||||
/**
|
||||
* @file git2/revparse.h
|
||||
* @brief Git revision parsing routines
|
||||
* @defgroup git_revparse Git revision parsing routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Find an object, as specified by a revision string. See `man gitrevisions`, or the documentation
|
||||
* for `git rev-parse` for information on the syntax accepted.
|
||||
*
|
||||
* @param out pointer to output object
|
||||
* @param repo the repository to search in
|
||||
* @param spec the textual specification for an object
|
||||
* @return 0 on success, GIT_ENOTFOUND, GIT_EAMBIGUOUS,
|
||||
* GIT_EINVALIDSPEC or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_revparse_single(git_object **out, git_repository *repo, const char *spec);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,237 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_revwalk_h__
|
||||
#define INCLUDE_git_revwalk_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
|
||||
/**
|
||||
* @file git2/revwalk.h
|
||||
* @brief Git revision traversal routines
|
||||
* @defgroup git_revwalk Git revision traversal routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Sort the repository contents in no particular ordering;
|
||||
* this sorting is arbitrary, implementation-specific
|
||||
* and subject to change at any time.
|
||||
* This is the default sorting for new walkers.
|
||||
*/
|
||||
#define GIT_SORT_NONE (0)
|
||||
|
||||
/**
|
||||
* Sort the repository contents in topological order
|
||||
* (parents before children); this sorting mode
|
||||
* can be combined with time sorting.
|
||||
*/
|
||||
#define GIT_SORT_TOPOLOGICAL (1 << 0)
|
||||
|
||||
/**
|
||||
* Sort the repository contents by commit time;
|
||||
* this sorting mode can be combined with
|
||||
* topological sorting.
|
||||
*/
|
||||
#define GIT_SORT_TIME (1 << 1)
|
||||
|
||||
/**
|
||||
* Iterate through the repository contents in reverse
|
||||
* order; this sorting mode can be combined with
|
||||
* any of the above.
|
||||
*/
|
||||
#define GIT_SORT_REVERSE (1 << 2)
|
||||
|
||||
/**
|
||||
* Allocate a new revision walker to iterate through a repo.
|
||||
*
|
||||
* This revision walker uses a custom memory pool and an internal
|
||||
* commit cache, so it is relatively expensive to allocate.
|
||||
*
|
||||
* For maximum performance, this revision walker should be
|
||||
* reused for different walks.
|
||||
*
|
||||
* This revision walker is *not* thread safe: it may only be
|
||||
* used to walk a repository on a single thread; however,
|
||||
* it is possible to have several revision walkers in
|
||||
* several different threads walking the same repository.
|
||||
*
|
||||
* @param out pointer to the new revision walker
|
||||
* @param repo the repo to walk through
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_revwalk_new(git_revwalk **out, git_repository *repo);
|
||||
|
||||
/**
|
||||
* Reset the revision walker for reuse.
|
||||
*
|
||||
* This will clear all the pushed and hidden commits, and
|
||||
* leave the walker in a blank state (just like at
|
||||
* creation) ready to receive new commit pushes and
|
||||
* start a new walk.
|
||||
*
|
||||
* The revision walk is automatically reset when a walk
|
||||
* is over.
|
||||
*
|
||||
* @param walker handle to reset.
|
||||
*/
|
||||
GIT_EXTERN(void) git_revwalk_reset(git_revwalk *walker);
|
||||
|
||||
/**
|
||||
* Mark a commit to start traversal from.
|
||||
*
|
||||
* The given OID must belong to a commit on the walked
|
||||
* repository.
|
||||
*
|
||||
* The given commit will be used as one of the roots
|
||||
* when starting the revision walk. At least one commit
|
||||
* must be pushed the repository before a walk can
|
||||
* be started.
|
||||
*
|
||||
* @param walk the walker being used for the traversal.
|
||||
* @param id the oid of the commit to start from.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_revwalk_push(git_revwalk *walk, const git_oid *id);
|
||||
|
||||
/**
|
||||
* Push matching references
|
||||
*
|
||||
* The OIDs pointed to by the references that match the given glob
|
||||
* pattern will be pushed to the revision walker.
|
||||
*
|
||||
* A leading 'refs/' is implied if not present as well as a trailing
|
||||
* '/ *' if the glob lacks '?', '*' or '['.
|
||||
*
|
||||
* @param walk the walker being used for the traversal
|
||||
* @param glob the glob pattern references should match
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_revwalk_push_glob(git_revwalk *walk, const char *glob);
|
||||
|
||||
/**
|
||||
* Push the repository's HEAD
|
||||
*
|
||||
* @param walk the walker being used for the traversal
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_revwalk_push_head(git_revwalk *walk);
|
||||
|
||||
/**
|
||||
* Mark a commit (and its ancestors) uninteresting for the output.
|
||||
*
|
||||
* The given OID must belong to a commit on the walked
|
||||
* repository.
|
||||
*
|
||||
* The resolved commit and all its parents will be hidden from the
|
||||
* output on the revision walk.
|
||||
*
|
||||
* @param walk the walker being used for the traversal.
|
||||
* @param commit_id the oid of commit that will be ignored during the traversal
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_revwalk_hide(git_revwalk *walk, const git_oid *commit_id);
|
||||
|
||||
/**
|
||||
* Hide matching references.
|
||||
*
|
||||
* The OIDs pointed to by the references that match the given glob
|
||||
* pattern and their ancestors will be hidden from the output on the
|
||||
* revision walk.
|
||||
*
|
||||
* A leading 'refs/' is implied if not present as well as a trailing
|
||||
* '/ *' if the glob lacks '?', '*' or '['.
|
||||
*
|
||||
* @param walk the walker being used for the traversal
|
||||
* @param glob the glob pattern references should match
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_revwalk_hide_glob(git_revwalk *walk, const char *glob);
|
||||
|
||||
/**
|
||||
* Hide the repository's HEAD
|
||||
*
|
||||
* @param walk the walker being used for the traversal
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_revwalk_hide_head(git_revwalk *walk);
|
||||
|
||||
/**
|
||||
* Push the OID pointed to by a reference
|
||||
*
|
||||
* The reference must point to a commit.
|
||||
*
|
||||
* @param walk the walker being used for the traversal
|
||||
* @param refname the reference to push
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_revwalk_push_ref(git_revwalk *walk, const char *refname);
|
||||
|
||||
/**
|
||||
* Hide the OID pointed to by a reference
|
||||
*
|
||||
* The reference must point to a commit.
|
||||
*
|
||||
* @param walk the walker being used for the traversal
|
||||
* @param refname the reference to hide
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_revwalk_hide_ref(git_revwalk *walk, const char *refname);
|
||||
|
||||
/**
|
||||
* Get the next commit from the revision walk.
|
||||
*
|
||||
* The initial call to this method is *not* blocking when
|
||||
* iterating through a repo with a time-sorting mode.
|
||||
*
|
||||
* Iterating with Topological or inverted modes makes the initial
|
||||
* call blocking to preprocess the commit list, but this block should be
|
||||
* mostly unnoticeable on most repositories (topological preprocessing
|
||||
* times at 0.3s on the git.git repo).
|
||||
*
|
||||
* The revision walker is reset when the walk is over.
|
||||
*
|
||||
* @param out Pointer where to store the oid of the next commit
|
||||
* @param walk the walker to pop the commit from.
|
||||
* @return 0 if the next commit was found;
|
||||
* GIT_ITEROVER if there are no commits left to iterate
|
||||
*/
|
||||
GIT_EXTERN(int) git_revwalk_next(git_oid *out, git_revwalk *walk);
|
||||
|
||||
/**
|
||||
* Change the sorting mode when iterating through the
|
||||
* repository's contents.
|
||||
*
|
||||
* Changing the sorting mode resets the walker.
|
||||
*
|
||||
* @param walk the walker being used for the traversal.
|
||||
* @param sort_mode combination of GIT_SORT_XXX flags
|
||||
*/
|
||||
GIT_EXTERN(void) git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode);
|
||||
|
||||
/**
|
||||
* Free a revision walker previously allocated.
|
||||
*
|
||||
* @param walk traversal handle to close. If NULL nothing occurs.
|
||||
*/
|
||||
GIT_EXTERN(void) git_revwalk_free(git_revwalk *walk);
|
||||
|
||||
/**
|
||||
* Return the repository on which this walker
|
||||
* is operating.
|
||||
*
|
||||
* @param walk the revision walker
|
||||
* @return the repository being walked
|
||||
*/
|
||||
GIT_EXTERN(git_repository *) git_revwalk_repository(git_revwalk *walk);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_signature_h__
|
||||
#define INCLUDE_git_signature_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* @file git2/signature.h
|
||||
* @brief Git signature creation
|
||||
* @defgroup git_signature Git signature creation
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Create a new action signature.
|
||||
*
|
||||
* Call `git_signature_free()` to free the data.
|
||||
*
|
||||
* Note: angle brackets ('<' and '>') characters are not allowed
|
||||
* to be used in either the `name` or the `email` parameter.
|
||||
*
|
||||
* @param out new signature, in case of error NULL
|
||||
* @param name name of the person
|
||||
* @param email email of the person
|
||||
* @param time time when the action happened
|
||||
* @param offset timezone offset in minutes for the time
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_signature_new(git_signature **out, const char *name, const char *email, git_time_t time, int offset);
|
||||
|
||||
/**
|
||||
* Create a new action signature with a timestamp of 'now'.
|
||||
*
|
||||
* Call `git_signature_free()` to free the data.
|
||||
*
|
||||
* @param out new signature, in case of error NULL
|
||||
* @param name name of the person
|
||||
* @param email email of the person
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_signature_now(git_signature **out, const char *name, const char *email);
|
||||
|
||||
|
||||
/**
|
||||
* Create a copy of an existing signature. All internal strings are also
|
||||
* duplicated.
|
||||
*
|
||||
* Call `git_signature_free()` to free the data.
|
||||
*
|
||||
* @param sig signature to duplicated
|
||||
* @return a copy of sig, NULL on out of memory
|
||||
*/
|
||||
GIT_EXTERN(git_signature *) git_signature_dup(const git_signature *sig);
|
||||
|
||||
/**
|
||||
* Free an existing signature.
|
||||
*
|
||||
* Because the signature is not an opaque structure, it is legal to free it
|
||||
* manually, but be sure to free the "name" and "email" strings in addition
|
||||
* to the structure itself.
|
||||
*
|
||||
* @param sig signature to free
|
||||
*/
|
||||
GIT_EXTERN(void) git_signature_free(git_signature *sig);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,121 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_stash_h__
|
||||
#define INCLUDE_git_stash_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* @file git2/stash.h
|
||||
* @brief Git stash management routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
typedef enum {
|
||||
GIT_STASH_DEFAULT = 0,
|
||||
|
||||
/* All changes already added to the index
|
||||
* are left intact in the working directory
|
||||
*/
|
||||
GIT_STASH_KEEP_INDEX = (1 << 0),
|
||||
|
||||
/* All untracked files are also stashed and then
|
||||
* cleaned up from the working directory
|
||||
*/
|
||||
GIT_STASH_INCLUDE_UNTRACKED = (1 << 1),
|
||||
|
||||
/* All ignored files are also stashed and then
|
||||
* cleaned up from the working directory
|
||||
*/
|
||||
GIT_STASH_INCLUDE_IGNORED = (1 << 2),
|
||||
} git_stash_flags;
|
||||
|
||||
/**
|
||||
* Save the local modifications to a new stash.
|
||||
*
|
||||
* @param out Object id of the commit containing the stashed state.
|
||||
* This commit is also the target of the direct reference refs/stash.
|
||||
*
|
||||
* @param repo The owning repository.
|
||||
*
|
||||
* @param stasher The identity of the person performing the stashing.
|
||||
*
|
||||
* @param message Optional description along with the stashed state.
|
||||
*
|
||||
* @param flags Flags to control the stashing process. (see GIT_STASH_* above)
|
||||
*
|
||||
* @return 0 on success, GIT_ENOTFOUND where there's nothing to stash,
|
||||
* or error code.
|
||||
*/
|
||||
GIT_EXTERN(int) git_stash_save(
|
||||
git_oid *out,
|
||||
git_repository *repo,
|
||||
git_signature *stasher,
|
||||
const char *message,
|
||||
unsigned int flags);
|
||||
|
||||
/**
|
||||
* When iterating over all the stashed states, callback that will be
|
||||
* issued per entry.
|
||||
*
|
||||
* @param index The position within the stash list. 0 points to the
|
||||
* most recent stashed state.
|
||||
*
|
||||
* @param message The stash message.
|
||||
*
|
||||
* @param stash_id The commit oid of the stashed state.
|
||||
*
|
||||
* @param payload Extra parameter to callback function.
|
||||
*
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
typedef int (*git_stash_cb)(
|
||||
size_t index,
|
||||
const char* message,
|
||||
const git_oid *stash_id,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Loop over all the stashed states and issue a callback for each one.
|
||||
*
|
||||
* If the callback returns a non-zero value, this will stop looping.
|
||||
*
|
||||
* @param repo Repository where to find the stash.
|
||||
*
|
||||
* @param callabck Callback to invoke per found stashed state. The most recent
|
||||
* stash state will be enumerated first.
|
||||
*
|
||||
* @param payload Extra parameter to callback function.
|
||||
*
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_stash_foreach(
|
||||
git_repository *repo,
|
||||
git_stash_cb callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Remove a single stashed state from the stash list.
|
||||
*
|
||||
* @param repo The owning repository.
|
||||
*
|
||||
* @param index The position within the stash list. 0 points to the
|
||||
* most recent stashed state.
|
||||
*
|
||||
* @return 0 on success, or error code
|
||||
*/
|
||||
|
||||
GIT_EXTERN(int) git_stash_drop(
|
||||
git_repository *repo,
|
||||
size_t index);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,231 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_status_h__
|
||||
#define INCLUDE_git_status_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* @file git2/status.h
|
||||
* @brief Git file status routines
|
||||
* @defgroup git_status Git file status routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Status flags for a single file.
|
||||
*
|
||||
* A combination of these values will be returned to indicate the status of
|
||||
* a file. Status compares the working directory, the index, and the
|
||||
* current HEAD of the repository. The `GIT_STATUS_INDEX` set of flags
|
||||
* represents the status of file in the index relative to the HEAD, and the
|
||||
* `GIT_STATUS_WT` set of flags represent the status of the file in the
|
||||
* working directory relative to the index.
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_STATUS_CURRENT = 0,
|
||||
|
||||
GIT_STATUS_INDEX_NEW = (1u << 0),
|
||||
GIT_STATUS_INDEX_MODIFIED = (1u << 1),
|
||||
GIT_STATUS_INDEX_DELETED = (1u << 2),
|
||||
GIT_STATUS_INDEX_RENAMED = (1u << 3),
|
||||
GIT_STATUS_INDEX_TYPECHANGE = (1u << 4),
|
||||
|
||||
GIT_STATUS_WT_NEW = (1u << 7),
|
||||
GIT_STATUS_WT_MODIFIED = (1u << 8),
|
||||
GIT_STATUS_WT_DELETED = (1u << 9),
|
||||
GIT_STATUS_WT_TYPECHANGE = (1u << 10),
|
||||
|
||||
GIT_STATUS_IGNORED = (1u << 14),
|
||||
} git_status_t;
|
||||
|
||||
/**
|
||||
* Function pointer to receive status on individual files
|
||||
*
|
||||
* `path` is the relative path to the file from the root of the repository.
|
||||
*
|
||||
* `status_flags` is a combination of `git_status_t` values that apply.
|
||||
*
|
||||
* `payload` is the value you passed to the foreach function as payload.
|
||||
*/
|
||||
typedef int (*git_status_cb)(
|
||||
const char *path, unsigned int status_flags, void *payload);
|
||||
|
||||
/**
|
||||
* Gather file statuses and run a callback for each one.
|
||||
*
|
||||
* The callback is passed the path of the file, the status (a combination of
|
||||
* the `git_status_t` values above) and the `payload` data pointer passed
|
||||
* into this function.
|
||||
*
|
||||
* If the callback returns a non-zero value, this function will stop looping
|
||||
* and return GIT_EUSER.
|
||||
*
|
||||
* @param repo A repository object
|
||||
* @param callback The function to call on each file
|
||||
* @param payload Pointer to pass through to callback function
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_status_foreach(
|
||||
git_repository *repo,
|
||||
git_status_cb callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* For extended status, select the files on which to report status.
|
||||
*
|
||||
* - GIT_STATUS_SHOW_INDEX_AND_WORKDIR is the default. This is the
|
||||
* rough equivalent of `git status --porcelain` where each file
|
||||
* will receive a callback indicating its status in the index and
|
||||
* in the workdir.
|
||||
* - GIT_STATUS_SHOW_INDEX_ONLY will only make callbacks for index
|
||||
* side of status. The status of the index contents relative to
|
||||
* the HEAD will be given.
|
||||
* - GIT_STATUS_SHOW_WORKDIR_ONLY will only make callbacks for the
|
||||
* workdir side of status, reporting the status of workdir content
|
||||
* relative to the index.
|
||||
* - GIT_STATUS_SHOW_INDEX_THEN_WORKDIR behaves like index-only
|
||||
* followed by workdir-only, causing two callbacks to be issued
|
||||
* per file (first index then workdir). This is slightly more
|
||||
* efficient than making separate calls. This makes it easier to
|
||||
* emulate the output of a plain `git status`.
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_STATUS_SHOW_INDEX_AND_WORKDIR = 0,
|
||||
GIT_STATUS_SHOW_INDEX_ONLY = 1,
|
||||
GIT_STATUS_SHOW_WORKDIR_ONLY = 2,
|
||||
GIT_STATUS_SHOW_INDEX_THEN_WORKDIR = 3,
|
||||
} git_status_show_t;
|
||||
|
||||
/**
|
||||
* Flags to control status callbacks
|
||||
*
|
||||
* - GIT_STATUS_OPT_INCLUDE_UNTRACKED says that callbacks should be made
|
||||
* on untracked files. These will only be made if the workdir files are
|
||||
* included in the status "show" option.
|
||||
* - GIT_STATUS_OPT_INCLUDE_IGNORED says that ignored files should get
|
||||
* callbacks. Again, these callbacks will only be made if the workdir
|
||||
* files are included in the status "show" option. Right now, there is
|
||||
* no option to include all files in directories that are ignored
|
||||
* completely.
|
||||
* - GIT_STATUS_OPT_INCLUDE_UNMODIFIED indicates that callback should be
|
||||
* made even on unmodified files.
|
||||
* - GIT_STATUS_OPT_EXCLUDE_SUBMODULES indicates that directories which
|
||||
* appear to be submodules should just be skipped over.
|
||||
* - GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS indicates that the contents of
|
||||
* untracked directories should be included in the status. Normally if
|
||||
* an entire directory is new, then just the top-level directory will be
|
||||
* included (with a trailing slash on the entry name). Given this flag,
|
||||
* the directory itself will not be included, but all the files in it
|
||||
* will.
|
||||
* - GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH indicates that the given path
|
||||
* will be treated as a literal path, and not as a pathspec.
|
||||
*
|
||||
* Calling `git_status_foreach()` is like calling the extended version
|
||||
* with: GIT_STATUS_OPT_INCLUDE_IGNORED, GIT_STATUS_OPT_INCLUDE_UNTRACKED,
|
||||
* and GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS.
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_STATUS_OPT_INCLUDE_UNTRACKED = (1 << 0),
|
||||
GIT_STATUS_OPT_INCLUDE_IGNORED = (1 << 1),
|
||||
GIT_STATUS_OPT_INCLUDE_UNMODIFIED = (1 << 2),
|
||||
GIT_STATUS_OPT_EXCLUDE_SUBMODULES = (1 << 3),
|
||||
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS = (1 << 4),
|
||||
GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH = (1 << 5),
|
||||
} git_status_opt_t;
|
||||
|
||||
/**
|
||||
* Options to control how `git_status_foreach_ext()` will issue callbacks.
|
||||
*
|
||||
* This structure is set so that zeroing it out will give you relatively
|
||||
* sane defaults.
|
||||
*
|
||||
* The `show` value is one of the `git_status_show_t` constants that
|
||||
* control which files to scan and in what order.
|
||||
*
|
||||
* The `flags` value is an OR'ed combination of the `git_status_opt_t`
|
||||
* values above.
|
||||
*
|
||||
* The `pathspec` is an array of path patterns to match (using
|
||||
* fnmatch-style matching), or just an array of paths to match exactly if
|
||||
* `GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH` is specified in the flags.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int version;
|
||||
git_status_show_t show;
|
||||
unsigned int flags;
|
||||
git_strarray pathspec;
|
||||
} git_status_options;
|
||||
|
||||
#define GIT_STATUS_OPTIONS_VERSION 1
|
||||
#define GIT_STATUS_OPTIONS_INIT {GIT_STATUS_OPTIONS_VERSION}
|
||||
|
||||
/**
|
||||
* Gather file status information and run callbacks as requested.
|
||||
*
|
||||
* This is an extended version of the `git_status_foreach()` API that
|
||||
* allows for more granular control over which paths will be processed and
|
||||
* in what order. See the `git_status_options` structure for details
|
||||
* about the additional controls that this makes available.
|
||||
*
|
||||
* @param repo Repository object
|
||||
* @param opts Status options structure
|
||||
* @param callback The function to call on each file
|
||||
* @param payload Pointer to pass through to callback function
|
||||
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_status_foreach_ext(
|
||||
git_repository *repo,
|
||||
const git_status_options *opts,
|
||||
git_status_cb callback,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Get file status for a single file.
|
||||
*
|
||||
* This is not quite the same as calling `git_status_foreach_ext()` with
|
||||
* the pathspec set to the specified path.
|
||||
*
|
||||
* @param status_flags The status value for the file
|
||||
* @param repo A repository object
|
||||
* @param path The file to retrieve status for, rooted at the repo's workdir
|
||||
* @return 0 on success, GIT_ENOTFOUND if the file is not found in the HEAD,
|
||||
* index, and work tree, GIT_EINVALIDPATH if `path` points at a folder,
|
||||
* GIT_EAMBIGUOUS if "path" matches multiple files, -1 on other error.
|
||||
*/
|
||||
GIT_EXTERN(int) git_status_file(
|
||||
unsigned int *status_flags,
|
||||
git_repository *repo,
|
||||
const char *path);
|
||||
|
||||
/**
|
||||
* Test if the ignore rules apply to a given file.
|
||||
*
|
||||
* This function checks the ignore rules to see if they would apply to the
|
||||
* given file. This indicates if the file would be ignored regardless of
|
||||
* whether the file is already in the index or committed to the repository.
|
||||
*
|
||||
* One way to think of this is if you were to do "git add ." on the
|
||||
* directory containing the file, would it be added or not?
|
||||
*
|
||||
* @param ignored Boolean returning 0 if the file is not ignored, 1 if it is
|
||||
* @param repo A repository object
|
||||
* @param path The file to check ignores for, rooted at the repo's workdir.
|
||||
* @return 0 if ignore rules could be processed for the file (regardless
|
||||
* of whether it exists or not), or an error < 0 if they could not.
|
||||
*/
|
||||
GIT_EXTERN(int) git_status_should_ignore(
|
||||
int *ignored,
|
||||
git_repository *repo,
|
||||
const char *path);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_strarray_h__
|
||||
#define INCLUDE_git_strarray_h__
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* @file git2/strarray.h
|
||||
* @brief Git string array routines
|
||||
* @defgroup git_strarray Git string array routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/** Array of strings */
|
||||
typedef struct git_strarray {
|
||||
char **strings;
|
||||
size_t count;
|
||||
} git_strarray;
|
||||
|
||||
/**
|
||||
* Close a string array object
|
||||
*
|
||||
* This method should be called on `git_strarray` objects where the strings
|
||||
* array is allocated and contains allocated strings, such as what you
|
||||
* would get from `git_strarray_copy()`. Not doing so, will result in a
|
||||
* memory leak.
|
||||
*
|
||||
* This does not free the `git_strarray` itself, since the library will
|
||||
* never allocate that object directly itself (it is more commonly embedded
|
||||
* inside another struct or created on the stack).
|
||||
*
|
||||
* @param array git_strarray from which to free string data
|
||||
*/
|
||||
GIT_EXTERN(void) git_strarray_free(git_strarray *array);
|
||||
|
||||
/**
|
||||
* Copy a string array object from source to target.
|
||||
*
|
||||
* Note: target is overwritten and hence should be empty,
|
||||
* otherwise its contents are leaked.
|
||||
*
|
||||
* @param tgt target
|
||||
* @param src source
|
||||
* @return 0 on success, < 0 on allocation failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_strarray_copy(git_strarray *tgt, const git_strarray *src);
|
||||
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,527 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_submodule_h__
|
||||
#define INCLUDE_git_submodule_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
|
||||
/**
|
||||
* @file git2/submodule.h
|
||||
* @brief Git submodule management utilities
|
||||
* @defgroup git_submodule Git submodule management routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Opaque structure representing a submodule.
|
||||
*
|
||||
* Submodule support in libgit2 builds a list of known submodules and keeps
|
||||
* it in the repository. The list is built from the .gitmodules file, the
|
||||
* .git/config file, the index, and the HEAD tree. Items in the working
|
||||
* directory that look like submodules (i.e. a git repo) but are not
|
||||
* mentioned in those places won't be tracked.
|
||||
*/
|
||||
typedef struct git_submodule git_submodule;
|
||||
|
||||
/**
|
||||
* Values that could be specified for the update rule of a submodule.
|
||||
*
|
||||
* Use the DEFAULT value if you have altered the update value via
|
||||
* `git_submodule_set_update()` and wish to reset to the original default.
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_SUBMODULE_UPDATE_DEFAULT = -1,
|
||||
GIT_SUBMODULE_UPDATE_CHECKOUT = 0,
|
||||
GIT_SUBMODULE_UPDATE_REBASE = 1,
|
||||
GIT_SUBMODULE_UPDATE_MERGE = 2,
|
||||
GIT_SUBMODULE_UPDATE_NONE = 3
|
||||
} git_submodule_update_t;
|
||||
|
||||
/**
|
||||
* Values that could be specified for how closely to examine the
|
||||
* working directory when getting submodule status.
|
||||
*
|
||||
* Use the DEFUALT value if you have altered the ignore value via
|
||||
* `git_submodule_set_ignore()` and wish to reset to the original value.
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_SUBMODULE_IGNORE_DEFAULT = -1, /* reset to default */
|
||||
GIT_SUBMODULE_IGNORE_NONE = 0, /* any change or untracked == dirty */
|
||||
GIT_SUBMODULE_IGNORE_UNTRACKED = 1, /* dirty if tracked files change */
|
||||
GIT_SUBMODULE_IGNORE_DIRTY = 2, /* only dirty if HEAD moved */
|
||||
GIT_SUBMODULE_IGNORE_ALL = 3 /* never dirty */
|
||||
} git_submodule_ignore_t;
|
||||
|
||||
/**
|
||||
* Return codes for submodule status.
|
||||
*
|
||||
* A combination of these flags will be returned to describe the status of a
|
||||
* submodule. Depending on the "ignore" property of the submodule, some of
|
||||
* the flags may never be returned because they indicate changes that are
|
||||
* supposed to be ignored.
|
||||
*
|
||||
* Submodule info is contained in 4 places: the HEAD tree, the index, config
|
||||
* files (both .git/config and .gitmodules), and the working directory. Any
|
||||
* or all of those places might be missing information about the submodule
|
||||
* depending on what state the repo is in. We consider all four places to
|
||||
* build the combination of status flags.
|
||||
*
|
||||
* There are four values that are not really status, but give basic info
|
||||
* about what sources of submodule data are available. These will be
|
||||
* returned even if ignore is set to "ALL".
|
||||
*
|
||||
* * IN_HEAD - superproject head contains submodule
|
||||
* * IN_INDEX - superproject index contains submodule
|
||||
* * IN_CONFIG - superproject gitmodules has submodule
|
||||
* * IN_WD - superproject workdir has submodule
|
||||
*
|
||||
* The following values will be returned so long as ignore is not "ALL".
|
||||
*
|
||||
* * INDEX_ADDED - in index, not in head
|
||||
* * INDEX_DELETED - in head, not in index
|
||||
* * INDEX_MODIFIED - index and head don't match
|
||||
* * WD_UNINITIALIZED - workdir contains empty directory
|
||||
* * WD_ADDED - in workdir, not index
|
||||
* * WD_DELETED - in index, not workdir
|
||||
* * WD_MODIFIED - index and workdir head don't match
|
||||
*
|
||||
* The following can only be returned if ignore is "NONE" or "UNTRACKED".
|
||||
*
|
||||
* * WD_INDEX_MODIFIED - submodule workdir index is dirty
|
||||
* * WD_WD_MODIFIED - submodule workdir has modified files
|
||||
*
|
||||
* Lastly, the following will only be returned for ignore "NONE".
|
||||
*
|
||||
* * WD_UNTRACKED - wd contains untracked files
|
||||
*/
|
||||
typedef enum {
|
||||
GIT_SUBMODULE_STATUS_IN_HEAD = (1u << 0),
|
||||
GIT_SUBMODULE_STATUS_IN_INDEX = (1u << 1),
|
||||
GIT_SUBMODULE_STATUS_IN_CONFIG = (1u << 2),
|
||||
GIT_SUBMODULE_STATUS_IN_WD = (1u << 3),
|
||||
GIT_SUBMODULE_STATUS_INDEX_ADDED = (1u << 4),
|
||||
GIT_SUBMODULE_STATUS_INDEX_DELETED = (1u << 5),
|
||||
GIT_SUBMODULE_STATUS_INDEX_MODIFIED = (1u << 6),
|
||||
GIT_SUBMODULE_STATUS_WD_UNINITIALIZED = (1u << 7),
|
||||
GIT_SUBMODULE_STATUS_WD_ADDED = (1u << 8),
|
||||
GIT_SUBMODULE_STATUS_WD_DELETED = (1u << 9),
|
||||
GIT_SUBMODULE_STATUS_WD_MODIFIED = (1u << 10),
|
||||
GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED = (1u << 11),
|
||||
GIT_SUBMODULE_STATUS_WD_WD_MODIFIED = (1u << 12),
|
||||
GIT_SUBMODULE_STATUS_WD_UNTRACKED = (1u << 13),
|
||||
} git_submodule_status_t;
|
||||
|
||||
#define GIT_SUBMODULE_STATUS_IS_UNMODIFIED(S) \
|
||||
(((S) & ~(GIT_SUBMODULE_STATUS_IN_HEAD | \
|
||||
GIT_SUBMODULE_STATUS_IN_INDEX | \
|
||||
GIT_SUBMODULE_STATUS_IN_CONFIG | \
|
||||
GIT_SUBMODULE_STATUS_IN_WD)) == 0)
|
||||
|
||||
#define GIT_SUBMODULE_STATUS_IS_WD_DIRTY(S) \
|
||||
(((S) & (GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED | \
|
||||
GIT_SUBMODULE_STATUS_WD_WD_MODIFIED | \
|
||||
GIT_SUBMODULE_STATUS_WD_UNTRACKED)) != 0)
|
||||
|
||||
/**
|
||||
* Lookup submodule information by name or path.
|
||||
*
|
||||
* Given either the submodule name or path (they are usually the same), this
|
||||
* returns a structure describing the submodule.
|
||||
*
|
||||
* There are two expected error scenarios:
|
||||
*
|
||||
* - The submodule is not mentioned in the HEAD, the index, and the config,
|
||||
* but does "exist" in the working directory (i.e. there is a subdirectory
|
||||
* that is a valid self-contained git repo). In this case, this function
|
||||
* returns GIT_EEXISTS to indicate the the submodule exists but not in a
|
||||
* state where a git_submodule can be instantiated.
|
||||
* - The submodule is not mentioned in the HEAD, index, or config and the
|
||||
* working directory doesn't contain a value git repo at that path.
|
||||
* There may or may not be anything else at that path, but nothing that
|
||||
* looks like a submodule. In this case, this returns GIT_ENOTFOUND.
|
||||
*
|
||||
* The submodule object is owned by the containing repo and will be freed
|
||||
* when the repo is freed. The caller need not free the submodule.
|
||||
*
|
||||
* @param submodule Pointer to submodule description object pointer..
|
||||
* @param repo The repository.
|
||||
* @param name The name of the submodule. Trailing slashes will be ignored.
|
||||
* @return 0 on success, GIT_ENOTFOUND if submodule does not exist,
|
||||
* GIT_EEXISTS if submodule exists in working directory only, -1 on
|
||||
* other errors.
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_lookup(
|
||||
git_submodule **submodule,
|
||||
git_repository *repo,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* Iterate over all tracked submodules of a repository.
|
||||
*
|
||||
* See the note on `git_submodule` above. This iterates over the tracked
|
||||
* submodules as decribed therein.
|
||||
*
|
||||
* If you are concerned about items in the working directory that look like
|
||||
* submodules but are not tracked, the diff API will generate a diff record
|
||||
* for workdir items that look like submodules but are not tracked, showing
|
||||
* them as added in the workdir. Also, the status API will treat the entire
|
||||
* subdirectory of a contained git repo as a single GIT_STATUS_WT_NEW item.
|
||||
*
|
||||
* @param repo The repository
|
||||
* @param callback Function to be called with the name of each submodule.
|
||||
* Return a non-zero value to terminate the iteration.
|
||||
* @param payload Extra data to pass to callback
|
||||
* @return 0 on success, -1 on error, or non-zero return value of callback
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_foreach(
|
||||
git_repository *repo,
|
||||
int (*callback)(git_submodule *sm, const char *name, void *payload),
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Set up a new git submodule for checkout.
|
||||
*
|
||||
* This does "git submodule add" up to the fetch and checkout of the
|
||||
* submodule contents. It preps a new submodule, creates an entry in
|
||||
* .gitmodules and creates an empty initialized repository either at the
|
||||
* given path in the working directory or in .git/modules with a gitlink
|
||||
* from the working directory to the new repo.
|
||||
*
|
||||
* To fully emulate "git submodule add" call this function, then open the
|
||||
* submodule repo and perform the clone step as needed. Lastly, call
|
||||
* `git_submodule_add_finalize()` to wrap up adding the new submodule and
|
||||
* .gitmodules to the index to be ready to commit.
|
||||
*
|
||||
* @param submodule The newly created submodule ready to open for clone
|
||||
* @param repo Superproject repository to contain the new submodule
|
||||
* @param url URL for the submodules remote
|
||||
* @param path Path at which the submodule should be created
|
||||
* @param use_gitlink Should workdir contain a gitlink to the repo in
|
||||
* .git/modules vs. repo directly in workdir.
|
||||
* @return 0 on success, GIT_EEXISTS if submodule already exists,
|
||||
* -1 on other errors.
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_add_setup(
|
||||
git_submodule **submodule,
|
||||
git_repository *repo,
|
||||
const char *url,
|
||||
const char *path,
|
||||
int use_gitlink);
|
||||
|
||||
/**
|
||||
* Resolve the setup of a new git submodule.
|
||||
*
|
||||
* This should be called on a submodule once you have called add setup
|
||||
* and done the clone of the submodule. This adds the .gitmodules file
|
||||
* and the newly cloned submodule to the index to be ready to be committed
|
||||
* (but doesn't actually do the commit).
|
||||
*
|
||||
* @param submodule The submodule to finish adding.
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_add_finalize(git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Add current submodule HEAD commit to index of superproject.
|
||||
*
|
||||
* @param submodule The submodule to add to the index
|
||||
* @param write_index Boolean if this should immediately write the index
|
||||
* file. If you pass this as false, you will have to get the
|
||||
* git_index and explicitly call `git_index_write()` on it to
|
||||
* save the change.
|
||||
* @return 0 on success, <0 on failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_add_to_index(
|
||||
git_submodule *submodule,
|
||||
int write_index);
|
||||
|
||||
/**
|
||||
* Write submodule settings to .gitmodules file.
|
||||
*
|
||||
* This commits any in-memory changes to the submodule to the gitmodules
|
||||
* file on disk. You may also be interested in `git_submodule_init()` which
|
||||
* writes submodule info to ".git/config" (which is better for local changes
|
||||
* to submodule settings) and/or `git_submodule_sync()` which writes
|
||||
* settings about remotes to the actual submodule repository.
|
||||
*
|
||||
* @param submodule The submodule to write.
|
||||
* @return 0 on success, <0 on failure.
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_save(git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Get the containing repository for a submodule.
|
||||
*
|
||||
* This returns a pointer to the repository that contains the submodule.
|
||||
* This is a just a reference to the repository that was passed to the
|
||||
* original `git_submodule_lookup()` call, so if that repository has been
|
||||
* freed, then this may be a dangling reference.
|
||||
*
|
||||
* @param submodule Pointer to submodule object
|
||||
* @return Pointer to `git_repository`
|
||||
*/
|
||||
GIT_EXTERN(git_repository *) git_submodule_owner(git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Get the name of submodule.
|
||||
*
|
||||
* @param submodule Pointer to submodule object
|
||||
* @return Pointer to the submodule name
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_submodule_name(git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Get the path to the submodule.
|
||||
*
|
||||
* The path is almost always the same as the submodule name, but the
|
||||
* two are actually not required to match.
|
||||
*
|
||||
* @param submodule Pointer to submodule object
|
||||
* @return Pointer to the submodule path
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_submodule_path(git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Get the URL for the submodule.
|
||||
*
|
||||
* @param submodule Pointer to submodule object
|
||||
* @return Pointer to the submodule url
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_submodule_url(git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Set the URL for the submodule.
|
||||
*
|
||||
* This sets the URL in memory for the submodule. This will be used for
|
||||
* any following submodule actions while this submodule data is in memory.
|
||||
*
|
||||
* After calling this, you may wish to call `git_submodule_save()` to write
|
||||
* the changes back to the ".gitmodules" file and `git_submodule_sync()` to
|
||||
* write the changes to the checked out submodule repository.
|
||||
*
|
||||
* @param submodule Pointer to the submodule object
|
||||
* @param url URL that should be used for the submodule
|
||||
* @return 0 on success, <0 on failure
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_set_url(git_submodule *submodule, const char *url);
|
||||
|
||||
/**
|
||||
* Get the OID for the submodule in the index.
|
||||
*
|
||||
* @param submodule Pointer to submodule object
|
||||
* @return Pointer to git_oid or NULL if submodule is not in index.
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_submodule_index_id(git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Get the OID for the submodule in the current HEAD tree.
|
||||
*
|
||||
* @param submodule Pointer to submodule object
|
||||
* @return Pointer to git_oid or NULL if submodule is not in the HEAD.
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_submodule_head_id(git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Get the OID for the submodule in the current working directory.
|
||||
*
|
||||
* This returns the OID that corresponds to looking up 'HEAD' in the checked
|
||||
* out submodule. If there are pending changes in the index or anything
|
||||
* else, this won't notice that. You should call `git_submodule_status()`
|
||||
* for a more complete picture about the state of the working directory.
|
||||
*
|
||||
* @param submodule Pointer to submodule object
|
||||
* @return Pointer to git_oid or NULL if submodule is not checked out.
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_submodule_wd_id(git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Get the ignore rule for the submodule.
|
||||
*
|
||||
* There are four ignore values:
|
||||
*
|
||||
* - **GIT_SUBMODULE_IGNORE_NONE** will consider any change to the contents
|
||||
* of the submodule from a clean checkout to be dirty, including the
|
||||
* addition of untracked files. This is the default if unspecified.
|
||||
* - **GIT_SUBMODULE_IGNORE_UNTRACKED** examines the contents of the
|
||||
* working tree (i.e. call `git_status_foreach()` on the submodule) but
|
||||
* UNTRACKED files will not count as making the submodule dirty.
|
||||
* - **GIT_SUBMODULE_IGNORE_DIRTY** means to only check if the HEAD of the
|
||||
* submodule has moved for status. This is fast since it does not need to
|
||||
* scan the working tree of the submodule at all.
|
||||
* - **GIT_SUBMODULE_IGNORE_ALL** means not to open the submodule repo.
|
||||
* The working directory will be consider clean so long as there is a
|
||||
* checked out version present.
|
||||
*/
|
||||
GIT_EXTERN(git_submodule_ignore_t) git_submodule_ignore(
|
||||
git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Set the ignore rule for the submodule.
|
||||
*
|
||||
* This sets the ignore rule in memory for the submodule. This will be used
|
||||
* for any following actions (such as `git_submodule_status()`) while the
|
||||
* submodule is in memory. You should call `git_submodule_save()` if you
|
||||
* want to persist the new ignore role.
|
||||
*
|
||||
* Calling this again with GIT_SUBMODULE_IGNORE_DEFAULT or calling
|
||||
* `git_submodule_reload()` will revert the rule to the value that was in the
|
||||
* original config.
|
||||
*
|
||||
* @return old value for ignore
|
||||
*/
|
||||
GIT_EXTERN(git_submodule_ignore_t) git_submodule_set_ignore(
|
||||
git_submodule *submodule,
|
||||
git_submodule_ignore_t ignore);
|
||||
|
||||
/**
|
||||
* Get the update rule for the submodule.
|
||||
*/
|
||||
GIT_EXTERN(git_submodule_update_t) git_submodule_update(
|
||||
git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Set the update rule for the submodule.
|
||||
*
|
||||
* This sets the update rule in memory for the submodule. You should call
|
||||
* `git_submodule_save()` if you want to persist the new update rule.
|
||||
*
|
||||
* Calling this again with GIT_SUBMODULE_UPDATE_DEFAULT or calling
|
||||
* `git_submodule_reload()` will revert the rule to the value that was in the
|
||||
* original config.
|
||||
*
|
||||
* @return old value for update
|
||||
*/
|
||||
GIT_EXTERN(git_submodule_update_t) git_submodule_set_update(
|
||||
git_submodule *submodule,
|
||||
git_submodule_update_t update);
|
||||
|
||||
/**
|
||||
* Read the fetchRecurseSubmodules rule for a submodule.
|
||||
*
|
||||
* This accesses the submodule.<name>.fetchRecurseSubmodules value for
|
||||
* the submodule that controls fetching behavior for the submodule.
|
||||
*
|
||||
* Note that at this time, libgit2 does not honor this setting and the
|
||||
* fetch functionality current ignores submodules.
|
||||
*
|
||||
* @return 0 if fetchRecurseSubmodules is false, 1 if true
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_fetch_recurse_submodules(
|
||||
git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Set the fetchRecurseSubmodules rule for a submodule.
|
||||
*
|
||||
* This sets the submodule.<name>.fetchRecurseSubmodules value for
|
||||
* the submodule. You should call `git_submodule_save()` if you want
|
||||
* to persist the new value.
|
||||
*
|
||||
* @param submodule The submodule to modify
|
||||
* @param fetch_recurse_submodules Boolean value
|
||||
* @return old value for fetchRecurseSubmodules
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_set_fetch_recurse_submodules(
|
||||
git_submodule *submodule,
|
||||
int fetch_recurse_submodules);
|
||||
|
||||
/**
|
||||
* Copy submodule info into ".git/config" file.
|
||||
*
|
||||
* Just like "git submodule init", this copies information about the
|
||||
* submodule into ".git/config". You can use the accessor functions
|
||||
* above to alter the in-memory git_submodule object and control what
|
||||
* is written to the config, overriding what is in .gitmodules.
|
||||
*
|
||||
* @param submodule The submodule to write into the superproject config
|
||||
* @param overwrite By default, existing entries will not be overwritten,
|
||||
* but setting this to true forces them to be updated.
|
||||
* @return 0 on success, <0 on failure.
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_init(git_submodule *submodule, int overwrite);
|
||||
|
||||
/**
|
||||
* Copy submodule remote info into submodule repo.
|
||||
*
|
||||
* This copies the information about the submodules URL into the checked out
|
||||
* submodule config, acting like "git submodule sync". This is useful if
|
||||
* you have altered the URL for the submodule (or it has been altered by a
|
||||
* fetch of upstream changes) and you need to update your local repo.
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_sync(git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Open the repository for a submodule.
|
||||
*
|
||||
* This is a newly opened repository object. The caller is responsible for
|
||||
* calling `git_repository_free()` on it when done. Multiple calls to this
|
||||
* function will return distinct `git_repository` objects. This will only
|
||||
* work if the submodule is checked out into the working directory.
|
||||
*
|
||||
* @param subrepo Pointer to the submodule repo which was opened
|
||||
* @param submodule Submodule to be opened
|
||||
* @return 0 on success, <0 if submodule repo could not be opened.
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_open(
|
||||
git_repository **repo,
|
||||
git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Reread submodule info from config, index, and HEAD.
|
||||
*
|
||||
* Call this to reread cached submodule information for this submodule if
|
||||
* you have reason to believe that it has changed.
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_reload(git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Reread all submodule info.
|
||||
*
|
||||
* Call this to reload all cached submodule information for the repo.
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_reload_all(git_repository *repo);
|
||||
|
||||
/**
|
||||
* Get the status for a submodule.
|
||||
*
|
||||
* This looks at a submodule and tries to determine the status. It
|
||||
* will return a combination of the `GIT_SUBMODULE_STATUS` values above.
|
||||
* How deeply it examines the working directory to do this will depend
|
||||
* on the `git_submodule_ignore_t` value for the submodule - which can be
|
||||
* set either temporarily or permanently with `git_submodule_set_ignore()`.
|
||||
*
|
||||
* @param status Combination of `GIT_SUBMODULE_STATUS` flags
|
||||
* @param submodule Submodule for which to get status
|
||||
* @return 0 on success, <0 on error
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_status(
|
||||
unsigned int *status,
|
||||
git_submodule *submodule);
|
||||
|
||||
/**
|
||||
* Get the locations of submodule information.
|
||||
*
|
||||
* This is a bit like a very lightweight version of `git_submodule_status`.
|
||||
* It just returns a made of the first four submodule status values (i.e.
|
||||
* the ones like GIT_SUBMODULE_STATUS_IN_HEAD, etc) that tell you where the
|
||||
* submodule data comes from (i.e. the HEAD commit, gitmodules file, etc.).
|
||||
* This can be useful if you want to know if the submodule is present in the
|
||||
* working directory at this point in time, etc.
|
||||
*
|
||||
* @param status Combination of first four `GIT_SUBMODULE_STATUS` flags
|
||||
* @param submodule Submodule for which to get status
|
||||
* @return 0 on success, <0 on error
|
||||
*/
|
||||
GIT_EXTERN(int) git_submodule_location(
|
||||
unsigned int *location_status,
|
||||
git_submodule *submodule);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,326 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_tag_h__
|
||||
#define INCLUDE_git_tag_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
#include "object.h"
|
||||
#include "strarray.h"
|
||||
|
||||
/**
|
||||
* @file git2/tag.h
|
||||
* @brief Git tag parsing routines
|
||||
* @defgroup git_tag Git tag management
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Lookup a tag object from the repository.
|
||||
*
|
||||
* @param out pointer to the looked up tag
|
||||
* @param repo the repo to use when locating the tag.
|
||||
* @param id identity of the tag to locate.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_INLINE(int) git_tag_lookup(
|
||||
git_tag **out, git_repository *repo, const git_oid *id)
|
||||
{
|
||||
return git_object_lookup(
|
||||
(git_object **)out, repo, id, (git_otype)GIT_OBJ_TAG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup a tag object from the repository,
|
||||
* given a prefix of its identifier (short id).
|
||||
*
|
||||
* @see git_object_lookup_prefix
|
||||
*
|
||||
* @param out pointer to the looked up tag
|
||||
* @param repo the repo to use when locating the tag.
|
||||
* @param id identity of the tag to locate.
|
||||
* @param len the length of the short identifier
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_INLINE(int) git_tag_lookup_prefix(
|
||||
git_tag **out, git_repository *repo, const git_oid *id, size_t len)
|
||||
{
|
||||
return git_object_lookup_prefix(
|
||||
(git_object **)out, repo, id, len, (git_otype)GIT_OBJ_TAG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close an open tag
|
||||
*
|
||||
* You can no longer use the git_tag pointer after this call.
|
||||
*
|
||||
* IMPORTANT: You MUST call this method when you are through with a tag to
|
||||
* release memory. Failure to do so will cause a memory leak.
|
||||
*
|
||||
* @param tag the tag to close
|
||||
*/
|
||||
|
||||
GIT_INLINE(void) git_tag_free(git_tag *tag)
|
||||
{
|
||||
git_object_free((git_object *)tag);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the id of a tag.
|
||||
*
|
||||
* @param tag a previously loaded tag.
|
||||
* @return object identity for the tag.
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_tag_id(const git_tag *tag);
|
||||
|
||||
/**
|
||||
* Get the tagged object of a tag
|
||||
*
|
||||
* This method performs a repository lookup for the
|
||||
* given object and returns it
|
||||
*
|
||||
* @param target_out pointer where to store the target
|
||||
* @param tag a previously loaded tag.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_tag_target(git_object **target_out, const git_tag *tag);
|
||||
|
||||
/**
|
||||
* Get the OID of the tagged object of a tag
|
||||
*
|
||||
* @param tag a previously loaded tag.
|
||||
* @return pointer to the OID
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_tag_target_id(const git_tag *tag);
|
||||
|
||||
/**
|
||||
* Get the type of a tag's tagged object
|
||||
*
|
||||
* @param tag a previously loaded tag.
|
||||
* @return type of the tagged object
|
||||
*/
|
||||
GIT_EXTERN(git_otype) git_tag_target_type(const git_tag *tag);
|
||||
|
||||
/**
|
||||
* Get the name of a tag
|
||||
*
|
||||
* @param tag a previously loaded tag.
|
||||
* @return name of the tag
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_tag_name(const git_tag *tag);
|
||||
|
||||
/**
|
||||
* Get the tagger (author) of a tag
|
||||
*
|
||||
* @param tag a previously loaded tag.
|
||||
* @return reference to the tag's author
|
||||
*/
|
||||
GIT_EXTERN(const git_signature *) git_tag_tagger(const git_tag *tag);
|
||||
|
||||
/**
|
||||
* Get the message of a tag
|
||||
*
|
||||
* @param tag a previously loaded tag.
|
||||
* @return message of the tag
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_tag_message(const git_tag *tag);
|
||||
|
||||
|
||||
/**
|
||||
* Create a new tag in the repository from an object
|
||||
*
|
||||
* A new reference will also be created pointing to
|
||||
* this tag object. If `force` is true and a reference
|
||||
* already exists with the given name, it'll be replaced.
|
||||
*
|
||||
* The message will not be cleaned up. This can be achieved
|
||||
* through `git_message_prettify()`.
|
||||
*
|
||||
* The tag name will be checked for validity. You must avoid
|
||||
* the characters '~', '^', ':', '\\', '?', '[', and '*', and the
|
||||
* sequences ".." and "@{" which have special meaning to revparse.
|
||||
*
|
||||
* @param oid Pointer where to store the OID of the
|
||||
* newly created tag. If the tag already exists, this parameter
|
||||
* will be the oid of the existing tag, and the function will
|
||||
* return a GIT_EEXISTS error code.
|
||||
*
|
||||
* @param repo Repository where to store the tag
|
||||
*
|
||||
* @param tag_name Name for the tag; this name is validated
|
||||
* for consistency. It should also not conflict with an
|
||||
* already existing tag name
|
||||
*
|
||||
* @param target Object to which this tag points. This object
|
||||
* must belong to the given `repo`.
|
||||
*
|
||||
* @param tagger Signature of the tagger for this tag, and
|
||||
* of the tagging time
|
||||
*
|
||||
* @param message Full message for this tag
|
||||
*
|
||||
* @param force Overwrite existing references
|
||||
*
|
||||
* @return 0 on success, GIT_EINVALIDSPEC or an error code
|
||||
* A tag object is written to the ODB, and a proper reference
|
||||
* is written in the /refs/tags folder, pointing to it
|
||||
*/
|
||||
GIT_EXTERN(int) git_tag_create(
|
||||
git_oid *oid,
|
||||
git_repository *repo,
|
||||
const char *tag_name,
|
||||
const git_object *target,
|
||||
const git_signature *tagger,
|
||||
const char *message,
|
||||
int force);
|
||||
|
||||
/**
|
||||
* Create a new tag in the repository from a buffer
|
||||
*
|
||||
* @param oid Pointer where to store the OID of the newly created tag
|
||||
* @param repo Repository where to store the tag
|
||||
* @param buffer Raw tag data
|
||||
* @param force Overwrite existing tags
|
||||
* @return 0 on success; error code otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_tag_create_frombuffer(
|
||||
git_oid *oid,
|
||||
git_repository *repo,
|
||||
const char *buffer,
|
||||
int force);
|
||||
|
||||
/**
|
||||
* Create a new lightweight tag pointing at a target object
|
||||
*
|
||||
* A new direct reference will be created pointing to
|
||||
* this target object. If `force` is true and a reference
|
||||
* already exists with the given name, it'll be replaced.
|
||||
*
|
||||
* The tag name will be checked for validity.
|
||||
* See `git_tag_create()` for rules about valid names.
|
||||
*
|
||||
* @param oid Pointer where to store the OID of the provided
|
||||
* target object. If the tag already exists, this parameter
|
||||
* will be filled with the oid of the existing pointed object
|
||||
* and the function will return a GIT_EEXISTS error code.
|
||||
*
|
||||
* @param repo Repository where to store the lightweight tag
|
||||
*
|
||||
* @param tag_name Name for the tag; this name is validated
|
||||
* for consistency. It should also not conflict with an
|
||||
* already existing tag name
|
||||
*
|
||||
* @param target Object to which this tag points. This object
|
||||
* must belong to the given `repo`.
|
||||
*
|
||||
* @param force Overwrite existing references
|
||||
*
|
||||
* @return 0 on success, GIT_EINVALIDSPEC or an error code
|
||||
* A proper reference is written in the /refs/tags folder,
|
||||
* pointing to the provided target object
|
||||
*/
|
||||
GIT_EXTERN(int) git_tag_create_lightweight(
|
||||
git_oid *oid,
|
||||
git_repository *repo,
|
||||
const char *tag_name,
|
||||
const git_object *target,
|
||||
int force);
|
||||
|
||||
/**
|
||||
* Delete an existing tag reference.
|
||||
*
|
||||
* The tag name will be checked for validity.
|
||||
* See `git_tag_create()` for rules about valid names.
|
||||
*
|
||||
* @param repo Repository where lives the tag
|
||||
*
|
||||
* @param tag_name Name of the tag to be deleted;
|
||||
* this name is validated for consistency.
|
||||
*
|
||||
* @return 0 on success, GIT_EINVALIDSPEC or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_tag_delete(
|
||||
git_repository *repo,
|
||||
const char *tag_name);
|
||||
|
||||
/**
|
||||
* Fill a list with all the tags in the Repository
|
||||
*
|
||||
* The string array will be filled with the names of the
|
||||
* matching tags; these values are owned by the user and
|
||||
* should be free'd manually when no longer needed, using
|
||||
* `git_strarray_free`.
|
||||
*
|
||||
* @param tag_names Pointer to a git_strarray structure where
|
||||
* the tag names will be stored
|
||||
* @param repo Repository where to find the tags
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_tag_list(
|
||||
git_strarray *tag_names,
|
||||
git_repository *repo);
|
||||
|
||||
/**
|
||||
* Fill a list with all the tags in the Repository
|
||||
* which name match a defined pattern
|
||||
*
|
||||
* If an empty pattern is provided, all the tags
|
||||
* will be returned.
|
||||
*
|
||||
* The string array will be filled with the names of the
|
||||
* matching tags; these values are owned by the user and
|
||||
* should be free'd manually when no longer needed, using
|
||||
* `git_strarray_free`.
|
||||
*
|
||||
* @param tag_names Pointer to a git_strarray structure where
|
||||
* the tag names will be stored
|
||||
* @param pattern Standard fnmatch pattern
|
||||
* @param repo Repository where to find the tags
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_tag_list_match(
|
||||
git_strarray *tag_names,
|
||||
const char *pattern,
|
||||
git_repository *repo);
|
||||
|
||||
|
||||
typedef int (*git_tag_foreach_cb)(const char *name, git_oid *oid, void *payload);
|
||||
|
||||
/**
|
||||
* Call callback `cb' for each tag in the repository
|
||||
*
|
||||
* @param repo Repository
|
||||
* @param callback Callback function
|
||||
* @param payload Pointer to callback data (optional)
|
||||
*/
|
||||
GIT_EXTERN(int) git_tag_foreach(
|
||||
git_repository *repo,
|
||||
git_tag_foreach_cb callback,
|
||||
void *payload);
|
||||
|
||||
|
||||
/**
|
||||
* Recursively peel a tag until a non tag git_object is found
|
||||
*
|
||||
* The retrieved `tag_target` object is owned by the repository
|
||||
* and should be closed with the `git_object_free` method.
|
||||
*
|
||||
* @param tag_target_out Pointer to the peeled git_object
|
||||
* @param tag The tag to be processed
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_tag_peel(
|
||||
git_object **tag_target_out,
|
||||
const git_tag *tag);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_threads_h__
|
||||
#define INCLUDE_git_threads_h__
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* @file git2/threads.h
|
||||
* @brief Library level thread functions
|
||||
* @defgroup git_thread Threading functions
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Init the threading system.
|
||||
*
|
||||
* If libgit2 has been built with GIT_THREADS
|
||||
* on, this function must be called once before
|
||||
* any other library functions.
|
||||
*
|
||||
* If libgit2 has been built without GIT_THREADS
|
||||
* support, this function is a no-op.
|
||||
*
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_threads_init(void);
|
||||
|
||||
/**
|
||||
* Shutdown the threading system.
|
||||
*
|
||||
* If libgit2 has been built with GIT_THREADS
|
||||
* on, this function must be called before shutting
|
||||
* down the library.
|
||||
*
|
||||
* If libgit2 has been built without GIT_THREADS
|
||||
* support, this function is a no-op.
|
||||
*/
|
||||
GIT_EXTERN(void) git_threads_shutdown(void);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
|
||||
@@ -1,331 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_transport_h__
|
||||
#define INCLUDE_git_transport_h__
|
||||
|
||||
#include "indexer.h"
|
||||
#include "net.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* @file git2/transport.h
|
||||
* @brief Git transport interfaces and functions
|
||||
* @defgroup git_transport interfaces and functions
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/*
|
||||
*** Begin interface for credentials acquisition ***
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
/* git_cred_userpass_plaintext */
|
||||
GIT_CREDTYPE_USERPASS_PLAINTEXT = 1,
|
||||
} git_credtype_t;
|
||||
|
||||
/* The base structure for all credential types */
|
||||
typedef struct git_cred {
|
||||
git_credtype_t credtype;
|
||||
void (*free)(
|
||||
struct git_cred *cred);
|
||||
} git_cred;
|
||||
|
||||
/* A plaintext username and password */
|
||||
typedef struct git_cred_userpass_plaintext {
|
||||
git_cred parent;
|
||||
char *username;
|
||||
char *password;
|
||||
} git_cred_userpass_plaintext;
|
||||
|
||||
/**
|
||||
* Creates a new plain-text username and password credential object.
|
||||
*
|
||||
* @param out The newly created credential object.
|
||||
* @param username The username of the credential.
|
||||
* @param password The password of the credential.
|
||||
*/
|
||||
GIT_EXTERN(int) git_cred_userpass_plaintext_new(
|
||||
git_cred **out,
|
||||
const char *username,
|
||||
const char *password);
|
||||
|
||||
/**
|
||||
* Signature of a function which acquires a credential object.
|
||||
*
|
||||
* @param cred The newly created credential object.
|
||||
* @param url The resource for which we are demanding a credential.
|
||||
* @param allowed_types A bitmask stating which cred types are OK to return.
|
||||
*/
|
||||
typedef int (*git_cred_acquire_cb)(
|
||||
git_cred **cred,
|
||||
const char *url,
|
||||
unsigned int allowed_types,
|
||||
void *payload);
|
||||
|
||||
/*
|
||||
*** End interface for credentials acquisition ***
|
||||
*** Begin base transport interface ***
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
GIT_TRANSPORTFLAGS_NONE = 0,
|
||||
/* If the connection is secured with SSL/TLS, the authenticity
|
||||
* of the server certificate should not be verified. */
|
||||
GIT_TRANSPORTFLAGS_NO_CHECK_CERT = 1
|
||||
} git_transport_flags_t;
|
||||
|
||||
typedef void (*git_transport_message_cb)(const char *str, int len, void *data);
|
||||
|
||||
typedef struct git_transport {
|
||||
unsigned int version;
|
||||
/* Set progress and error callbacks */
|
||||
int (*set_callbacks)(struct git_transport *transport,
|
||||
git_transport_message_cb progress_cb,
|
||||
git_transport_message_cb error_cb,
|
||||
void *payload);
|
||||
|
||||
/* Connect the transport to the remote repository, using the given
|
||||
* direction. */
|
||||
int (*connect)(struct git_transport *transport,
|
||||
const char *url,
|
||||
git_cred_acquire_cb cred_acquire_cb,
|
||||
void *cred_acquire_payload,
|
||||
int direction,
|
||||
int flags);
|
||||
|
||||
/* This function may be called after a successful call to connect(). The
|
||||
* provided callback is invoked for each ref discovered on the remote
|
||||
* end. */
|
||||
int (*ls)(struct git_transport *transport,
|
||||
git_headlist_cb list_cb,
|
||||
void *payload);
|
||||
|
||||
/* Executes the push whose context is in the git_push object. */
|
||||
int (*push)(struct git_transport *transport, git_push *push);
|
||||
|
||||
/* This function may be called after a successful call to connect(), when
|
||||
* the direction is FETCH. The function performs a negotiation to calculate
|
||||
* the wants list for the fetch. */
|
||||
int (*negotiate_fetch)(struct git_transport *transport,
|
||||
git_repository *repo,
|
||||
const git_remote_head * const *refs,
|
||||
size_t count);
|
||||
|
||||
/* This function may be called after a successful call to negotiate_fetch(),
|
||||
* when the direction is FETCH. This function retrieves the pack file for
|
||||
* the fetch from the remote end. */
|
||||
int (*download_pack)(struct git_transport *transport,
|
||||
git_repository *repo,
|
||||
git_transfer_progress *stats,
|
||||
git_transfer_progress_callback progress_cb,
|
||||
void *progress_payload);
|
||||
|
||||
/* Checks to see if the transport is connected */
|
||||
int (*is_connected)(struct git_transport *transport);
|
||||
|
||||
/* Reads the flags value previously passed into connect() */
|
||||
int (*read_flags)(struct git_transport *transport, int *flags);
|
||||
|
||||
/* Cancels any outstanding transport operation */
|
||||
void (*cancel)(struct git_transport *transport);
|
||||
|
||||
/* This function is the reverse of connect() -- it terminates the
|
||||
* connection to the remote end. */
|
||||
int (*close)(struct git_transport *transport);
|
||||
|
||||
/* Frees/destructs the git_transport object. */
|
||||
void (*free)(struct git_transport *transport);
|
||||
} git_transport;
|
||||
|
||||
#define GIT_TRANSPORT_VERSION 1
|
||||
#define GIT_TRANSPORT_INIT {GIT_TRANSPORT_VERSION}
|
||||
|
||||
/**
|
||||
* Function to use to create a transport from a URL. The transport database
|
||||
* is scanned to find a transport that implements the scheme of the URI (i.e.
|
||||
* git:// or http://) and a transport object is returned to the caller.
|
||||
*
|
||||
* @param out The newly created transport (out)
|
||||
* @param owner The git_remote which will own this transport
|
||||
* @param url The URL to connect to
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_transport_new(git_transport **out, git_remote *owner, const char *url);
|
||||
|
||||
/**
|
||||
* Function which checks to see if a transport could be created for the
|
||||
* given URL (i.e. checks to see if libgit2 has a transport that supports
|
||||
* the given URL's scheme)
|
||||
*
|
||||
* @param url The URL to check
|
||||
* @return Zero if the URL is not valid; nonzero otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_transport_valid_url(const char *url);
|
||||
|
||||
/* Signature of a function which creates a transport */
|
||||
typedef int (*git_transport_cb)(git_transport **out, git_remote *owner, void *param);
|
||||
|
||||
/* Transports which come with libgit2 (match git_transport_cb). The expected
|
||||
* value for "param" is listed in-line below. */
|
||||
|
||||
/**
|
||||
* Create an instance of the dummy transport.
|
||||
*
|
||||
* @param out The newly created transport (out)
|
||||
* @param owner The git_remote which will own this transport
|
||||
* @param payload You must pass NULL for this parameter.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_transport_dummy(
|
||||
git_transport **out,
|
||||
git_remote *owner,
|
||||
/* NULL */ void *payload);
|
||||
|
||||
/**
|
||||
* Create an instance of the local transport.
|
||||
*
|
||||
* @param out The newly created transport (out)
|
||||
* @param owner The git_remote which will own this transport
|
||||
* @param payload You must pass NULL for this parameter.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_transport_local(
|
||||
git_transport **out,
|
||||
git_remote *owner,
|
||||
/* NULL */ void *payload);
|
||||
|
||||
/**
|
||||
* Create an instance of the smart transport.
|
||||
*
|
||||
* @param out The newly created transport (out)
|
||||
* @param owner The git_remote which will own this transport
|
||||
* @param payload A pointer to a git_smart_subtransport_definition
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_transport_smart(
|
||||
git_transport **out,
|
||||
git_remote *owner,
|
||||
/* (git_smart_subtransport_definition *) */ void *payload);
|
||||
|
||||
/*
|
||||
*** End of base transport interface ***
|
||||
*** Begin interface for subtransports for the smart transport ***
|
||||
*/
|
||||
|
||||
/* The smart transport knows how to speak the git protocol, but it has no
|
||||
* knowledge of how to establish a connection between it and another endpoint,
|
||||
* or how to move data back and forth. For this, a subtransport interface is
|
||||
* declared, and the smart transport delegates this work to the subtransports.
|
||||
* Three subtransports are implemented: git, http, and winhttp. (The http and
|
||||
* winhttp transports each implement both http and https.) */
|
||||
|
||||
/* Subtransports can either be RPC = 0 (persistent connection) or RPC = 1
|
||||
* (request/response). The smart transport handles the differences in its own
|
||||
* logic. The git subtransport is RPC = 0, while http and winhttp are both
|
||||
* RPC = 1. */
|
||||
|
||||
/* Actions that the smart transport can ask
|
||||
* a subtransport to perform */
|
||||
typedef enum {
|
||||
GIT_SERVICE_UPLOADPACK_LS = 1,
|
||||
GIT_SERVICE_UPLOADPACK = 2,
|
||||
GIT_SERVICE_RECEIVEPACK_LS = 3,
|
||||
GIT_SERVICE_RECEIVEPACK = 4,
|
||||
} git_smart_service_t;
|
||||
|
||||
struct git_smart_subtransport;
|
||||
|
||||
/* A stream used by the smart transport to read and write data
|
||||
* from a subtransport */
|
||||
typedef struct git_smart_subtransport_stream {
|
||||
/* The owning subtransport */
|
||||
struct git_smart_subtransport *subtransport;
|
||||
|
||||
int (*read)(
|
||||
struct git_smart_subtransport_stream *stream,
|
||||
char *buffer,
|
||||
size_t buf_size,
|
||||
size_t *bytes_read);
|
||||
|
||||
int (*write)(
|
||||
struct git_smart_subtransport_stream *stream,
|
||||
const char *buffer,
|
||||
size_t len);
|
||||
|
||||
void (*free)(
|
||||
struct git_smart_subtransport_stream *stream);
|
||||
} git_smart_subtransport_stream;
|
||||
|
||||
/* An implementation of a subtransport which carries data for the
|
||||
* smart transport */
|
||||
typedef struct git_smart_subtransport {
|
||||
int (* action)(
|
||||
git_smart_subtransport_stream **out,
|
||||
struct git_smart_subtransport *transport,
|
||||
const char *url,
|
||||
git_smart_service_t action);
|
||||
|
||||
/* Subtransports are guaranteed a call to close() between
|
||||
* calls to action(), except for the following two "natural" progressions
|
||||
* of actions against a constant URL.
|
||||
*
|
||||
* 1. UPLOADPACK_LS -> UPLOADPACK
|
||||
* 2. RECEIVEPACK_LS -> RECEIVEPACK */
|
||||
int (* close)(struct git_smart_subtransport *transport);
|
||||
|
||||
void (* free)(struct git_smart_subtransport *transport);
|
||||
} git_smart_subtransport;
|
||||
|
||||
/* A function which creates a new subtransport for the smart transport */
|
||||
typedef int (*git_smart_subtransport_cb)(
|
||||
git_smart_subtransport **out,
|
||||
git_transport* owner);
|
||||
|
||||
typedef struct git_smart_subtransport_definition {
|
||||
/* The function to use to create the git_smart_subtransport */
|
||||
git_smart_subtransport_cb callback;
|
||||
|
||||
/* True if the protocol is stateless; false otherwise. For example,
|
||||
* http:// is stateless, but git:// is not. */
|
||||
unsigned rpc : 1;
|
||||
} git_smart_subtransport_definition;
|
||||
|
||||
/* Smart transport subtransports that come with libgit2 */
|
||||
|
||||
/**
|
||||
* Create an instance of the http subtransport. This subtransport
|
||||
* also supports https. On Win32, this subtransport may be implemented
|
||||
* using the WinHTTP library.
|
||||
*
|
||||
* @param out The newly created subtransport
|
||||
* @param owner The smart transport to own this subtransport
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_smart_subtransport_http(
|
||||
git_smart_subtransport **out,
|
||||
git_transport* owner);
|
||||
|
||||
/**
|
||||
* Create an instance of the git subtransport.
|
||||
*
|
||||
* @param out The newly created subtransport
|
||||
* @param owner The smart transport to own this subtransport
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_smart_subtransport_git(
|
||||
git_smart_subtransport **out,
|
||||
git_transport* owner);
|
||||
|
||||
/*
|
||||
*** End interface for subtransports for the smart transport ***
|
||||
*/
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,387 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_tree_h__
|
||||
#define INCLUDE_git_tree_h__
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "oid.h"
|
||||
#include "object.h"
|
||||
|
||||
/**
|
||||
* @file git2/tree.h
|
||||
* @brief Git tree parsing, loading routines
|
||||
* @defgroup git_tree Git tree parsing, loading routines
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Lookup a tree object from the repository.
|
||||
*
|
||||
* @param out Pointer to the looked up tree
|
||||
* @param repo The repo to use when locating the tree.
|
||||
* @param id Identity of the tree to locate.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_INLINE(int) git_tree_lookup(
|
||||
git_tree **out, git_repository *repo, const git_oid *id)
|
||||
{
|
||||
return git_object_lookup((git_object **)out, repo, id, GIT_OBJ_TREE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup a tree object from the repository,
|
||||
* given a prefix of its identifier (short id).
|
||||
*
|
||||
* @see git_object_lookup_prefix
|
||||
*
|
||||
* @param tree pointer to the looked up tree
|
||||
* @param repo the repo to use when locating the tree.
|
||||
* @param id identity of the tree to locate.
|
||||
* @param len the length of the short identifier
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_INLINE(int) git_tree_lookup_prefix(
|
||||
git_tree **out,
|
||||
git_repository *repo,
|
||||
const git_oid *id,
|
||||
size_t len)
|
||||
{
|
||||
return git_object_lookup_prefix(
|
||||
(git_object **)out, repo, id, len, GIT_OBJ_TREE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close an open tree
|
||||
*
|
||||
* You can no longer use the git_tree pointer after this call.
|
||||
*
|
||||
* IMPORTANT: You MUST call this method when you stop using a tree to
|
||||
* release memory. Failure to do so will cause a memory leak.
|
||||
*
|
||||
* @param tree The tree to close
|
||||
*/
|
||||
GIT_INLINE(void) git_tree_free(git_tree *tree)
|
||||
{
|
||||
git_object_free((git_object *)tree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id of a tree.
|
||||
*
|
||||
* @param tree a previously loaded tree.
|
||||
* @return object identity for the tree.
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_tree_id(const git_tree *tree);
|
||||
|
||||
/**
|
||||
* Get the repository that contains the tree.
|
||||
*
|
||||
* @param tree A previously loaded tree.
|
||||
* @return Repository that contains this tree.
|
||||
*/
|
||||
GIT_EXTERN(git_repository *) git_tree_owner(const git_tree *tree);
|
||||
|
||||
/**
|
||||
* Get the number of entries listed in a tree
|
||||
*
|
||||
* @param tree a previously loaded tree.
|
||||
* @return the number of entries in the tree
|
||||
*/
|
||||
GIT_EXTERN(size_t) git_tree_entrycount(const git_tree *tree);
|
||||
|
||||
/**
|
||||
* Lookup a tree entry by its filename
|
||||
*
|
||||
* This returns a git_tree_entry that is owned by the git_tree. You don't
|
||||
* have to free it, but you must not use it after the git_tree is released.
|
||||
*
|
||||
* @param tree a previously loaded tree.
|
||||
* @param filename the filename of the desired entry
|
||||
* @return the tree entry; NULL if not found
|
||||
*/
|
||||
GIT_EXTERN(const git_tree_entry *) git_tree_entry_byname(
|
||||
git_tree *tree, const char *filename);
|
||||
|
||||
/**
|
||||
* Lookup a tree entry by its position in the tree
|
||||
*
|
||||
* This returns a git_tree_entry that is owned by the git_tree. You don't
|
||||
* have to free it, but you must not use it after the git_tree is released.
|
||||
*
|
||||
* @param tree a previously loaded tree.
|
||||
* @param idx the position in the entry list
|
||||
* @return the tree entry; NULL if not found
|
||||
*/
|
||||
GIT_EXTERN(const git_tree_entry *) git_tree_entry_byindex(
|
||||
git_tree *tree, size_t idx);
|
||||
|
||||
/**
|
||||
* Lookup a tree entry by SHA value.
|
||||
*
|
||||
* This returns a git_tree_entry that is owned by the git_tree. You don't
|
||||
* have to free it, but you must not use it after the git_tree is released.
|
||||
*
|
||||
* Warning: this must examine every entry in the tree, so it is not fast.
|
||||
*
|
||||
* @param tree a previously loaded tree.
|
||||
* @param oid the sha being looked for
|
||||
* @return the tree entry; NULL if not found
|
||||
*/
|
||||
GIT_EXTERN(const git_tree_entry *) git_tree_entry_byoid(
|
||||
const git_tree *tree, const git_oid *oid);
|
||||
|
||||
/**
|
||||
* Retrieve a tree entry contained in a tree or in any of its subtrees,
|
||||
* given its relative path.
|
||||
*
|
||||
* Unlike the other lookup functions, the returned tree entry is owned by
|
||||
* the user and must be freed explicitly with `git_tree_entry_free()`.
|
||||
*
|
||||
* @param out Pointer where to store the tree entry
|
||||
* @param root Previously loaded tree which is the root of the relative path
|
||||
* @param subtree_path Path to the contained entry
|
||||
* @return 0 on success; GIT_ENOTFOUND if the path does not exist
|
||||
*/
|
||||
GIT_EXTERN(int) git_tree_entry_bypath(
|
||||
git_tree_entry **out,
|
||||
git_tree *root,
|
||||
const char *path);
|
||||
|
||||
/**
|
||||
* Duplicate a tree entry
|
||||
*
|
||||
* Create a copy of a tree entry. The returned copy is owned by the user,
|
||||
* and must be freed explicitly with `git_tree_entry_free()`.
|
||||
*
|
||||
* @param entry A tree entry to duplicate
|
||||
* @return a copy of the original entry or NULL on error (alloc failure)
|
||||
*/
|
||||
GIT_EXTERN(git_tree_entry *) git_tree_entry_dup(const git_tree_entry *entry);
|
||||
|
||||
/**
|
||||
* Free a user-owned tree entry
|
||||
*
|
||||
* IMPORTANT: This function is only needed for tree entries owned by the
|
||||
* user, such as the ones returned by `git_tree_entry_dup()` or
|
||||
* `git_tree_entry_bypath()`.
|
||||
*
|
||||
* @param entry The entry to free
|
||||
*/
|
||||
GIT_EXTERN(void) git_tree_entry_free(git_tree_entry *entry);
|
||||
|
||||
/**
|
||||
* Get the filename of a tree entry
|
||||
*
|
||||
* @param entry a tree entry
|
||||
* @return the name of the file
|
||||
*/
|
||||
GIT_EXTERN(const char *) git_tree_entry_name(const git_tree_entry *entry);
|
||||
|
||||
/**
|
||||
* Get the id of the object pointed by the entry
|
||||
*
|
||||
* @param entry a tree entry
|
||||
* @return the oid of the object
|
||||
*/
|
||||
GIT_EXTERN(const git_oid *) git_tree_entry_id(const git_tree_entry *entry);
|
||||
|
||||
/**
|
||||
* Get the type of the object pointed by the entry
|
||||
*
|
||||
* @param entry a tree entry
|
||||
* @return the type of the pointed object
|
||||
*/
|
||||
GIT_EXTERN(git_otype) git_tree_entry_type(const git_tree_entry *entry);
|
||||
|
||||
/**
|
||||
* Get the UNIX file attributes of a tree entry
|
||||
*
|
||||
* @param entry a tree entry
|
||||
* @return filemode as an integer
|
||||
*/
|
||||
GIT_EXTERN(git_filemode_t) git_tree_entry_filemode(const git_tree_entry *entry);
|
||||
|
||||
/**
|
||||
* Convert a tree entry to the git_object it points too.
|
||||
*
|
||||
* You must call `git_object_free()` on the object when you are done with it.
|
||||
*
|
||||
* @param object pointer to the converted object
|
||||
* @param repo repository where to lookup the pointed object
|
||||
* @param entry a tree entry
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_tree_entry_to_object(
|
||||
git_object **object_out,
|
||||
git_repository *repo,
|
||||
const git_tree_entry *entry);
|
||||
|
||||
/**
|
||||
* Create a new tree builder.
|
||||
*
|
||||
* The tree builder can be used to create or modify trees in memory and
|
||||
* write them as tree objects to the database.
|
||||
*
|
||||
* If the `source` parameter is not NULL, the tree builder will be
|
||||
* initialized with the entries of the given tree.
|
||||
*
|
||||
* If the `source` parameter is NULL, the tree builder will start with no
|
||||
* entries and will have to be filled manually.
|
||||
*
|
||||
* @param out Pointer where to store the tree builder
|
||||
* @param source Source tree to initialize the builder (optional)
|
||||
* @return 0 on success; error code otherwise
|
||||
*/
|
||||
GIT_EXTERN(int) git_treebuilder_create(
|
||||
git_treebuilder **out, const git_tree *source);
|
||||
|
||||
/**
|
||||
* Clear all the entires in the builder
|
||||
*
|
||||
* @param bld Builder to clear
|
||||
*/
|
||||
GIT_EXTERN(void) git_treebuilder_clear(git_treebuilder *bld);
|
||||
|
||||
/**
|
||||
* Free a tree builder
|
||||
*
|
||||
* This will clear all the entries and free to builder.
|
||||
* Failing to free the builder after you're done using it
|
||||
* will result in a memory leak
|
||||
*
|
||||
* @param bld Builder to free
|
||||
*/
|
||||
GIT_EXTERN(void) git_treebuilder_free(git_treebuilder *bld);
|
||||
|
||||
/**
|
||||
* Get an entry from the builder from its filename
|
||||
*
|
||||
* The returned entry is owned by the builder and should
|
||||
* not be freed manually.
|
||||
*
|
||||
* @param bld Tree builder
|
||||
* @param filename Name of the entry
|
||||
* @return pointer to the entry; NULL if not found
|
||||
*/
|
||||
GIT_EXTERN(const git_tree_entry *) git_treebuilder_get(
|
||||
git_treebuilder *bld, const char *filename);
|
||||
|
||||
/**
|
||||
* Add or update an entry to the builder
|
||||
*
|
||||
* Insert a new entry for `filename` in the builder with the
|
||||
* given attributes.
|
||||
*
|
||||
* If an entry named `filename` already exists, its attributes
|
||||
* will be updated with the given ones.
|
||||
*
|
||||
* The optional pointer `out` can be used to retrieve a pointer to
|
||||
* the newly created/updated entry. Pass NULL if you do not need it.
|
||||
*
|
||||
* No attempt is being made to ensure that the provided oid points
|
||||
* to an existing git object in the object database, nor that the
|
||||
* attributes make sense regarding the type of the pointed at object.
|
||||
*
|
||||
* @param out Pointer to store the entry (optional)
|
||||
* @param bld Tree builder
|
||||
* @param filename Filename of the entry
|
||||
* @param id SHA1 oid of the entry
|
||||
* @param filemode Folder attributes of the entry. This parameter must
|
||||
* be valued with one of the following entries: 0040000, 0100644,
|
||||
* 0100755, 0120000 or 0160000.
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_treebuilder_insert(
|
||||
const git_tree_entry **out,
|
||||
git_treebuilder *bld,
|
||||
const char *filename,
|
||||
const git_oid *id,
|
||||
git_filemode_t filemode);
|
||||
|
||||
/**
|
||||
* Remove an entry from the builder by its filename
|
||||
*
|
||||
* @param bld Tree builder
|
||||
* @param filename Filename of the entry to remove
|
||||
*/
|
||||
GIT_EXTERN(int) git_treebuilder_remove(
|
||||
git_treebuilder *bld, const char *filename);
|
||||
|
||||
typedef int (*git_treebuilder_filter_cb)(
|
||||
const git_tree_entry *entry, void *payload);
|
||||
|
||||
/**
|
||||
* Filter the entries in the tree
|
||||
*
|
||||
* The `filter` callback will be called for each entry in the tree with a
|
||||
* pointer to the entry and the provided `payload`; if the callback returns
|
||||
* non-zero, the entry will be filtered (removed from the builder).
|
||||
*
|
||||
* @param bld Tree builder
|
||||
* @param filter Callback to filter entries
|
||||
* @param payload Extra data to pass to filter
|
||||
*/
|
||||
GIT_EXTERN(void) git_treebuilder_filter(
|
||||
git_treebuilder *bld,
|
||||
git_treebuilder_filter_cb filter,
|
||||
void *payload);
|
||||
|
||||
/**
|
||||
* Write the contents of the tree builder as a tree object
|
||||
*
|
||||
* The tree builder will be written to the given `repo`, and its
|
||||
* identifying SHA1 hash will be stored in the `id` pointer.
|
||||
*
|
||||
* @param id Pointer to store the OID of the newly written tree
|
||||
* @param repo Repository in which to store the object
|
||||
* @param bld Tree builder to write
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_treebuilder_write(
|
||||
git_oid *id, git_repository *repo, git_treebuilder *bld);
|
||||
|
||||
|
||||
/** Callback for the tree traversal method */
|
||||
typedef int (*git_treewalk_cb)(
|
||||
const char *root, const git_tree_entry *entry, void *payload);
|
||||
|
||||
/** Tree traversal modes */
|
||||
typedef enum {
|
||||
GIT_TREEWALK_PRE = 0, /* Pre-order */
|
||||
GIT_TREEWALK_POST = 1, /* Post-order */
|
||||
} git_treewalk_mode;
|
||||
|
||||
/**
|
||||
* Traverse the entries in a tree and its subtrees in post or pre order.
|
||||
*
|
||||
* The entries will be traversed in the specified order, children subtrees
|
||||
* will be automatically loaded as required, and the `callback` will be
|
||||
* called once per entry with the current (relative) root for the entry and
|
||||
* the entry data itself.
|
||||
*
|
||||
* If the callback returns a positive value, the passed entry will be
|
||||
* skipped on the traversal (in pre mode). A negative value stops the walk.
|
||||
*
|
||||
* @param tree The tree to walk
|
||||
* @param mode Traversal mode (pre or post-order)
|
||||
* @param callback Function to call on each tree entry
|
||||
* @param payload Opaque pointer to be passed on each callback
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_tree_walk(
|
||||
const git_tree *tree,
|
||||
git_treewalk_mode mode,
|
||||
git_treewalk_cb callback,
|
||||
void *payload);
|
||||
|
||||
/** @} */
|
||||
|
||||
GIT_END_DECL
|
||||
#endif
|
||||
@@ -1,198 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_types_h__
|
||||
#define INCLUDE_git_types_h__
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* @file git2/types.h
|
||||
* @brief libgit2 base & compatibility types
|
||||
* @ingroup Git
|
||||
* @{
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Cross-platform compatibility types for off_t / time_t
|
||||
*
|
||||
* NOTE: This needs to be in a public header so that both the library
|
||||
* implementation and client applications both agree on the same types.
|
||||
* Otherwise we get undefined behavior.
|
||||
*
|
||||
* Use the "best" types that each platform provides. Currently we truncate
|
||||
* these intermediate representations for compatibility with the git ABI, but
|
||||
* if and when it changes to support 64 bit types, our code will naturally
|
||||
* adapt.
|
||||
* NOTE: These types should match those that are returned by our internal
|
||||
* stat() functions, for all platforms.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#ifdef __amigaos4__
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
typedef __int64 git_off_t;
|
||||
typedef __time64_t git_time_t;
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
|
||||
typedef off64_t git_off_t;
|
||||
typedef __time64_t git_time_t;
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
|
||||
typedef __haiku_std_int64 git_off_t;
|
||||
typedef __haiku_std_int64 git_time_t;
|
||||
|
||||
#else /* POSIX */
|
||||
|
||||
/*
|
||||
* Note: Can't use off_t since if a client program includes <sys/types.h>
|
||||
* before us (directly or indirectly), they'll get 32 bit off_t in their client
|
||||
* app, even though /we/ define _FILE_OFFSET_BITS=64.
|
||||
*/
|
||||
typedef int64_t git_off_t;
|
||||
typedef int64_t git_time_t;
|
||||
|
||||
#endif
|
||||
|
||||
/** Basic type (loose or packed) of any Git object. */
|
||||
typedef enum {
|
||||
GIT_OBJ_ANY = -2, /**< Object can be any of the following */
|
||||
GIT_OBJ_BAD = -1, /**< Object is invalid. */
|
||||
GIT_OBJ__EXT1 = 0, /**< Reserved for future use. */
|
||||
GIT_OBJ_COMMIT = 1, /**< A commit object. */
|
||||
GIT_OBJ_TREE = 2, /**< A tree (directory listing) object. */
|
||||
GIT_OBJ_BLOB = 3, /**< A file revision object. */
|
||||
GIT_OBJ_TAG = 4, /**< An annotated tag object. */
|
||||
GIT_OBJ__EXT2 = 5, /**< Reserved for future use. */
|
||||
GIT_OBJ_OFS_DELTA = 6, /**< A delta, base is given by an offset. */
|
||||
GIT_OBJ_REF_DELTA = 7, /**< A delta, base is given by object id. */
|
||||
} git_otype;
|
||||
|
||||
/** An open object database handle. */
|
||||
typedef struct git_odb git_odb;
|
||||
|
||||
/** A custom backend in an ODB */
|
||||
typedef struct git_odb_backend git_odb_backend;
|
||||
|
||||
/** An object read from the ODB */
|
||||
typedef struct git_odb_object git_odb_object;
|
||||
|
||||
/** A stream to read/write from the ODB */
|
||||
typedef struct git_odb_stream git_odb_stream;
|
||||
|
||||
/** A stream to write a packfile to the ODB */
|
||||
typedef struct git_odb_writepack git_odb_writepack;
|
||||
|
||||
/**
|
||||
* Representation of an existing git repository,
|
||||
* including all its object contents
|
||||
*/
|
||||
typedef struct git_repository git_repository;
|
||||
|
||||
/** Representation of a generic object in a repository */
|
||||
typedef struct git_object git_object;
|
||||
|
||||
/** Representation of an in-progress walk through the commits in a repo */
|
||||
typedef struct git_revwalk git_revwalk;
|
||||
|
||||
/** Parsed representation of a tag object. */
|
||||
typedef struct git_tag git_tag;
|
||||
|
||||
/** In-memory representation of a blob object. */
|
||||
typedef struct git_blob git_blob;
|
||||
|
||||
/** Parsed representation of a commit object. */
|
||||
typedef struct git_commit git_commit;
|
||||
|
||||
/** Representation of each one of the entries in a tree object. */
|
||||
typedef struct git_tree_entry git_tree_entry;
|
||||
|
||||
/** Representation of a tree object. */
|
||||
typedef struct git_tree git_tree;
|
||||
|
||||
/** Constructor for in-memory trees */
|
||||
typedef struct git_treebuilder git_treebuilder;
|
||||
|
||||
/** Memory representation of an index file. */
|
||||
typedef struct git_index git_index;
|
||||
|
||||
/** Memory representation of a set of config files */
|
||||
typedef struct git_config git_config;
|
||||
|
||||
/** Interface to access a configuration file */
|
||||
typedef struct git_config_backend git_config_backend;
|
||||
|
||||
/** Representation of a reference log entry */
|
||||
typedef struct git_reflog_entry git_reflog_entry;
|
||||
|
||||
/** Representation of a reference log */
|
||||
typedef struct git_reflog git_reflog;
|
||||
|
||||
/** Representation of a git note */
|
||||
typedef struct git_note git_note;
|
||||
|
||||
/** Representation of a git packbuilder */
|
||||
typedef struct git_packbuilder git_packbuilder;
|
||||
|
||||
/** Time in a signature */
|
||||
typedef struct git_time {
|
||||
git_time_t time; /** time in seconds from epoch */
|
||||
int offset; /** timezone offset, in minutes */
|
||||
} git_time;
|
||||
|
||||
/** An action signature (e.g. for committers, taggers, etc) */
|
||||
typedef struct git_signature {
|
||||
char *name; /** full name of the author */
|
||||
char *email; /** email of the author */
|
||||
git_time when; /** time when the action happened */
|
||||
} git_signature;
|
||||
|
||||
/** In-memory representation of a reference. */
|
||||
typedef struct git_reference git_reference;
|
||||
|
||||
/** Basic type of any Git reference. */
|
||||
typedef enum {
|
||||
GIT_REF_INVALID = 0, /** Invalid reference */
|
||||
GIT_REF_OID = 1, /** A reference which points at an object id */
|
||||
GIT_REF_SYMBOLIC = 2, /** A reference which points at another reference */
|
||||
GIT_REF_PACKED = 4,
|
||||
GIT_REF_HAS_PEEL = 8,
|
||||
GIT_REF_LISTALL = GIT_REF_OID|GIT_REF_SYMBOLIC|GIT_REF_PACKED,
|
||||
} git_ref_t;
|
||||
|
||||
/** Basic type of any Git branch. */
|
||||
typedef enum {
|
||||
GIT_BRANCH_LOCAL = 1,
|
||||
GIT_BRANCH_REMOTE = 2,
|
||||
} git_branch_t;
|
||||
|
||||
/** Valid modes for index and tree entries. */
|
||||
typedef enum {
|
||||
GIT_FILEMODE_NEW = 0000000,
|
||||
GIT_FILEMODE_TREE = 0040000,
|
||||
GIT_FILEMODE_BLOB = 0100644,
|
||||
GIT_FILEMODE_BLOB_EXECUTABLE = 0100755,
|
||||
GIT_FILEMODE_LINK = 0120000,
|
||||
GIT_FILEMODE_COMMIT = 0160000,
|
||||
} git_filemode_t;
|
||||
|
||||
typedef struct git_refspec git_refspec;
|
||||
typedef struct git_remote git_remote;
|
||||
typedef struct git_push git_push;
|
||||
|
||||
typedef struct git_remote_head git_remote_head;
|
||||
typedef struct git_remote_callbacks git_remote_callbacks;
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
|
||||
#endif
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
#ifndef INCLUDE_git_version_h__
|
||||
#define INCLUDE_git_version_h__
|
||||
|
||||
#define LIBGIT2_VERSION "0.17.0"
|
||||
#define LIBGIT2_VER_MAJOR 0
|
||||
#define LIBGIT2_VER_MINOR 17
|
||||
#define LIBGIT2_VER_REVISION 0
|
||||
|
||||
#endif
|
||||
@@ -1,50 +0,0 @@
|
||||
{
|
||||
'variables': {
|
||||
'includes_common': [
|
||||
'git2/include/git2.h',
|
||||
'git2/include/git2/attr.h',
|
||||
'git2/include/git2/blob.h',
|
||||
'git2/include/git2/branch.h',
|
||||
'git2/include/git2/commit.h',
|
||||
'git2/include/git2/common.h',
|
||||
'git2/include/git2/config.h',
|
||||
'git2/include/git2/diff.h',
|
||||
'git2/include/git2/errors.h',
|
||||
'git2/include/git2/index.h',
|
||||
'git2/include/git2/indexer.h',
|
||||
'git2/include/git2/merge.h',
|
||||
'git2/include/git2/net.h',
|
||||
'git2/include/git2/notes.h',
|
||||
'git2/include/git2/object.h',
|
||||
'git2/include/git2/odb.h',
|
||||
'git2/include/git2/odb_backend.h',
|
||||
'git2/include/git2/oid.h',
|
||||
'git2/include/git2/reflog.h',
|
||||
'git2/include/git2/refs.h',
|
||||
'git2/include/git2/refspec.h',
|
||||
'git2/include/git2/remote.h',
|
||||
'git2/include/git2/repository.h',
|
||||
'git2/include/git2/revwalk.h',
|
||||
'git2/include/git2/signature.h',
|
||||
'git2/include/git2/status.h',
|
||||
'git2/include/git2/submodule.h',
|
||||
'git2/include/git2/tag.h',
|
||||
'git2/include/git2/threads.h',
|
||||
'git2/include/git2/tree.h',
|
||||
'git2/include/git2/types.h',
|
||||
'git2/include/git2/version.h',
|
||||
'git2/include/git2/checkout.h',
|
||||
'git2/include/git2/clone.h',
|
||||
'git2/include/git2/ignore.h',
|
||||
'git2/include/git2/message.h',
|
||||
'git2/include/git2/pack.h',
|
||||
'git2/include/git2/reset.h',
|
||||
'git2/include/git2/revparse.h',
|
||||
'git2/include/git2/strarray.h',
|
||||
'git2/include/git2/graph.h',
|
||||
'git2/include/git2/push.h',
|
||||
'git2/include/git2/stash.h',
|
||||
'git2/include/git2/transport.h',
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#include "include/cef_app.h"
|
||||
#include "include/cef_application_mac.h"
|
||||
|
||||
class AtomCefClient;
|
||||
|
||||
@interface AtomApplication : NSApplication <CefAppProtocol, NSApplicationDelegate> {
|
||||
IBOutlet NSMenuItem *_versionMenuItem;
|
||||
NSWindowController *_backgroundWindowController;
|
||||
NSDictionary *_arguments;
|
||||
NSInvocation *_updateInvocation;
|
||||
NSString *_updateStatus;
|
||||
BOOL _filesOpened;
|
||||
BOOL _handlingSendEvent;
|
||||
}
|
||||
|
||||
+ (AtomApplication *)sharedApplication;
|
||||
+ (id)applicationWithArguments:(char **)argv count:(int)argc;
|
||||
+ (CefSettings)createCefSettings;
|
||||
+ (NSDictionary *)parseArguments:(char **)argv count:(int)argc;
|
||||
- (void)open:(NSString *)path;
|
||||
- (void)open:(NSString *)path pidToKillWhenWindowCloses:(NSNumber *)pid;
|
||||
- (IBAction)runSpecs:(id)sender;
|
||||
- (IBAction)runBenchmarks:(id)sender;
|
||||
- (void)runSpecsThenExit:(BOOL)exitWhenDone;
|
||||
- (NSDictionary *)arguments;
|
||||
- (void)runBenchmarksThenExit:(BOOL)exitWhenDone;
|
||||
|
||||
@property (nonatomic, retain) NSDictionary *arguments;
|
||||
|
||||
@end
|
||||
@@ -1,289 +0,0 @@
|
||||
#import "include/cef_application_mac.h"
|
||||
#import "native/atom_cef_client.h"
|
||||
#import "native/atom_application.h"
|
||||
#import "native/atom_window_controller.h"
|
||||
#import "native/atom_cef_app.h"
|
||||
#import <getopt.h>
|
||||
#import <Sparkle/Sparkle.h>
|
||||
|
||||
@implementation AtomApplication
|
||||
|
||||
@synthesize arguments=_arguments;
|
||||
|
||||
+ (AtomApplication *)sharedApplication {
|
||||
return (AtomApplication *)[super sharedApplication];
|
||||
}
|
||||
|
||||
+ (id)applicationWithArguments:(char **)argv count:(int)argc {
|
||||
AtomApplication *application = [self sharedApplication];
|
||||
CefInitialize(CefMainArgs(argc, argv), [self createCefSettings], new AtomCefApp);
|
||||
application.arguments = [self parseArguments:argv count:argc];
|
||||
|
||||
return application;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)parseArguments:(char **)argv count:(int)argc {
|
||||
NSMutableDictionary *arguments = [[NSMutableDictionary alloc] init];
|
||||
|
||||
// Remove non-posix (i.e. -long_argument_with_one_leading_hyphen) added by OS X from the command line
|
||||
int cleanArgc = argc;
|
||||
size_t argvSize = argc * sizeof(char *);
|
||||
char **cleanArgv = (char **)alloca(argvSize);
|
||||
for (int i=0; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-NSDocumentRevisionsDebugMode") == 0) { // Xcode inserts useless command-line args by default: http://trac.wxwidgets.org/ticket/13732
|
||||
cleanArgc -= 2;
|
||||
i++;
|
||||
}
|
||||
else if (strncmp(argv[i], "-psn_", 5) == 0) { // OS X inserts a -psn_[PID] argument.
|
||||
cleanArgc -= 1;
|
||||
}
|
||||
else {
|
||||
cleanArgv[i] = argv[i];
|
||||
}
|
||||
}
|
||||
|
||||
int opt;
|
||||
int longindex;
|
||||
|
||||
static struct option longopts[] = {
|
||||
{ "executed-from", required_argument, NULL, 'K' },
|
||||
{ "resource-path", required_argument, NULL, 'R' },
|
||||
{ "benchmark", no_argument, NULL, 'B' },
|
||||
{ "test", no_argument, NULL, 'T' },
|
||||
{ "dev", no_argument, NULL, 'D' },
|
||||
{ "pid", required_argument, NULL, 'P' },
|
||||
{ "wait", no_argument, NULL, 'W' },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
while ((opt = getopt_long(cleanArgc, cleanArgv, "K:R:BYDP:Wh?", longopts, &longindex)) != -1) {
|
||||
NSString *key, *value;
|
||||
switch (opt) {
|
||||
case 'K':
|
||||
case 'R':
|
||||
case 'B':
|
||||
case 'T':
|
||||
case 'D':
|
||||
case 'W':
|
||||
case 'P':
|
||||
key = [NSString stringWithUTF8String:longopts[longindex].name];
|
||||
value = optarg ? [NSString stringWithUTF8String:optarg] : @"YES";
|
||||
[arguments setObject:value forKey:key];
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
NSLog(@"usage: atom [--resource-path=<path>] [<path>]");
|
||||
}
|
||||
}
|
||||
|
||||
cleanArgc -= optind;
|
||||
cleanArgv += optind;
|
||||
|
||||
if (cleanArgc > 0) {
|
||||
NSString *path = [NSString stringWithUTF8String:cleanArgv[0]];
|
||||
path = [self standardizePathToOpen:path withArguments:arguments];
|
||||
[arguments setObject:path forKey:@"path"];
|
||||
} else {
|
||||
NSString *executedFromPath = [arguments objectForKey:@"executed-from"];
|
||||
if (executedFromPath) {
|
||||
[arguments setObject:executedFromPath forKey:@"path"];
|
||||
}
|
||||
}
|
||||
|
||||
return arguments;
|
||||
}
|
||||
|
||||
+ (NSString *)standardizePathToOpen:(NSString *)path withArguments:(NSDictionary *)arguments {
|
||||
NSString *standardizedPath = path;
|
||||
NSString *executedFromPath = [arguments objectForKey:@"executed-from"];
|
||||
if (![standardizedPath isAbsolutePath] && executedFromPath) {
|
||||
standardizedPath = [executedFromPath stringByAppendingPathComponent:standardizedPath];
|
||||
}
|
||||
standardizedPath = [standardizedPath stringByStandardizingPath];
|
||||
return standardizedPath;
|
||||
}
|
||||
|
||||
+ (NSString *)supportDirectory {
|
||||
NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) objectAtIndex:0];
|
||||
NSString *executableName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleExecutable"];
|
||||
NSString *supportDirectory = [cachePath stringByAppendingPathComponent:executableName];
|
||||
|
||||
NSFileManager *fs = [NSFileManager defaultManager];
|
||||
NSError *error;
|
||||
BOOL success = [fs createDirectoryAtPath:supportDirectory withIntermediateDirectories:YES attributes:nil error:&error];
|
||||
if (!success) {
|
||||
NSLog(@"Warning: Can't create support directory '%@' because %@", supportDirectory, [error localizedDescription]);
|
||||
supportDirectory = @"";
|
||||
}
|
||||
|
||||
return supportDirectory;
|
||||
}
|
||||
|
||||
+ (CefSettings)createCefSettings {
|
||||
CefSettings settings;
|
||||
|
||||
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
|
||||
NSString *userAgent = [NSString stringWithFormat:@"GitHubAtom/%@", version];
|
||||
CefString(&settings.cache_path) = [[self supportDirectory] UTF8String];
|
||||
CefString(&settings.user_agent) = [userAgent UTF8String];
|
||||
CefString(&settings.log_file) = "";
|
||||
CefString(&settings.javascript_flags) = "";
|
||||
settings.remote_debugging_port = 9090;
|
||||
settings.log_severity = LOGSEVERITY_ERROR;
|
||||
return settings;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[_backgroundWindowController release];
|
||||
[_arguments release];
|
||||
[_updateInvocation release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)open:(NSString *)path pidToKillWhenWindowCloses:(NSNumber *)pid {
|
||||
for (NSWindow *window in [self windows]) {
|
||||
if (![window isExcludedFromWindowsMenu]) {
|
||||
AtomWindowController *controller = [window windowController];
|
||||
if ([path isEqualToString:controller.pathToOpen]) {
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AtomWindowController *windowController = [[AtomWindowController alloc] initWithPath:path];
|
||||
[windowController setPidToKillOnClose:pid];
|
||||
return windowController;
|
||||
}
|
||||
|
||||
- (void)open:(NSString *)path {
|
||||
[self open:path pidToKillWhenWindowCloses:nil];
|
||||
}
|
||||
|
||||
- (void)openDev:(NSString *)path {
|
||||
[[AtomWindowController alloc] initDevWithPath:path];
|
||||
}
|
||||
|
||||
- (IBAction)runSpecs:(id)sender {
|
||||
[self runSpecsThenExit:NO];
|
||||
}
|
||||
|
||||
- (void)runSpecsThenExit:(BOOL)exitWhenDone {
|
||||
[[AtomWindowController alloc] initSpecsThenExit:exitWhenDone];
|
||||
}
|
||||
|
||||
- (IBAction)runBenchmarks:(id)sender {
|
||||
[self runBenchmarksThenExit:NO];
|
||||
}
|
||||
|
||||
- (void)runBenchmarksThenExit:(BOOL)exitWhenDone {
|
||||
[[AtomWindowController alloc] initBenchmarksThenExit:exitWhenDone];
|
||||
}
|
||||
|
||||
# pragma mark NSApplicationDelegate
|
||||
|
||||
- (BOOL)shouldOpenFiles {
|
||||
if ([self.arguments objectForKey:@"benchmark"]) {
|
||||
return NO;
|
||||
}
|
||||
if ([self.arguments objectForKey:@"test"]) {
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames {
|
||||
if ([self shouldOpenFiles]) {
|
||||
for (NSString *path in filenames) {
|
||||
path = [[self class] standardizePathToOpen:path withArguments:self.arguments];
|
||||
NSNumber *pid = [self.arguments objectForKey:@"wait"] ? [self.arguments objectForKey:@"pid"] : nil;
|
||||
[self open:path pidToKillWhenWindowCloses:pid];
|
||||
}
|
||||
if ([filenames count] > 0) {
|
||||
_filesOpened = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
|
||||
if (!_filesOpened && [self shouldOpenFiles]) {
|
||||
NSString *path = [self.arguments objectForKey:@"path"];
|
||||
NSNumber *pid = [self.arguments objectForKey:@"wait"] ? [self.arguments objectForKey:@"pid"] : nil;
|
||||
[self open:path pidToKillWhenWindowCloses:pid];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationWillFinishLaunching:(NSNotification *)notification {
|
||||
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
|
||||
_versionMenuItem.title = [NSString stringWithFormat:@"Version %@", version];
|
||||
|
||||
if ([self.arguments objectForKey:@"benchmark"]) {
|
||||
[self runBenchmarksThenExit:true];
|
||||
}
|
||||
else if ([self.arguments objectForKey:@"test"]) {
|
||||
[self runSpecsThenExit:true];
|
||||
}
|
||||
else {
|
||||
_backgroundWindowController = [[AtomWindowController alloc] initInBackground];
|
||||
if (![self.arguments objectForKey:@"dev"]) {
|
||||
SUUpdater.sharedUpdater.delegate = self;
|
||||
SUUpdater.sharedUpdater.automaticallyChecksForUpdates = YES;
|
||||
SUUpdater.sharedUpdater.automaticallyDownloadsUpdates = YES;
|
||||
[SUUpdater.sharedUpdater checkForUpdatesInBackground];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)notification {
|
||||
for (NSWindow *window in [self windows]) {
|
||||
[window performClose:self];
|
||||
}
|
||||
CefShutdown();
|
||||
}
|
||||
|
||||
# pragma mark CefAppProtocol
|
||||
|
||||
- (BOOL)isHandlingSendEvent {
|
||||
return _handlingSendEvent;
|
||||
}
|
||||
|
||||
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent {
|
||||
_handlingSendEvent = handlingSendEvent;
|
||||
}
|
||||
|
||||
- (void)sendEvent:(NSEvent*)event {
|
||||
CefScopedSendingEvent sendingEventScoper;
|
||||
if ([[self mainMenu] performKeyEquivalent:event]) return;
|
||||
|
||||
if (_backgroundWindowController && ![self keyWindow] && [event type] == NSKeyDown) {
|
||||
[_backgroundWindowController.window makeKeyWindow];
|
||||
[_backgroundWindowController.window sendEvent:event];
|
||||
}
|
||||
else {
|
||||
[super sendEvent:event];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark SUUpdaterDelegate
|
||||
|
||||
- (void)updaterDidNotFindUpdate:(SUUpdater *)update {
|
||||
}
|
||||
|
||||
- (void)updater:(SUUpdater *)updater didFindValidUpdate:(SUAppcastItem *)update {
|
||||
}
|
||||
|
||||
- (void)updater:(SUUpdater *)updater willExtractUpdate:(SUAppcastItem *)update {
|
||||
}
|
||||
|
||||
- (void)updater:(SUUpdater *)updater willInstallUpdateOnQuit:(SUAppcastItem *)update immediateInstallationInvocation:(NSInvocation *)invocation {
|
||||
_updateInvocation = [invocation retain];
|
||||
_versionMenuItem.title = [NSString stringWithFormat:@"Update to %@", update.versionString];
|
||||
_versionMenuItem.target = _updateInvocation;
|
||||
_versionMenuItem.action = @selector(invoke);
|
||||
}
|
||||
|
||||
- (void)updater:(SUUpdater *)updater didCancelInstallUpdateOnQuit:(SUAppcastItem *)update {
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef ATOM_CEF_APP_H_
|
||||
#define ATOM_CEF_APP_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_app.h"
|
||||
|
||||
#ifdef PROCESS_HELPER_APP
|
||||
#include "atom_cef_render_process_handler.h"
|
||||
#endif
|
||||
|
||||
class AtomCefApp : public CefApp {
|
||||
|
||||
#ifdef PROCESS_HELPER_APP
|
||||
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() OVERRIDE {
|
||||
return CefRefPtr<CefRenderProcessHandler>(new AtomCefRenderProcessHandler);
|
||||
}
|
||||
#endif
|
||||
|
||||
IMPLEMENT_REFCOUNTING(AtomCefApp);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,251 +0,0 @@
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <assert.h>
|
||||
#include "include/cef_path_util.h"
|
||||
#include "include/cef_process_util.h"
|
||||
#include "include/cef_task.h"
|
||||
#include "include/cef_runnable.h"
|
||||
#include "include/cef_trace.h"
|
||||
#include "cef_types.h"
|
||||
#include "native/atom_cef_client.h"
|
||||
#include "cef_v8.h"
|
||||
|
||||
#define REQUIRE_UI_THREAD() assert(CefCurrentlyOn(TID_UI));
|
||||
#define REQUIRE_IO_THREAD() assert(CefCurrentlyOn(TID_IO));
|
||||
#define REQUIRE_FILE_THREAD() assert(CefCurrentlyOn(TID_FILE));
|
||||
|
||||
AtomCefClient::AtomCefClient(){
|
||||
}
|
||||
|
||||
AtomCefClient::AtomCefClient(bool handlePasteboardCommands, bool ignoreTitleChanges) {
|
||||
m_HandlePasteboardCommands = handlePasteboardCommands;
|
||||
m_IgnoreTitleChanges = ignoreTitleChanges;
|
||||
}
|
||||
|
||||
AtomCefClient::~AtomCefClient() {
|
||||
}
|
||||
|
||||
bool AtomCefClient::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) {
|
||||
std::string name = message->GetName().ToString();
|
||||
CefRefPtr<CefListValue> argumentList = message->GetArgumentList();
|
||||
int messageId = argumentList->GetInt(0);
|
||||
|
||||
if (name == "open") {
|
||||
bool hasArguments = argumentList->GetSize() > 1;
|
||||
hasArguments ? Open(argumentList->GetString(1)) : Open();
|
||||
}
|
||||
if (name == "openDev") {
|
||||
bool hasArguments = argumentList->GetSize() > 1;
|
||||
hasArguments ? OpenDev(argumentList->GetString(1)) : OpenDev();
|
||||
}
|
||||
else if (name == "newWindow") {
|
||||
NewWindow();
|
||||
}
|
||||
else if (name == "toggleDevTools") {
|
||||
ToggleDevTools(browser);
|
||||
}
|
||||
else if (name == "showDevTools") {
|
||||
ShowDevTools(browser);
|
||||
}
|
||||
else if (name == "confirm") {
|
||||
std::string message = argumentList->GetString(1).ToString();
|
||||
std::string detailedMessage = argumentList->GetString(2).ToString();
|
||||
std::vector<std::string> buttonLabels(argumentList->GetSize() - 3);
|
||||
for (int i = 3; i < argumentList->GetSize(); i++) {
|
||||
buttonLabels[i - 3] = argumentList->GetString(i).ToString();
|
||||
}
|
||||
|
||||
Confirm(messageId, message, detailedMessage, buttonLabels, browser);
|
||||
}
|
||||
else if (name == "showSaveDialog") {
|
||||
ShowSaveDialog(messageId, browser);
|
||||
}
|
||||
else if (name == "focus") {
|
||||
GetBrowser()->GetHost()->SetFocus(true);
|
||||
}
|
||||
else if (name == "exit") {
|
||||
Exit(argumentList->GetInt(1));
|
||||
}
|
||||
else if (name == "log") {
|
||||
std::string message = argumentList->GetString(1).ToString();
|
||||
Log(message.c_str());
|
||||
}
|
||||
else if (name == "beginTracing") {
|
||||
BeginTracing();
|
||||
}
|
||||
else if (name == "endTracing") {
|
||||
EndTracing();
|
||||
}
|
||||
else if (name == "show") {
|
||||
Show(browser);
|
||||
}
|
||||
else if (name == "toggleFullScreen") {
|
||||
ToggleFullScreen(browser);
|
||||
}
|
||||
else if (name == "getVersion") {
|
||||
GetVersion(messageId, browser);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AtomCefClient::OnBeforeContextMenu(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
CefRefPtr<CefMenuModel> model) {
|
||||
|
||||
model->Clear();
|
||||
model->AddItem(MENU_ID_USER_FIRST, "&Toggle DevTools");
|
||||
}
|
||||
|
||||
bool AtomCefClient::OnContextMenuCommand(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
int command_id,
|
||||
EventFlags event_flags) {
|
||||
|
||||
if (command_id == MENU_ID_USER_FIRST) {
|
||||
ToggleDevTools(browser);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool AtomCefClient::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
int line) {
|
||||
REQUIRE_UI_THREAD();
|
||||
Log(message.ToString().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AtomCefClient::OnKeyEvent(CefRefPtr<CefBrowser> browser,
|
||||
const CefKeyEvent& event,
|
||||
CefEventHandle os_event) {
|
||||
if (event.modifiers == EVENTFLAG_COMMAND_DOWN && event.unmodified_character == 'r') {
|
||||
browser->SendProcessMessage(PID_RENDERER, CefProcessMessage::Create("reload"));
|
||||
}
|
||||
if (m_HandlePasteboardCommands && event.modifiers == EVENTFLAG_COMMAND_DOWN && event.unmodified_character == 'x') {
|
||||
browser->GetFocusedFrame()->Cut();
|
||||
}
|
||||
if (m_HandlePasteboardCommands && event.modifiers == EVENTFLAG_COMMAND_DOWN && event.unmodified_character == 'c') {
|
||||
browser->GetFocusedFrame()->Copy();
|
||||
}
|
||||
if (m_HandlePasteboardCommands && event.modifiers == EVENTFLAG_COMMAND_DOWN && event.unmodified_character == 'v') {
|
||||
browser->GetFocusedFrame()->Paste();
|
||||
}
|
||||
else if (event.modifiers == (EVENTFLAG_COMMAND_DOWN | EVENTFLAG_ALT_DOWN) && event.unmodified_character == 'i') {
|
||||
ToggleDevTools(browser);
|
||||
} else if (event.modifiers == EVENTFLAG_COMMAND_DOWN && event.unmodified_character == '`') {
|
||||
FocusNextWindow();
|
||||
} else if (event.modifiers == (EVENTFLAG_COMMAND_DOWN | EVENTFLAG_SHIFT_DOWN) && event.unmodified_character == '~') {
|
||||
FocusPreviousWindow();
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AtomCefClient::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
||||
// REQUIRE_UI_THREAD(); // When uncommented this fails when app is terminated
|
||||
m_Browser = NULL;
|
||||
}
|
||||
|
||||
void AtomCefClient::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
AutoLock lock_scope(this);
|
||||
if (!m_Browser.get()) {
|
||||
m_Browser = browser;
|
||||
}
|
||||
|
||||
GetBrowser()->GetHost()->SetFocus(true);
|
||||
}
|
||||
|
||||
void AtomCefClient::OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
const CefString& failedUrl) {
|
||||
REQUIRE_UI_THREAD();
|
||||
frame->LoadString(std::string(errorText) + "<br />" + std::string(failedUrl), failedUrl);
|
||||
}
|
||||
|
||||
void AtomCefClient::BeginTracing() {
|
||||
if (CefCurrentlyOn(TID_UI)) {
|
||||
class Client : public CefTraceClient,
|
||||
public CefRunFileDialogCallback {
|
||||
public:
|
||||
explicit Client(CefRefPtr<AtomCefClient> handler)
|
||||
: handler_(handler),
|
||||
trace_data_("{\"traceEvents\":["),
|
||||
first_(true) {
|
||||
}
|
||||
|
||||
virtual void OnTraceDataCollected(const char* fragment,
|
||||
size_t fragment_size) OVERRIDE {
|
||||
if (first_)
|
||||
first_ = false;
|
||||
else
|
||||
trace_data_.append(",");
|
||||
trace_data_.append(fragment, fragment_size);
|
||||
}
|
||||
|
||||
virtual void OnEndTracingComplete() OVERRIDE {
|
||||
REQUIRE_UI_THREAD();
|
||||
trace_data_.append("]}");
|
||||
|
||||
handler_->GetBrowser()->GetHost()->RunFileDialog(
|
||||
FILE_DIALOG_SAVE, CefString(), "/tmp/atom-trace.txt", std::vector<CefString>(),
|
||||
this);
|
||||
}
|
||||
|
||||
virtual void OnFileDialogDismissed(
|
||||
CefRefPtr<CefBrowserHost> browser_host,
|
||||
const std::vector<CefString>& file_paths) OVERRIDE {
|
||||
if (!file_paths.empty())
|
||||
handler_->Save(file_paths.front(), trace_data_);
|
||||
}
|
||||
|
||||
private:
|
||||
CefRefPtr<AtomCefClient> handler_;
|
||||
std::string trace_data_;
|
||||
bool first_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(Callback);
|
||||
};
|
||||
|
||||
CefBeginTracing(new Client(this), CefString());
|
||||
} else {
|
||||
CefPostTask(TID_UI, NewCefRunnableMethod(this, &AtomCefClient::BeginTracing));
|
||||
}
|
||||
}
|
||||
|
||||
void AtomCefClient::EndTracing() {
|
||||
if (CefCurrentlyOn(TID_UI)) {
|
||||
CefEndTracingAsync();
|
||||
} else {
|
||||
CefPostTask(TID_UI, NewCefRunnableMethod(this, &AtomCefClient::BeginTracing));
|
||||
}
|
||||
}
|
||||
|
||||
bool AtomCefClient::Save(const std::string& path, const std::string& data) {
|
||||
FILE* f = fopen(path.c_str(), "w");
|
||||
if (!f)
|
||||
return false;
|
||||
fwrite(data.c_str(), data.size(), 1, f);
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
#ifndef ATOM_CEF_CLIENT_H_
|
||||
#define ATOM_CEF_CLIENT_H_
|
||||
#pragma once
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include "include/cef_client.h"
|
||||
|
||||
class AtomCefClient : public CefClient,
|
||||
public CefContextMenuHandler,
|
||||
public CefDisplayHandler,
|
||||
public CefJSDialogHandler,
|
||||
public CefKeyboardHandler,
|
||||
public CefLifeSpanHandler,
|
||||
public CefLoadHandler,
|
||||
public CefRequestHandler {
|
||||
public:
|
||||
AtomCefClient();
|
||||
AtomCefClient(bool handlePasteboardCommands, bool ignoreTitleChanges);
|
||||
virtual ~AtomCefClient();
|
||||
|
||||
CefRefPtr<CefBrowser> GetBrowser() { return m_Browser; }
|
||||
|
||||
virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefRequestHandler> GetRequestHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
|
||||
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) OVERRIDE;
|
||||
|
||||
|
||||
// CefContextMenuHandler methods
|
||||
virtual void OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
CefRefPtr<CefMenuModel> model) OVERRIDE;
|
||||
|
||||
virtual bool OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
int command_id,
|
||||
EventFlags event_flags) OVERRIDE;
|
||||
|
||||
// CefDisplayHandler methods
|
||||
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
int line) OVERRIDE;
|
||||
|
||||
virtual void OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title) OVERRIDE;
|
||||
|
||||
// CefJsDialogHandlerMethods
|
||||
virtual bool OnBeforeUnloadDialog(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message_text,
|
||||
bool is_reload,
|
||||
CefRefPtr<CefJSDialogCallback> callback) {
|
||||
callback->Continue(true, "");
|
||||
return true;
|
||||
}
|
||||
|
||||
// CefKeyboardHandler methods
|
||||
virtual bool OnKeyEvent(CefRefPtr<CefBrowser> browser,
|
||||
const CefKeyEvent& event,
|
||||
CefEventHandle os_event) OVERRIDE;
|
||||
|
||||
// CefLifeSpanHandler methods
|
||||
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
|
||||
|
||||
// CefLoadHandler methods
|
||||
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
const CefString& failedUrl) OVERRIDE;
|
||||
|
||||
void BeginTracing();
|
||||
void EndTracing();
|
||||
|
||||
bool Save(const std::string& path, const std::string& data);
|
||||
|
||||
protected:
|
||||
CefRefPtr<CefBrowser> m_Browser;
|
||||
bool m_HandlePasteboardCommands = false;
|
||||
bool m_IgnoreTitleChanges = false;
|
||||
|
||||
void FocusNextWindow();
|
||||
void FocusPreviousWindow();
|
||||
void Open(std::string path);
|
||||
void Open();
|
||||
void OpenDev(std::string path);
|
||||
void OpenDev();
|
||||
void NewWindow();
|
||||
void ToggleDevTools(CefRefPtr<CefBrowser> browser);
|
||||
void ShowDevTools(CefRefPtr<CefBrowser> browser);
|
||||
void Confirm(int replyId,
|
||||
std::string message,
|
||||
std::string detailedMessage,
|
||||
std::vector<std::string> buttonLabels,
|
||||
CefRefPtr<CefBrowser> browser);
|
||||
void ShowSaveDialog(int replyId, CefRefPtr<CefBrowser> browser);
|
||||
CefRefPtr<CefListValue> CreateReplyDescriptor(int replyId, int callbackIndex);
|
||||
void Exit(int status);
|
||||
void Log(const char *message);
|
||||
void Show(CefRefPtr<CefBrowser> browser);
|
||||
void ToggleFullScreen(CefRefPtr<CefBrowser> browser);
|
||||
void GetVersion(int replyId, CefRefPtr<CefBrowser> browser);
|
||||
|
||||
IMPLEMENT_REFCOUNTING(AtomCefClient);
|
||||
IMPLEMENT_LOCKING(AtomCefClient);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,63 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <string>
|
||||
#include "cefclient/client_handler.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
|
||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& url) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||
// Set the edit window text
|
||||
std::string urlStr(url);
|
||||
gtk_entry_set_text(GTK_ENTRY(m_EditHwnd), urlStr.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
GtkWidget* window = gtk_widget_get_ancestor(
|
||||
GTK_WIDGET(browser->GetHost()->GetWindowHandle()),
|
||||
GTK_TYPE_WINDOW);
|
||||
std::string titleStr(title);
|
||||
gtk_window_set_title(GTK_WINDOW(window), titleStr.c_str());
|
||||
}
|
||||
|
||||
void ClientHandler::SendNotification(NotificationType type) {
|
||||
// TODO(port): Implement this method.
|
||||
}
|
||||
|
||||
void ClientHandler::SetLoading(bool isLoading) {
|
||||
if (isLoading)
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_StopHwnd), true);
|
||||
else
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_StopHwnd), false);
|
||||
}
|
||||
|
||||
void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) {
|
||||
if (canGoBack)
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_BackHwnd), true);
|
||||
else
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_BackHwnd), false);
|
||||
|
||||
if (canGoForward)
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_ForwardHwnd), true);
|
||||
else
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_ForwardHwnd), false);
|
||||
}
|
||||
|
||||
void ClientHandler::CloseMainWindow() {
|
||||
// TODO(port): Close main window.
|
||||
}
|
||||
|
||||
std::string ClientHandler::GetDownloadPath(const std::string& file_name) {
|
||||
return std::string();
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <iostream>
|
||||
#import "include/cef_browser.h"
|
||||
#import "include/cef_frame.h"
|
||||
#import "native/atom_cef_client.h"
|
||||
#import "atom_application.h"
|
||||
#import "atom_window_controller.h"
|
||||
#import "atom_application.h"
|
||||
|
||||
void AtomCefClient::FocusNextWindow() {
|
||||
NSArray *windows = [NSApp windows];
|
||||
int count = [windows count];
|
||||
int start = [windows indexOfObject:[NSApp keyWindow]];
|
||||
|
||||
int i = start;
|
||||
while (true) {
|
||||
i = (i + 1) % count;
|
||||
if (i == start) break;
|
||||
NSWindow *window = [windows objectAtIndex:i];
|
||||
if ([window isVisible] && ![window isExcludedFromWindowsMenu]) {
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AtomCefClient::FocusPreviousWindow() {
|
||||
NSArray *windows = [NSApp windows];
|
||||
int count = [windows count];
|
||||
int start = [windows indexOfObject:[NSApp keyWindow]];
|
||||
|
||||
int i = start;
|
||||
while (true) {
|
||||
i = i - 1;
|
||||
if (i == 0) i = count -1;
|
||||
if (i == start) break;
|
||||
NSWindow *window = [windows objectAtIndex:i];
|
||||
if ([window isVisible] && ![window isExcludedFromWindowsMenu]) {
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AtomCefClient::Open(std::string path) {
|
||||
NSString *pathString = [NSString stringWithCString:path.c_str() encoding:NSUTF8StringEncoding];
|
||||
[(AtomApplication *)[AtomApplication sharedApplication] open:pathString];
|
||||
}
|
||||
|
||||
void AtomCefClient::Open() {
|
||||
NSOpenPanel *panel = [NSOpenPanel openPanel];
|
||||
[panel setCanChooseDirectories:YES];
|
||||
if ([panel runModal] == NSFileHandlingPanelOKButton) {
|
||||
NSURL *url = [[panel URLs] lastObject];
|
||||
Open([[url path] UTF8String]);
|
||||
}
|
||||
}
|
||||
|
||||
void AtomCefClient::OpenDev(std::string path) {
|
||||
NSString *pathString = [NSString stringWithCString:path.c_str() encoding:NSUTF8StringEncoding];
|
||||
[(AtomApplication *)[AtomApplication sharedApplication] openDev:pathString];
|
||||
}
|
||||
|
||||
void AtomCefClient::OpenDev() {
|
||||
NSOpenPanel *panel = [NSOpenPanel openPanel];
|
||||
[panel setCanChooseDirectories:YES];
|
||||
if ([panel runModal] == NSFileHandlingPanelOKButton) {
|
||||
NSURL *url = [[panel URLs] lastObject];
|
||||
OpenDev([[url path] UTF8String]);
|
||||
}
|
||||
}
|
||||
|
||||
void AtomCefClient::NewWindow() {
|
||||
[(AtomApplication *)[AtomApplication sharedApplication] open:nil];
|
||||
}
|
||||
|
||||
void AtomCefClient::Confirm(int replyId,
|
||||
std::string message,
|
||||
std::string detailedMessage,
|
||||
std::vector<std::string> buttonLabels,
|
||||
CefRefPtr<CefBrowser> browser) {
|
||||
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
||||
[alert setMessageText:[NSString stringWithCString:message.c_str() encoding:NSUTF8StringEncoding]];
|
||||
[alert setInformativeText:[NSString stringWithCString:detailedMessage.c_str() encoding:NSUTF8StringEncoding]];
|
||||
|
||||
for (int i = 0; i < buttonLabels.size(); i++) {
|
||||
NSString *title = [NSString stringWithCString:buttonLabels[i].c_str() encoding:NSUTF8StringEncoding];
|
||||
NSButton *button = [alert addButtonWithTitle:title];
|
||||
[button setTag:i];
|
||||
}
|
||||
|
||||
NSUInteger clickedButtonTag = [alert runModal];
|
||||
|
||||
CefRefPtr<CefProcessMessage> replyMessage = CefProcessMessage::Create("reply");
|
||||
CefRefPtr<CefListValue> replyArguments = replyMessage->GetArgumentList();
|
||||
replyArguments->SetSize(1);
|
||||
replyArguments->SetList(0, CreateReplyDescriptor(replyId, clickedButtonTag));
|
||||
browser->SendProcessMessage(PID_RENDERER, replyMessage);
|
||||
}
|
||||
|
||||
|
||||
void AtomCefClient::OnTitleChange(CefRefPtr<CefBrowser> browser, const CefString& title) {
|
||||
if (m_IgnoreTitleChanges) return;
|
||||
|
||||
NSWindow *window = [browser->GetHost()->GetWindowHandle() window];
|
||||
[window setTitle:[NSString stringWithUTF8String:title.ToString().c_str()]];
|
||||
}
|
||||
|
||||
void AtomCefClient::ToggleDevTools(CefRefPtr<CefBrowser> browser) {
|
||||
AtomWindowController *windowController = [[browser->GetHost()->GetWindowHandle() window] windowController];
|
||||
[windowController toggleDevTools];
|
||||
}
|
||||
|
||||
void AtomCefClient::ShowDevTools(CefRefPtr<CefBrowser> browser) {
|
||||
AtomWindowController *windowController = [[browser->GetHost()->GetWindowHandle() window] windowController];
|
||||
[windowController showDevTools];
|
||||
}
|
||||
|
||||
void AtomCefClient::Show(CefRefPtr<CefBrowser> browser) {
|
||||
AtomWindowController *windowController = [[browser->GetHost()->GetWindowHandle() window] windowController];
|
||||
[windowController.webView setHidden:NO];
|
||||
}
|
||||
|
||||
void AtomCefClient::ToggleFullScreen(CefRefPtr<CefBrowser> browser) {
|
||||
[[browser->GetHost()->GetWindowHandle() window] toggleFullScreen:nil];
|
||||
}
|
||||
|
||||
void AtomCefClient::ShowSaveDialog(int replyId, CefRefPtr<CefBrowser> browser) {
|
||||
CefRefPtr<CefProcessMessage> replyMessage = CefProcessMessage::Create("reply");
|
||||
CefRefPtr<CefListValue> replyArguments = replyMessage->GetArgumentList();
|
||||
|
||||
NSSavePanel *panel = [NSSavePanel savePanel];
|
||||
if ([panel runModal] == NSFileHandlingPanelOKButton) {
|
||||
CefString path = CefString([[[panel URL] path] UTF8String]);
|
||||
replyArguments->SetSize(2);
|
||||
replyArguments->SetString(1, path);
|
||||
}
|
||||
else {
|
||||
replyArguments->SetSize(1);
|
||||
}
|
||||
replyArguments->SetList(0, CreateReplyDescriptor(replyId, 0));
|
||||
|
||||
browser->SendProcessMessage(PID_RENDERER, replyMessage);
|
||||
}
|
||||
|
||||
CefRefPtr<CefListValue> AtomCefClient::CreateReplyDescriptor(int replyId, int callbackIndex) {
|
||||
CefRefPtr<CefListValue> descriptor = CefListValue::Create();
|
||||
descriptor->SetSize(2);
|
||||
descriptor->SetInt(0, replyId);
|
||||
descriptor->SetInt(1, callbackIndex);
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
void AtomCefClient::Exit(int status) {
|
||||
exit(status);
|
||||
}
|
||||
|
||||
void AtomCefClient::Log(const char *message) {
|
||||
std::cout << message << "\n";
|
||||
}
|
||||
|
||||
void AtomCefClient::GetVersion(int replyId, CefRefPtr<CefBrowser> browser) {
|
||||
CefRefPtr<CefProcessMessage> replyMessage = CefProcessMessage::Create("reply");
|
||||
CefRefPtr<CefListValue> replyArguments = replyMessage->GetArgumentList();
|
||||
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
|
||||
|
||||
replyArguments->SetSize(2);
|
||||
replyArguments->SetString(1, [version UTF8String]);
|
||||
replyArguments->SetList(0, CreateReplyDescriptor(replyId, 0));
|
||||
browser->SendProcessMessage(PID_RENDERER, replyMessage);
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cefclient/client_handler.h"
|
||||
|
||||
#include <string>
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "cefclient/resource.h"
|
||||
|
||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& url) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||
// Set the edit window text
|
||||
SetWindowText(m_EditHwnd, std::wstring(url).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
// Set the frame window title bar
|
||||
CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle();
|
||||
if (m_BrowserId == browser->GetIdentifier()) {
|
||||
// The frame window will be the parent of the browser window
|
||||
hwnd = GetParent(hwnd);
|
||||
}
|
||||
SetWindowText(hwnd, std::wstring(title).c_str());
|
||||
}
|
||||
|
||||
void ClientHandler::SendNotification(NotificationType type) {
|
||||
UINT id;
|
||||
switch (type) {
|
||||
case NOTIFY_CONSOLE_MESSAGE:
|
||||
id = ID_WARN_CONSOLEMESSAGE;
|
||||
break;
|
||||
case NOTIFY_DOWNLOAD_COMPLETE:
|
||||
id = ID_WARN_DOWNLOADCOMPLETE;
|
||||
break;
|
||||
case NOTIFY_DOWNLOAD_ERROR:
|
||||
id = ID_WARN_DOWNLOADERROR;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
PostMessage(m_MainHwnd, WM_COMMAND, id, 0);
|
||||
}
|
||||
|
||||
void ClientHandler::SetLoading(bool isLoading) {
|
||||
ASSERT(m_EditHwnd != NULL && m_ReloadHwnd != NULL && m_StopHwnd != NULL);
|
||||
EnableWindow(m_EditHwnd, TRUE);
|
||||
EnableWindow(m_ReloadHwnd, !isLoading);
|
||||
EnableWindow(m_StopHwnd, isLoading);
|
||||
}
|
||||
|
||||
void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) {
|
||||
ASSERT(m_BackHwnd != NULL && m_ForwardHwnd != NULL);
|
||||
EnableWindow(m_BackHwnd, canGoBack);
|
||||
EnableWindow(m_ForwardHwnd, canGoForward);
|
||||
}
|
||||
|
||||
void ClientHandler::CloseMainWindow() {
|
||||
::PostMessage(m_MainHwnd, WM_CLOSE, 0, 0);
|
||||
}
|
||||
|
||||
std::string ClientHandler::GetDownloadPath(const std::string& file_name) {
|
||||
TCHAR szFolderPath[MAX_PATH];
|
||||
std::string path;
|
||||
|
||||
// Save the file in the user's "My Documents" folder.
|
||||
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE,
|
||||
NULL, 0, szFolderPath))) {
|
||||
path = CefString(szFolderPath);
|
||||
path += "\\" + file_name;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef ATOM_CEF_RENDER_PROCESS_HANDLER_H_
|
||||
#define ATOM_CEF_RENDER_PROCESS_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_app.h"
|
||||
|
||||
class AtomCefRenderProcessHandler : public CefRenderProcessHandler {
|
||||
|
||||
virtual void OnWebKitInitialized() OVERRIDE;
|
||||
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) OVERRIDE;
|
||||
virtual void OnContextReleased(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) OVERRIDE;
|
||||
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) OVERRIDE;
|
||||
virtual void OnWorkerContextCreated(int worker_id,
|
||||
const CefString& url,
|
||||
CefRefPtr<CefV8Context> context) OVERRIDE;
|
||||
virtual void OnWorkerContextReleased(int worker_id,
|
||||
const CefString& url,
|
||||
CefRefPtr<CefV8Context> context) OVERRIDE;
|
||||
virtual void OnWorkerUncaughtException(int worker_id,
|
||||
const CefString& url,
|
||||
CefRefPtr<CefV8Context> context,
|
||||
CefRefPtr<CefV8Exception> exception,
|
||||
CefRefPtr<CefV8StackTrace> stackTrace) OVERRIDE;
|
||||
|
||||
void Reload(CefRefPtr<CefBrowser> browser);
|
||||
void Shutdown(CefRefPtr<CefBrowser> browser);
|
||||
bool CallMessageReceivedHandler(CefRefPtr<CefV8Context> context, CefRefPtr<CefProcessMessage> message);
|
||||
void InjectExtensionsIntoV8Context(CefRefPtr<CefV8Context> context);
|
||||
|
||||
IMPLEMENT_REFCOUNTING(AtomCefRenderProcessHandler);
|
||||
};
|
||||
|
||||
#endif // ATOM_CEF_RENDER_PROCESS_HANDLER_H_
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
#import <iostream>
|
||||
#import "native/v8_extensions/atom.h"
|
||||
#import "native/v8_extensions/native.h"
|
||||
#import "native/v8_extensions/onig_reg_exp.h"
|
||||
#import "native/v8_extensions/onig_scanner.h"
|
||||
#import "native/v8_extensions/git.h"
|
||||
#import "native/v8_extensions/tags.h"
|
||||
#import "native/message_translation.h"
|
||||
#import "path_watcher.h"
|
||||
#import "atom_cef_render_process_handler.h"
|
||||
|
||||
|
||||
void AtomCefRenderProcessHandler::OnWebKitInitialized() {
|
||||
}
|
||||
|
||||
void AtomCefRenderProcessHandler::OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) {
|
||||
InjectExtensionsIntoV8Context(context);
|
||||
}
|
||||
|
||||
void AtomCefRenderProcessHandler::OnContextReleased(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) {
|
||||
[PathWatcher removePathWatcherForContext:context];
|
||||
}
|
||||
|
||||
void AtomCefRenderProcessHandler::OnWorkerContextCreated(int worker_id,
|
||||
const CefString& url,
|
||||
CefRefPtr<CefV8Context> context) {
|
||||
InjectExtensionsIntoV8Context(context);
|
||||
}
|
||||
|
||||
void AtomCefRenderProcessHandler::OnWorkerContextReleased(int worker_id,
|
||||
const CefString& url,
|
||||
CefRefPtr<CefV8Context> context) {
|
||||
NSLog(@"Web worker context released");
|
||||
}
|
||||
|
||||
void AtomCefRenderProcessHandler::OnWorkerUncaughtException(int worker_id,
|
||||
const CefString& url,
|
||||
CefRefPtr<CefV8Context> context,
|
||||
CefRefPtr<CefV8Exception> exception,
|
||||
CefRefPtr<CefV8StackTrace> stackTrace) {
|
||||
|
||||
std::string message = exception->GetMessage().ToString();
|
||||
NSLog(@"Exception throw in worker thread %s", message.c_str());
|
||||
}
|
||||
|
||||
bool AtomCefRenderProcessHandler::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) {
|
||||
std::string name = message->GetName().ToString();
|
||||
|
||||
if (name == "reload") {
|
||||
Reload(browser);
|
||||
return true;
|
||||
}
|
||||
else if (name == "shutdown") {
|
||||
Shutdown(browser);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return CallMessageReceivedHandler(browser->GetMainFrame()->GetV8Context(), message);
|
||||
}
|
||||
}
|
||||
|
||||
void AtomCefRenderProcessHandler::Reload(CefRefPtr<CefBrowser> browser) {
|
||||
CefRefPtr<CefV8Context> context = browser->GetMainFrame()->GetV8Context();
|
||||
CefRefPtr<CefV8Value> global = context->GetGlobal();
|
||||
|
||||
context->Enter();
|
||||
CefV8ValueList arguments;
|
||||
|
||||
CefRefPtr<CefV8Value> reloadFunction = global->GetValue("reload");
|
||||
reloadFunction->ExecuteFunction(global, arguments);
|
||||
if (!reloadFunction->IsFunction() || reloadFunction->HasException()) {
|
||||
browser->ReloadIgnoreCache();
|
||||
}
|
||||
context->Exit();
|
||||
}
|
||||
|
||||
void AtomCefRenderProcessHandler::Shutdown(CefRefPtr<CefBrowser> browser) {
|
||||
CefRefPtr<CefV8Context> context = browser->GetMainFrame()->GetV8Context();
|
||||
CefRefPtr<CefV8Value> global = context->GetGlobal();
|
||||
|
||||
context->Enter();
|
||||
CefV8ValueList arguments;
|
||||
CefRefPtr<CefV8Value> shutdownFunction = global->GetValue("shutdown");
|
||||
shutdownFunction->ExecuteFunction(global, arguments);
|
||||
context->Exit();
|
||||
}
|
||||
|
||||
bool AtomCefRenderProcessHandler::CallMessageReceivedHandler(CefRefPtr<CefV8Context> context, CefRefPtr<CefProcessMessage> message) {
|
||||
context->Enter();
|
||||
|
||||
CefRefPtr<CefV8Value> atom = context->GetGlobal()->GetValue("atom");
|
||||
CefRefPtr<CefV8Value> receiveFn = atom->GetValue("receiveMessageFromBrowserProcess");
|
||||
|
||||
CefV8ValueList arguments;
|
||||
arguments.push_back(CefV8Value::CreateString(message->GetName().ToString()));
|
||||
|
||||
CefRefPtr<CefListValue> messageArguments = message->GetArgumentList();
|
||||
if (messageArguments->GetSize() > 0) {
|
||||
CefRefPtr<CefV8Value> data = CefV8Value::CreateArray(messageArguments->GetSize());
|
||||
TranslateList(messageArguments, data);
|
||||
arguments.push_back(data);
|
||||
}
|
||||
|
||||
receiveFn->ExecuteFunction(atom, arguments);
|
||||
context->Exit();
|
||||
|
||||
if (receiveFn->HasException()) {
|
||||
std::cout << "ERROR: Exception in JS receiving message " << message->GetName().ToString() << "\n";
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void AtomCefRenderProcessHandler::InjectExtensionsIntoV8Context(CefRefPtr<CefV8Context> context) {
|
||||
// these objects are deleted when the context removes all references to them
|
||||
(new v8_extensions::Atom())->CreateContextBinding(context);
|
||||
(new v8_extensions::Native())->CreateContextBinding(context);
|
||||
(new v8_extensions::Git())->CreateContextBinding(context);
|
||||
(new v8_extensions::OnigRegExp())->CreateContextBinding(context);
|
||||
(new v8_extensions::OnigScanner())->CreateContextBinding(context);
|
||||
(new v8_extensions::Tags())->CreateContextBinding(context);
|
||||
}
|
||||
@@ -1,408 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
#include "cefclient/cefclient.h"
|
||||
#include "include/cef_app.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_runnable.h"
|
||||
#include "cefclient/binding_test.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
#include "cefclient/dom_test.h"
|
||||
#include "cefclient/scheme_test.h"
|
||||
#include "cefclient/string_util.h"
|
||||
|
||||
char szWorkingDir[512]; // The current working directory
|
||||
|
||||
// The global ClientHandler reference.
|
||||
extern CefRefPtr<ClientHandler> g_handler;
|
||||
|
||||
void destroy(void) {
|
||||
CefQuitMessageLoop();
|
||||
}
|
||||
|
||||
void TerminationSignalHandler(int signatl) {
|
||||
destroy();
|
||||
}
|
||||
|
||||
// Callback for Debug > Get Source... menu item.
|
||||
gboolean GetSourceActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunGetSourceTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Get Source... menu item.
|
||||
gboolean GetTextActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunGetTextTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Request... menu item.
|
||||
gboolean RequestActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunRequestTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Local Storage... menu item.
|
||||
gboolean LocalStorageActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunLocalStorageTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > XMLHttpRequest... menu item.
|
||||
gboolean XMLHttpRequestActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunXMLHTTPRequestTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Scheme Handler... menu item.
|
||||
gboolean SchemeHandlerActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
scheme_test::RunTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > JavaScript Binding... menu item.
|
||||
gboolean BindingActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
binding_test::RunTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Plugin Info... menu item.
|
||||
gboolean PluginInfoActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunPluginInfoTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > DOM Access... menu item.
|
||||
gboolean DOMAccessActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
dom_test::RunTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Popup Window... menu item.
|
||||
gboolean PopupWindowActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunPopupTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Accelerated 2D Canvas... menu item.
|
||||
gboolean Accelerated2DCanvasActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunAccelerated2DCanvasTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Accelerated Layers... menu item.
|
||||
gboolean AcceleratedLayersActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunAcceleratedLayersTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > WebGL... menu item.
|
||||
gboolean WebGLActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunWebGLTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > HTML5 Video... menu item.
|
||||
gboolean HTML5VideoActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunHTML5VideoTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > HTML5 Drag & Drop... menu item.
|
||||
gboolean HTML5DragDropActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunDragDropTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
|
||||
// Callback for Debug > Zoom In... menu item.
|
||||
gboolean ZoomInActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() + 0.5);
|
||||
}
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Zoom Out... menu item.
|
||||
gboolean ZoomOutActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() - 0.5);
|
||||
}
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Zoom Reset... menu item.
|
||||
gboolean ZoomResetActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
browser->GetHost()->SetZoomLevel(0.0);
|
||||
}
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for when you click the back button.
|
||||
void BackButtonClicked(GtkButton* button) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
g_handler->GetBrowser()->GoBack();
|
||||
}
|
||||
|
||||
// Callback for when you click the forward button.
|
||||
void ForwardButtonClicked(GtkButton* button) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
g_handler->GetBrowser()->GoForward();
|
||||
}
|
||||
|
||||
// Callback for when you click the stop button.
|
||||
void StopButtonClicked(GtkButton* button) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
g_handler->GetBrowser()->StopLoad();
|
||||
}
|
||||
|
||||
// Callback for when you click the reload button.
|
||||
void ReloadButtonClicked(GtkButton* button) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
g_handler->GetBrowser()->Reload();
|
||||
}
|
||||
|
||||
// Callback for when you press enter in the URL box.
|
||||
void URLEntryActivate(GtkEntry* entry) {
|
||||
if (!g_handler.get() || !g_handler->GetBrowserId())
|
||||
return;
|
||||
|
||||
const gchar* url = gtk_entry_get_text(entry);
|
||||
g_handler->GetBrowser()->GetMainFrame()->LoadURL(std::string(url).c_str());
|
||||
}
|
||||
|
||||
// GTK utility functions ----------------------------------------------
|
||||
|
||||
GtkWidget* AddMenuEntry(GtkWidget* menu_widget, const char* text,
|
||||
GCallback callback) {
|
||||
GtkWidget* entry = gtk_menu_item_new_with_label(text);
|
||||
g_signal_connect(entry, "activate", callback, NULL);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(menu_widget), entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
GtkWidget* CreateMenu(GtkWidget* menu_bar, const char* text) {
|
||||
GtkWidget* menu_widget = gtk_menu_new();
|
||||
GtkWidget* menu_header = gtk_menu_item_new_with_label(text);
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_header), menu_widget);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), menu_header);
|
||||
return menu_widget;
|
||||
}
|
||||
|
||||
GtkWidget* CreateMenuBar() {
|
||||
GtkWidget* menu_bar = gtk_menu_bar_new();
|
||||
GtkWidget* debug_menu = CreateMenu(menu_bar, "Tests");
|
||||
|
||||
AddMenuEntry(debug_menu, "Get Source",
|
||||
G_CALLBACK(GetSourceActivated));
|
||||
AddMenuEntry(debug_menu, "Get Text",
|
||||
G_CALLBACK(GetTextActivated));
|
||||
AddMenuEntry(debug_menu, "Request",
|
||||
G_CALLBACK(RequestActivated));
|
||||
AddMenuEntry(debug_menu, "Local Storage",
|
||||
G_CALLBACK(LocalStorageActivated));
|
||||
AddMenuEntry(debug_menu, "XMLHttpRequest",
|
||||
G_CALLBACK(XMLHttpRequestActivated));
|
||||
AddMenuEntry(debug_menu, "Scheme Handler",
|
||||
G_CALLBACK(SchemeHandlerActivated));
|
||||
AddMenuEntry(debug_menu, "JavaScript Binding",
|
||||
G_CALLBACK(BindingActivated));
|
||||
AddMenuEntry(debug_menu, "Plugin Info",
|
||||
G_CALLBACK(PluginInfoActivated));
|
||||
AddMenuEntry(debug_menu, "DOM Access",
|
||||
G_CALLBACK(DOMAccessActivated));
|
||||
AddMenuEntry(debug_menu, "Popup Window",
|
||||
G_CALLBACK(PopupWindowActivated));
|
||||
AddMenuEntry(debug_menu, "Accelerated 2D Canvas",
|
||||
G_CALLBACK(Accelerated2DCanvasActivated));
|
||||
AddMenuEntry(debug_menu, "Accelerated Layers",
|
||||
G_CALLBACK(AcceleratedLayersActivated));
|
||||
AddMenuEntry(debug_menu, "WebGL",
|
||||
G_CALLBACK(WebGLActivated));
|
||||
AddMenuEntry(debug_menu, "HTML5 Video",
|
||||
G_CALLBACK(HTML5VideoActivated));
|
||||
AddMenuEntry(debug_menu, "HTML5 Drag & Drop",
|
||||
G_CALLBACK(HTML5DragDropActivated));
|
||||
AddMenuEntry(debug_menu, "Zoom In",
|
||||
G_CALLBACK(ZoomInActivated));
|
||||
AddMenuEntry(debug_menu, "Zoom Out",
|
||||
G_CALLBACK(ZoomOutActivated));
|
||||
AddMenuEntry(debug_menu, "Zoom Reset",
|
||||
G_CALLBACK(ZoomResetActivated));
|
||||
return menu_bar;
|
||||
}
|
||||
|
||||
// WebViewDelegate::TakeFocus in the test webview delegate.
|
||||
static gboolean HandleFocus(GtkWidget* widget,
|
||||
GdkEventFocus* focus) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
// Give focus to the browser window.
|
||||
g_handler->GetBrowser()->GetHost()->SetFocus(true);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
CefMainArgs main_args(argc, argv);
|
||||
CefRefPtr<ClientApp> app(new ClientApp);
|
||||
|
||||
// Execute the secondary process, if any.
|
||||
int exit_code = CefExecuteProcess(main_args, app.get());
|
||||
if (exit_code >= 0)
|
||||
return exit_code;
|
||||
|
||||
if (!getcwd(szWorkingDir, sizeof (szWorkingDir)))
|
||||
return -1;
|
||||
|
||||
GtkWidget* window;
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
// Parse command line arguments.
|
||||
AppInitCommandLine(argc, argv);
|
||||
|
||||
CefSettings settings;
|
||||
|
||||
// Populate the settings based on command line arguments.
|
||||
AppGetSettings(settings, app);
|
||||
|
||||
// Initialize CEF.
|
||||
CefInitialize(main_args, settings, app.get());
|
||||
|
||||
// Register the scheme handler.
|
||||
scheme_test::InitTest();
|
||||
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
|
||||
|
||||
g_signal_connect(window, "focus", G_CALLBACK(&HandleFocus), NULL);
|
||||
|
||||
GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
|
||||
|
||||
GtkWidget* menu_bar = CreateMenuBar();
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 0);
|
||||
|
||||
GtkWidget* toolbar = gtk_toolbar_new();
|
||||
// Turn off the labels on the toolbar buttons.
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
|
||||
|
||||
GtkToolItem* back = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK);
|
||||
g_signal_connect(back, "clicked",
|
||||
G_CALLBACK(BackButtonClicked), NULL);
|
||||
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), back, -1 /* append */);
|
||||
|
||||
GtkToolItem* forward = gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD);
|
||||
g_signal_connect(forward, "clicked",
|
||||
G_CALLBACK(ForwardButtonClicked), NULL);
|
||||
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), forward, -1 /* append */);
|
||||
|
||||
GtkToolItem* reload = gtk_tool_button_new_from_stock(GTK_STOCK_REFRESH);
|
||||
g_signal_connect(reload, "clicked",
|
||||
G_CALLBACK(ReloadButtonClicked), NULL);
|
||||
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), reload, -1 /* append */);
|
||||
|
||||
GtkToolItem* stop = gtk_tool_button_new_from_stock(GTK_STOCK_STOP);
|
||||
g_signal_connect(stop, "clicked",
|
||||
G_CALLBACK(StopButtonClicked), NULL);
|
||||
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), stop, -1 /* append */);
|
||||
|
||||
GtkWidget* m_editWnd = gtk_entry_new();
|
||||
g_signal_connect(G_OBJECT(m_editWnd), "activate",
|
||||
G_CALLBACK(URLEntryActivate), NULL);
|
||||
|
||||
GtkToolItem* tool_item = gtk_tool_item_new();
|
||||
gtk_container_add(GTK_CONTAINER(tool_item), m_editWnd);
|
||||
gtk_tool_item_set_expand(tool_item, TRUE);
|
||||
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), tool_item, -1); // append
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
|
||||
|
||||
g_signal_connect(G_OBJECT(window), "destroy",
|
||||
G_CALLBACK(gtk_widget_destroyed), &window);
|
||||
g_signal_connect(G_OBJECT(window), "destroy",
|
||||
G_CALLBACK(destroy), NULL);
|
||||
|
||||
// Create the handler.
|
||||
g_handler = new ClientHandler();
|
||||
g_handler->SetMainHwnd(vbox);
|
||||
g_handler->SetEditHwnd(m_editWnd);
|
||||
g_handler->SetButtonHwnds(GTK_WIDGET(back), GTK_WIDGET(forward),
|
||||
GTK_WIDGET(reload), GTK_WIDGET(stop));
|
||||
|
||||
// Create the browser view.
|
||||
CefWindowInfo window_info;
|
||||
CefBrowserSettings browserSettings;
|
||||
|
||||
// Populate the settings based on command line arguments.
|
||||
AppGetBrowserSettings(browserSettings);
|
||||
|
||||
window_info.SetAsChild(vbox);
|
||||
|
||||
CefBrowserHost::CreateBrowserSync(
|
||||
window_info, g_handler.get(),
|
||||
g_handler->GetStartupURL(), browserSettings);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
gtk_widget_show_all(GTK_WIDGET(window));
|
||||
|
||||
// Install an signal handler so we clean up after ourselves.
|
||||
signal(SIGINT, TerminationSignalHandler);
|
||||
signal(SIGTERM, TerminationSignalHandler);
|
||||
|
||||
CefRunMessageLoop();
|
||||
|
||||
CefShutdown();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Global functions
|
||||
|
||||
std::string AppGetWorkingDirectory() {
|
||||
return szWorkingDir;
|
||||
}
|
||||
@@ -1,546 +0,0 @@
|
||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cefclient/cefclient.h"
|
||||
#include <windows.h>
|
||||
#include <commdlg.h>
|
||||
#include <shellapi.h>
|
||||
#include <direct.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "include/cef_app.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_runnable.h"
|
||||
#include "cefclient/binding_test.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
#include "cefclient/dom_test.h"
|
||||
#include "cefclient/resource.h"
|
||||
#include "cefclient/scheme_test.h"
|
||||
#include "cefclient/string_util.h"
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
#define MAX_URL_LENGTH 255
|
||||
#define BUTTON_WIDTH 72
|
||||
#define URLBAR_HEIGHT 24
|
||||
|
||||
// Global Variables:
|
||||
HINSTANCE hInst; // current instance
|
||||
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
|
||||
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
|
||||
char szWorkingDir[MAX_PATH]; // The current working directory
|
||||
|
||||
// Forward declarations of functions included in this code module:
|
||||
ATOM MyRegisterClass(HINSTANCE hInstance);
|
||||
BOOL InitInstance(HINSTANCE, int);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
// The global ClientHandler reference.
|
||||
extern CefRefPtr<ClientHandler> g_handler;
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Add Common Controls to the application manifest because it's required to
|
||||
// support the default tooltip implementation.
|
||||
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
|
||||
#endif
|
||||
|
||||
// Program entry point function.
|
||||
int APIENTRY wWinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPTSTR lpCmdLine,
|
||||
int nCmdShow) {
|
||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
|
||||
CefMainArgs main_args(hInstance);
|
||||
CefRefPtr<ClientApp> app(new ClientApp);
|
||||
|
||||
// Execute the secondary process, if any.
|
||||
int exit_code = CefExecuteProcess(main_args, app.get());
|
||||
if (exit_code >= 0)
|
||||
return exit_code;
|
||||
|
||||
// Retrieve the current working directory.
|
||||
if (_getcwd(szWorkingDir, MAX_PATH) == NULL)
|
||||
szWorkingDir[0] = 0;
|
||||
|
||||
// Parse command line arguments. The passed in values are ignored on Windows.
|
||||
AppInitCommandLine(0, NULL);
|
||||
|
||||
CefSettings settings;
|
||||
|
||||
// Populate the settings based on command line arguments.
|
||||
AppGetSettings(settings, app);
|
||||
|
||||
// Initialize CEF.
|
||||
CefInitialize(main_args, settings, app.get());
|
||||
|
||||
// Register the scheme handler.
|
||||
scheme_test::InitTest();
|
||||
|
||||
HACCEL hAccelTable;
|
||||
|
||||
// Initialize global strings
|
||||
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
|
||||
LoadString(hInstance, IDC_CEFCLIENT, szWindowClass, MAX_LOADSTRING);
|
||||
MyRegisterClass(hInstance);
|
||||
|
||||
// Perform application initialization
|
||||
if (!InitInstance (hInstance, nCmdShow))
|
||||
return FALSE;
|
||||
|
||||
hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_CEFCLIENT));
|
||||
|
||||
int result = 0;
|
||||
|
||||
if (!settings.multi_threaded_message_loop) {
|
||||
// Run the CEF message loop. This function will block until the application
|
||||
// recieves a WM_QUIT message.
|
||||
CefRunMessageLoop();
|
||||
} else {
|
||||
MSG msg;
|
||||
|
||||
// Run the application message loop.
|
||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
result = static_cast<int>(msg.wParam);
|
||||
}
|
||||
|
||||
// Shut down CEF.
|
||||
CefShutdown();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: MyRegisterClass()
|
||||
//
|
||||
// PURPOSE: Registers the window class.
|
||||
//
|
||||
// COMMENTS:
|
||||
//
|
||||
// This function and its usage are only necessary if you want this code
|
||||
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
|
||||
// function that was added to Windows 95. It is important to call this
|
||||
// function so that the application will get 'well formed' small icons
|
||||
// associated with it.
|
||||
//
|
||||
ATOM MyRegisterClass(HINSTANCE hInstance) {
|
||||
WNDCLASSEX wcex;
|
||||
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_CEFCLIENT));
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_CEFCLIENT);
|
||||
wcex.lpszClassName = szWindowClass;
|
||||
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
|
||||
|
||||
return RegisterClassEx(&wcex);
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: InitInstance(HINSTANCE, int)
|
||||
//
|
||||
// PURPOSE: Saves instance handle and creates main window
|
||||
//
|
||||
// COMMENTS:
|
||||
//
|
||||
// In this function, we save the instance handle in a global variable and
|
||||
// create and display the main program window.
|
||||
//
|
||||
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) {
|
||||
HWND hWnd;
|
||||
|
||||
hInst = hInstance; // Store instance handle in our global variable
|
||||
|
||||
hWnd = CreateWindow(szWindowClass, szTitle,
|
||||
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, CW_USEDEFAULT, 0,
|
||||
CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
|
||||
|
||||
if (!hWnd)
|
||||
return FALSE;
|
||||
|
||||
ShowWindow(hWnd, nCmdShow);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Change the zoom factor on the UI thread.
|
||||
static void ModifyZoom(CefRefPtr<CefBrowser> browser, double delta) {
|
||||
if (CefCurrentlyOn(TID_UI)) {
|
||||
browser->GetHost()->SetZoomLevel(
|
||||
browser->GetHost()->GetZoomLevel() + delta);
|
||||
} else {
|
||||
CefPostTask(TID_UI, NewCefRunnableFunction(ModifyZoom, browser, delta));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
|
||||
//
|
||||
// PURPOSE: Processes messages for the main window.
|
||||
//
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||
LPARAM lParam) {
|
||||
static HWND backWnd = NULL, forwardWnd = NULL, reloadWnd = NULL,
|
||||
stopWnd = NULL, editWnd = NULL;
|
||||
static WNDPROC editWndOldProc = NULL;
|
||||
|
||||
// Static members used for the find dialog.
|
||||
static FINDREPLACE fr;
|
||||
static WCHAR szFindWhat[80] = {0};
|
||||
static WCHAR szLastFindWhat[80] = {0};
|
||||
static bool findNext = false;
|
||||
static bool lastMatchCase = false;
|
||||
|
||||
int wmId, wmEvent;
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc;
|
||||
|
||||
if (hWnd == editWnd) {
|
||||
// Callback for the edit window
|
||||
switch (message) {
|
||||
case WM_CHAR:
|
||||
if (wParam == VK_RETURN && g_handler.get()) {
|
||||
// When the user hits the enter key load the URL
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
wchar_t strPtr[MAX_URL_LENGTH+1] = {0};
|
||||
*((LPWORD)strPtr) = MAX_URL_LENGTH;
|
||||
LRESULT strLen = SendMessage(hWnd, EM_GETLINE, 0, (LPARAM)strPtr);
|
||||
if (strLen > 0) {
|
||||
strPtr[strLen] = 0;
|
||||
browser->GetMainFrame()->LoadURL(strPtr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return (LRESULT)CallWindowProc(editWndOldProc, hWnd, message, wParam,
|
||||
lParam);
|
||||
} else {
|
||||
// Callback for the main window
|
||||
switch (message) {
|
||||
case WM_CREATE: {
|
||||
// Create the single static handler class instance
|
||||
g_handler = new ClientHandler();
|
||||
g_handler->SetMainHwnd(hWnd);
|
||||
|
||||
// Create the child windows used for navigation
|
||||
RECT rect;
|
||||
int x = 0;
|
||||
|
||||
GetClientRect(hWnd, &rect);
|
||||
|
||||
backWnd = CreateWindow(L"BUTTON", L"Back",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
|
||||
| WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
|
||||
hWnd, (HMENU) IDC_NAV_BACK, hInst, 0);
|
||||
x += BUTTON_WIDTH;
|
||||
|
||||
forwardWnd = CreateWindow(L"BUTTON", L"Forward",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
|
||||
| WS_DISABLED, x, 0, BUTTON_WIDTH,
|
||||
URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_FORWARD,
|
||||
hInst, 0);
|
||||
x += BUTTON_WIDTH;
|
||||
|
||||
reloadWnd = CreateWindow(L"BUTTON", L"Reload",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
|
||||
| WS_DISABLED, x, 0, BUTTON_WIDTH,
|
||||
URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_RELOAD,
|
||||
hInst, 0);
|
||||
x += BUTTON_WIDTH;
|
||||
|
||||
stopWnd = CreateWindow(L"BUTTON", L"Stop",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
|
||||
| WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
|
||||
hWnd, (HMENU) IDC_NAV_STOP, hInst, 0);
|
||||
x += BUTTON_WIDTH;
|
||||
|
||||
editWnd = CreateWindow(L"EDIT", 0,
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
|
||||
ES_AUTOVSCROLL | ES_AUTOHSCROLL| WS_DISABLED,
|
||||
x, 0, rect.right - BUTTON_WIDTH * 4,
|
||||
URLBAR_HEIGHT, hWnd, 0, hInst, 0);
|
||||
|
||||
// Assign the edit window's WNDPROC to this function so that we can
|
||||
// capture the enter key
|
||||
editWndOldProc =
|
||||
reinterpret_cast<WNDPROC>(GetWindowLongPtr(editWnd, GWLP_WNDPROC));
|
||||
SetWindowLongPtr(editWnd, GWLP_WNDPROC,
|
||||
reinterpret_cast<LONG_PTR>(WndProc));
|
||||
g_handler->SetEditHwnd(editWnd);
|
||||
g_handler->SetButtonHwnds(backWnd, forwardWnd, reloadWnd, stopWnd);
|
||||
|
||||
rect.top += URLBAR_HEIGHT;
|
||||
|
||||
CefWindowInfo info;
|
||||
CefBrowserSettings settings;
|
||||
|
||||
// Populate the settings based on command line arguments.
|
||||
AppGetBrowserSettings(settings);
|
||||
|
||||
// Initialize window info to the defaults for a child window
|
||||
info.SetAsChild(hWnd, rect);
|
||||
|
||||
// Creat the new child browser window
|
||||
CefBrowserHost::CreateBrowser(info, g_handler.get(),
|
||||
g_handler->GetStartupURL(), settings);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_COMMAND: {
|
||||
CefRefPtr<CefBrowser> browser;
|
||||
if (g_handler.get())
|
||||
browser = g_handler->GetBrowser();
|
||||
|
||||
wmId = LOWORD(wParam);
|
||||
wmEvent = HIWORD(wParam);
|
||||
// Parse the menu selections:
|
||||
switch (wmId) {
|
||||
case IDM_ABOUT:
|
||||
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
|
||||
return 0;
|
||||
case IDM_EXIT:
|
||||
DestroyWindow(hWnd);
|
||||
return 0;
|
||||
case ID_WARN_CONSOLEMESSAGE:
|
||||
if (g_handler.get()) {
|
||||
std::wstringstream ss;
|
||||
ss << L"Console messages will be written to "
|
||||
<< std::wstring(CefString(g_handler->GetLogFile()));
|
||||
MessageBox(hWnd, ss.str().c_str(), L"Console Messages",
|
||||
MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
return 0;
|
||||
case ID_WARN_DOWNLOADCOMPLETE:
|
||||
case ID_WARN_DOWNLOADERROR:
|
||||
if (g_handler.get()) {
|
||||
std::wstringstream ss;
|
||||
ss << L"File \"" <<
|
||||
std::wstring(CefString(g_handler->GetLastDownloadFile())) <<
|
||||
L"\" ";
|
||||
|
||||
if (wmId == ID_WARN_DOWNLOADCOMPLETE)
|
||||
ss << L"downloaded successfully.";
|
||||
else
|
||||
ss << L"failed to download.";
|
||||
|
||||
MessageBox(hWnd, ss.str().c_str(), L"File Download",
|
||||
MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
return 0;
|
||||
case IDC_NAV_BACK: // Back button
|
||||
if (browser.get())
|
||||
browser->GoBack();
|
||||
return 0;
|
||||
case IDC_NAV_FORWARD: // Forward button
|
||||
if (browser.get())
|
||||
browser->GoForward();
|
||||
return 0;
|
||||
case IDC_NAV_RELOAD: // Reload button
|
||||
if (browser.get())
|
||||
browser->Reload();
|
||||
return 0;
|
||||
case IDC_NAV_STOP: // Stop button
|
||||
if (browser.get())
|
||||
browser->StopLoad();
|
||||
return 0;
|
||||
case ID_TESTS_GETSOURCE: // Test the GetSource function
|
||||
if (browser.get())
|
||||
RunGetSourceTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_GETTEXT: // Test the GetText function
|
||||
if (browser.get())
|
||||
RunGetTextTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_POPUP: // Test a popup window
|
||||
if (browser.get())
|
||||
RunPopupTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_REQUEST: // Test a request
|
||||
if (browser.get())
|
||||
RunRequestTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_SCHEME_HANDLER: // Test the scheme handler
|
||||
if (browser.get())
|
||||
scheme_test::RunTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_BINDING: // Test JavaScript binding
|
||||
if (browser.get())
|
||||
binding_test::RunTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_DIALOGS: // Test JavaScript dialogs
|
||||
if (browser.get())
|
||||
RunDialogTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_PLUGIN_INFO: // Test plugin info
|
||||
if (browser.get())
|
||||
RunPluginInfoTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_DOM_ACCESS: // Test DOM access
|
||||
if (browser.get())
|
||||
dom_test::RunTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_LOCALSTORAGE: // Test localStorage
|
||||
if (browser.get())
|
||||
RunLocalStorageTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_ACCELERATED2DCANVAS: // Test accelerated 2d canvas
|
||||
if (browser.get())
|
||||
RunAccelerated2DCanvasTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_ACCELERATEDLAYERS: // Test accelerated layers
|
||||
if (browser.get())
|
||||
RunAcceleratedLayersTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_WEBGL: // Test WebGL
|
||||
if (browser.get())
|
||||
RunWebGLTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_HTML5VIDEO: // Test HTML5 video
|
||||
if (browser.get())
|
||||
RunHTML5VideoTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_XMLHTTPREQUEST: // Test XMLHttpRequest
|
||||
if (browser.get())
|
||||
RunXMLHTTPRequestTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_DRAGDROP: // Test drag & drop
|
||||
if (browser.get())
|
||||
RunDragDropTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_GEOLOCATION: // Test geolocation
|
||||
if (browser.get())
|
||||
RunGeolocationTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_ZOOM_IN:
|
||||
if (browser.get())
|
||||
ModifyZoom(browser, 0.5);
|
||||
return 0;
|
||||
case ID_TESTS_ZOOM_OUT:
|
||||
if (browser.get())
|
||||
ModifyZoom(browser, -0.5);
|
||||
return 0;
|
||||
case ID_TESTS_ZOOM_RESET:
|
||||
if (browser.get())
|
||||
browser->GetHost()->SetZoomLevel(0.0);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PAINT:
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
EndPaint(hWnd, &ps);
|
||||
return 0;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
if (g_handler.get() && g_handler->GetBrowser()) {
|
||||
// Pass focus to the browser window
|
||||
CefWindowHandle hwnd =
|
||||
g_handler->GetBrowser()->GetHost()->GetWindowHandle();
|
||||
if (hwnd)
|
||||
PostMessage(hwnd, WM_SETFOCUS, wParam, NULL);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WM_SIZE:
|
||||
// Minimizing resizes the window to 0x0 which causes our layout to go all
|
||||
// screwy, so we just ignore it.
|
||||
if (wParam != SIZE_MINIMIZED && g_handler.get() &&
|
||||
g_handler->GetBrowser()) {
|
||||
CefWindowHandle hwnd =
|
||||
g_handler->GetBrowser()->GetHost()->GetWindowHandle();
|
||||
if (hwnd) {
|
||||
// Resize the browser window and address bar to match the new frame
|
||||
// window size
|
||||
RECT rect;
|
||||
GetClientRect(hWnd, &rect);
|
||||
rect.top += URLBAR_HEIGHT;
|
||||
|
||||
int urloffset = rect.left + BUTTON_WIDTH * 4;
|
||||
|
||||
HDWP hdwp = BeginDeferWindowPos(1);
|
||||
hdwp = DeferWindowPos(hdwp, editWnd, NULL, urloffset,
|
||||
0, rect.right - urloffset, URLBAR_HEIGHT, SWP_NOZORDER);
|
||||
hdwp = DeferWindowPos(hdwp, hwnd, NULL,
|
||||
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_NOZORDER);
|
||||
EndDeferWindowPos(hdwp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
if (g_handler.get() && g_handler->GetBrowser()) {
|
||||
CefWindowHandle hwnd =
|
||||
g_handler->GetBrowser()->GetHost()->GetWindowHandle();
|
||||
if (hwnd) {
|
||||
// Dont erase the background if the browser window has been loaded
|
||||
// (this avoids flashing)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
if (g_handler.get()) {
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
if (browser.get()) {
|
||||
// Let the browser window know we are about to destroy it.
|
||||
browser->GetHost()->ParentWindowWillClose();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
// The frame window has exited
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
||||
// Message handler for about box.
|
||||
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
return (INT_PTR)TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return (INT_PTR)TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return (INT_PTR)FALSE;
|
||||
}
|
||||
|
||||
|
||||
// Global functions
|
||||
|
||||
std::string AppGetWorkingDirectory() {
|
||||
return szWorkingDir;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
#include "include/cef_app.h"
|
||||
|
||||
class AtomCefClient;
|
||||
|
||||
@interface AtomWindowController : NSWindowController <NSWindowDelegate> {
|
||||
NSSplitView *_splitView;
|
||||
NSView *_devToolsView;
|
||||
NSView *_webView;
|
||||
NSString *_bootstrapScript;
|
||||
NSString *_resourcePath;
|
||||
NSString *_pathToOpen;
|
||||
NSNumber *_pidToKillOnClose;
|
||||
|
||||
CefRefPtr<AtomCefClient> _cefClient;
|
||||
CefRefPtr<AtomCefClient> _cefDevToolsClient;
|
||||
CefRefPtr<CefV8Context> _atomContext;
|
||||
|
||||
BOOL _runningSpecs;
|
||||
BOOL _exitWhenDone;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) IBOutlet NSSplitView *splitView;
|
||||
@property (nonatomic, retain) IBOutlet NSView *webView;
|
||||
@property (nonatomic, retain) IBOutlet NSView *devToolsView;
|
||||
@property (nonatomic, retain) NSString *pathToOpen;
|
||||
|
||||
- (id)initWithPath:(NSString *)path;
|
||||
- (id)initDevWithPath:(NSString *)path;
|
||||
- (id)initInBackground;
|
||||
- (id)initSpecsThenExit:(BOOL)exitWhenDone;
|
||||
- (id)initBenchmarksThenExit:(BOOL)exitWhenDone;
|
||||
- (void)setPidToKillOnClose:(NSNumber *)pid;
|
||||
|
||||
- (void)toggleDevTools;
|
||||
- (void)showDevTools;
|
||||
|
||||
@end
|
||||
@@ -1,255 +0,0 @@
|
||||
#import "include/cef_application_mac.h"
|
||||
#import "include/cef_client.h"
|
||||
#import "native/atom_cef_client.h"
|
||||
#import "native/atom_window_controller.h"
|
||||
#import "native/atom_application.h"
|
||||
#import <signal.h>
|
||||
|
||||
@implementation AtomWindowController
|
||||
|
||||
@synthesize splitView=_splitView;
|
||||
@synthesize webView=_webView;
|
||||
@synthesize devToolsView=_devToolsView;
|
||||
@synthesize pathToOpen=_pathToOpen;
|
||||
|
||||
- (void)dealloc {
|
||||
[_splitView release];
|
||||
[_devToolsView release];
|
||||
[_webView release];
|
||||
[_bootstrapScript release];
|
||||
[_resourcePath release];
|
||||
[_pathToOpen release];
|
||||
|
||||
_cefClient = NULL;
|
||||
_cefDevToolsClient = NULL;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)initWithBootstrapScript:(NSString *)bootstrapScript background:(BOOL)background alwaysUseBundleResourcePath:(BOOL)alwaysUseBundleResourcePath {
|
||||
self = [super initWithWindowNibName:@"AtomWindow"];
|
||||
_bootstrapScript = [bootstrapScript retain];
|
||||
|
||||
AtomApplication *atomApplication = (AtomApplication *)[AtomApplication sharedApplication];
|
||||
|
||||
_resourcePath = [atomApplication.arguments objectForKey:@"resource-path"];
|
||||
if (!alwaysUseBundleResourcePath && !_resourcePath) {
|
||||
NSString *defaultRepositoryPath = @"~/github/atom";
|
||||
defaultRepositoryPath = [defaultRepositoryPath stringByStandardizingPath];
|
||||
if ([defaultRepositoryPath characterAtIndex:0] == '/') {
|
||||
BOOL isDir = false;
|
||||
BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:defaultRepositoryPath isDirectory:&isDir];
|
||||
if (isDir && exists)
|
||||
_resourcePath = defaultRepositoryPath;
|
||||
}
|
||||
}
|
||||
|
||||
if (alwaysUseBundleResourcePath || !_resourcePath) {
|
||||
_resourcePath = [[NSBundle mainBundle] resourcePath];
|
||||
}
|
||||
[_resourcePath retain];
|
||||
|
||||
if (!background) {
|
||||
[self setShouldCascadeWindows:NO];
|
||||
[self setWindowFrameAutosaveName:@"AtomWindow"];
|
||||
NSColor *background = [NSColor colorWithDeviceRed:(51.0/255.0) green:(51.0/255.0f) blue:(51.0/255.0f) alpha:1.0];
|
||||
[self.window setBackgroundColor:background];
|
||||
[self showWindow:self];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithPath:(NSString *)path {
|
||||
_pathToOpen = [path retain];
|
||||
AtomApplication *atomApplication = (AtomApplication *)[AtomApplication sharedApplication];
|
||||
BOOL useBundleResourcePath = [atomApplication.arguments objectForKey:@"dev"] == nil;
|
||||
return [self initWithBootstrapScript:@"window-bootstrap" background:NO alwaysUseBundleResourcePath:useBundleResourcePath];
|
||||
}
|
||||
|
||||
- (id)initDevWithPath:(NSString *)path {
|
||||
_pathToOpen = [path retain];
|
||||
AtomApplication *atomApplication = (AtomApplication *)[AtomApplication sharedApplication];
|
||||
return [self initWithBootstrapScript:@"window-bootstrap" background:NO alwaysUseBundleResourcePath:false];
|
||||
}
|
||||
|
||||
- (id)initInBackground {
|
||||
AtomApplication *atomApplication = (AtomApplication *)[AtomApplication sharedApplication];
|
||||
BOOL useBundleResourcePath = [atomApplication.arguments objectForKey:@"dev"] == nil;
|
||||
|
||||
[self initWithBootstrapScript:@"window-bootstrap" background:YES alwaysUseBundleResourcePath:useBundleResourcePath];
|
||||
[self.window setFrame:NSMakeRect(0, 0, 0, 0) display:NO];
|
||||
[self.window setExcludedFromWindowsMenu:YES];
|
||||
[self.window setCollectionBehavior:NSWindowCollectionBehaviorStationary];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initSpecsThenExit:(BOOL)exitWhenDone {
|
||||
_runningSpecs = true;
|
||||
_exitWhenDone = exitWhenDone;
|
||||
return [self initWithBootstrapScript:@"spec-bootstrap" background:NO alwaysUseBundleResourcePath:NO];
|
||||
}
|
||||
|
||||
- (id)initBenchmarksThenExit:(BOOL)exitWhenDone {
|
||||
_runningSpecs = true;
|
||||
_exitWhenDone = exitWhenDone;
|
||||
return [self initWithBootstrapScript:@"benchmark-bootstrap" background:NO alwaysUseBundleResourcePath:NO];
|
||||
}
|
||||
|
||||
- (void)addBrowserToView:(NSView *)view url:(const char *)url cefHandler:(CefRefPtr<AtomCefClient>)cefClient {
|
||||
CefBrowserSettings settings;
|
||||
[self populateBrowserSettings:settings];
|
||||
CefWindowInfo window_info;
|
||||
window_info.SetAsChild(view, 0, 0, view.bounds.size.width, view.bounds.size.height);
|
||||
CefBrowserHost::CreateBrowser(window_info, cefClient.get(), url, settings);
|
||||
}
|
||||
|
||||
- (NSString *)encodeUrlParam:(NSString *)param {
|
||||
param = [param stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
param = [param stringByReplacingOccurrencesOfString:@"&" withString:@"%26"];
|
||||
return param;
|
||||
}
|
||||
|
||||
- (void)windowDidLoad {
|
||||
[self.window setDelegate:self];
|
||||
[self performSelector:@selector(attachWebView) withObject:nil afterDelay:0];
|
||||
}
|
||||
|
||||
// If this is run directly in windowDidLoad, the web view doesn't
|
||||
// have the correct initial size based on the frame's last stored size.
|
||||
// HACK: I hate this and want to place this code directly in windowDidLoad
|
||||
- (void)attachWebView {
|
||||
NSURL *url = [[NSBundle mainBundle] resourceURL];
|
||||
NSMutableString *urlString = [NSMutableString string];
|
||||
[urlString appendString:[[url URLByAppendingPathComponent:@"static/index.html"] absoluteString]];
|
||||
[urlString appendFormat:@"?bootstrapScript=%@", [self encodeUrlParam:_bootstrapScript]];
|
||||
[urlString appendFormat:@"&resourcePath=%@", [self encodeUrlParam:_resourcePath]];
|
||||
if (_exitWhenDone)
|
||||
[urlString appendString:@"&exitWhenDone=1"];
|
||||
if (_pathToOpen)
|
||||
[urlString appendFormat:@"&pathToOpen=%@", [self encodeUrlParam:_pathToOpen]];
|
||||
|
||||
_cefClient = new AtomCefClient();
|
||||
[self.webView setHidden:YES];
|
||||
[self addBrowserToView:self.webView url:[urlString UTF8String] cefHandler:_cefClient];
|
||||
}
|
||||
|
||||
- (void)toggleDevTools {
|
||||
if (_devToolsView) {
|
||||
[self hideDevTools];
|
||||
}
|
||||
else {
|
||||
[self showDevTools];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showDevTools {
|
||||
if (_devToolsView) return;
|
||||
|
||||
if (_cefClient && _cefClient->GetBrowser()) {
|
||||
NSRect webViewFrame = _webView.frame;
|
||||
NSRect devToolsViewFrame = _webView.frame;
|
||||
devToolsViewFrame.size.height = NSHeight(webViewFrame) / 3;
|
||||
webViewFrame.size.height = NSHeight(webViewFrame) - NSHeight(devToolsViewFrame);
|
||||
[_webView setFrame:webViewFrame];
|
||||
_devToolsView = [[NSView alloc] initWithFrame:devToolsViewFrame];
|
||||
|
||||
[_splitView addSubview:_devToolsView];
|
||||
[_splitView adjustSubviews];
|
||||
|
||||
_cefDevToolsClient = new AtomCefClient(true, true);
|
||||
std::string devtools_url = _cefClient->GetBrowser()->GetHost()->GetDevToolsURL(true);
|
||||
[self addBrowserToView:_devToolsView url:devtools_url.c_str() cefHandler:_cefDevToolsClient];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)hideDevTools {
|
||||
[_devToolsView removeFromSuperview];
|
||||
[_splitView adjustSubviews];
|
||||
[_devToolsView release];
|
||||
_devToolsView = nil;
|
||||
_cefDevToolsClient = NULL;
|
||||
_cefClient->GetBrowser()->GetHost()->SetFocus(true);
|
||||
}
|
||||
|
||||
- (void)setPidToKillOnClose:(NSNumber *)pid {
|
||||
_pidToKillOnClose = [pid retain];
|
||||
}
|
||||
|
||||
# pragma mark NSWindowDelegate
|
||||
|
||||
|
||||
- (void)windowDidResignMain:(NSNotification *)notification {
|
||||
if (!_runningSpecs) {
|
||||
[self.window makeFirstResponder:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeMain:(NSNotification *)notification {
|
||||
if (_cefClient && _cefClient->GetBrowser()) {
|
||||
_cefClient->GetBrowser()->GetHost()->SetFocus(true);
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)windowShouldClose:(NSNotification *)notification {
|
||||
if (_cefClient && _cefClient->GetBrowser()) {
|
||||
_cefClient->GetBrowser()->SendProcessMessage(PID_RENDERER, CefProcessMessage::Create("shutdown"));
|
||||
}
|
||||
|
||||
if (_pidToKillOnClose) kill([_pidToKillOnClose intValue], SIGQUIT);
|
||||
|
||||
[self autorelease];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)populateBrowserSettings:(CefBrowserSettings &)settings {
|
||||
CefString(&settings.default_encoding) = "UTF-8";
|
||||
settings.remote_fonts_disabled = false;
|
||||
settings.encoding_detector_enabled = false;
|
||||
settings.javascript_disabled = false;
|
||||
settings.javascript_open_windows_disallowed = false;
|
||||
settings.javascript_close_windows_disallowed = false;
|
||||
settings.javascript_access_clipboard_disallowed = false;
|
||||
settings.dom_paste_disabled = true;
|
||||
settings.caret_browsing_enabled = false;
|
||||
settings.java_disabled = true;
|
||||
settings.plugins_disabled = true;
|
||||
settings.universal_access_from_file_urls_allowed = false;
|
||||
settings.file_access_from_file_urls_allowed = false;
|
||||
settings.web_security_disabled = true;
|
||||
settings.xss_auditor_enabled = true;
|
||||
settings.image_load_disabled = false;
|
||||
settings.shrink_standalone_images_to_fit = false;
|
||||
settings.site_specific_quirks_disabled = false;
|
||||
settings.text_area_resize_disabled = false;
|
||||
settings.page_cache_disabled = true;
|
||||
settings.tab_to_links_disabled = true;
|
||||
settings.hyperlink_auditing_disabled = true;
|
||||
settings.user_style_sheet_enabled = false;
|
||||
settings.author_and_user_styles_disabled = false;
|
||||
settings.local_storage_disabled = false;
|
||||
settings.databases_disabled = false;
|
||||
settings.application_cache_disabled = false;
|
||||
settings.webgl_disabled = false;
|
||||
settings.accelerated_compositing_disabled = false;
|
||||
settings.accelerated_layers_disabled = false;
|
||||
settings.accelerated_video_disabled = false;
|
||||
settings.accelerated_2d_canvas_disabled = false;
|
||||
// settings.accelerated_painting_enabled = true;
|
||||
// settings.accelerated_filters_enabled = true;
|
||||
settings.accelerated_plugins_disabled = false;
|
||||
settings.developer_tools_disabled = false;
|
||||
// settings.fullscreen_enabled = true;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface GraySplitView : NSSplitView
|
||||
- (NSColor*)dividerColor;
|
||||
@end
|
||||
|
||||
@implementation GraySplitView
|
||||
- (NSColor*)dividerColor {
|
||||
return [NSColor darkGrayColor];
|
||||
}
|
||||
@end
|
||||
Arquivo binário não exibido.
@@ -1,91 +0,0 @@
|
||||
// CocoaOniguruma is copyrighted free software by Satoshi Nakagawa <psychs AT limechat DOT net>.
|
||||
// You can redistribute it and/or modify it under the new BSD license.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "oniguruma.h"
|
||||
#import "OnigRegexpUtility.h"
|
||||
|
||||
|
||||
@class OnigResult;
|
||||
|
||||
typedef enum {
|
||||
OnigOptionNone = ONIG_OPTION_NONE,
|
||||
OnigOptionIgnorecase = ONIG_OPTION_IGNORECASE,
|
||||
OnigOptionExtend = ONIG_OPTION_EXTEND,
|
||||
OnigOptionMultiline = ONIG_OPTION_MULTILINE,
|
||||
OnigOptionSingleline = ONIG_OPTION_SINGLELINE,
|
||||
OnigOptionFindLongest = ONIG_OPTION_FIND_LONGEST,
|
||||
OnigOptionFindNotEmpty = ONIG_OPTION_FIND_NOT_EMPTY,
|
||||
OnigOptionNegateSingleLine = ONIG_OPTION_NEGATE_SINGLELINE,
|
||||
OnigOptionDontCaptureGroup = ONIG_OPTION_DONT_CAPTURE_GROUP,
|
||||
OnigOptionCaptureGroup = ONIG_OPTION_CAPTURE_GROUP,
|
||||
|
||||
/* options (search time) */
|
||||
OnigOptionNotbol = ONIG_OPTION_NOTBOL,
|
||||
OnigOptionNoteol = ONIG_OPTION_NOTEOL,
|
||||
OnigOptionPosixRegion = ONIG_OPTION_POSIX_REGION,
|
||||
OnigOptionMaxbit = ONIG_OPTION_MAXBIT
|
||||
} OnigOption;
|
||||
|
||||
@interface OnigRegexp : NSObject
|
||||
{
|
||||
regex_t* _entity;
|
||||
NSString* _expression;
|
||||
}
|
||||
|
||||
+ (OnigRegexp*)compile:(NSString*)expression;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression error:(NSError **)error;
|
||||
+ (OnigRegexp*)compileIgnorecase:(NSString*)expression;
|
||||
+ (OnigRegexp*)compileIgnorecase:(NSString*)expression error:(NSError **)error;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression ignorecase:(BOOL)ignorecase multiline:(BOOL)multiline;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression ignorecase:(BOOL)ignorecase multiline:(BOOL)multiline error:(NSError **)error;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression ignorecase:(BOOL)ignorecase multiline:(BOOL)multiline extended:(BOOL)extended;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression ignorecase:(BOOL)ignorecase multiline:(BOOL)multiline extended:(BOOL)extended error:(NSError **)error;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression options:(OnigOption)options;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression options:(OnigOption)options error:(NSError **)error;
|
||||
|
||||
- (OnigResult*)search:(NSString*)target;
|
||||
- (OnigResult*)search:(NSString*)target start:(int)start;
|
||||
- (OnigResult*)search:(NSString*)target start:(int)start end:(int)end;
|
||||
- (OnigResult*)search:(NSString*)target range:(NSRange)range;
|
||||
|
||||
- (OnigResult*)match:(NSString*)target;
|
||||
- (OnigResult*)match:(NSString*)target start:(int)start;
|
||||
|
||||
- (NSUInteger)captureCount;
|
||||
- (NSString*)expression;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface OnigResult : NSObject
|
||||
{
|
||||
OnigRegexp* _expression;
|
||||
OnigRegion* _region;
|
||||
NSString* _target;
|
||||
NSMutableArray* _captureNames;
|
||||
}
|
||||
|
||||
- (NSString*)target;
|
||||
|
||||
- (int)count;
|
||||
- (NSString*)stringAt:(int)index;
|
||||
- (NSArray*)strings;
|
||||
- (NSRange)rangeAt:(int)index;
|
||||
- (int)locationAt:(int)index;
|
||||
- (int)lengthAt:(int)index;
|
||||
|
||||
- (NSString*)body;
|
||||
- (NSRange)bodyRange;
|
||||
|
||||
- (NSString*)preMatch;
|
||||
- (NSString*)postMatch;
|
||||
|
||||
// named capture support
|
||||
- (NSArray*)captureNames;
|
||||
- (int)indexForName:(NSString*)name;
|
||||
- (NSIndexSet*)indexesForName:(NSString*)name;
|
||||
- (NSString*)stringForName:(NSString*)name;
|
||||
- (NSArray*)stringsForName:(NSString*)name;
|
||||
|
||||
@end
|
||||
@@ -1,57 +0,0 @@
|
||||
// CocoaOniguruma is copyrighted free software by Satoshi Nakagawa <psychs AT limechat DOT net>.
|
||||
// You can redistribute it and/or modify it under the new BSD license.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "oniguruma.h"
|
||||
#import "OnigRegexp.h"
|
||||
|
||||
|
||||
@class OnigRegexp;
|
||||
@class OnigResult;
|
||||
|
||||
|
||||
@interface NSString (OnigRegexpUtility)
|
||||
|
||||
// pattern is OnigRegexp or NSString
|
||||
|
||||
- (NSRange)rangeOfRegexp:(id)pattern;
|
||||
|
||||
// based on ruby's split
|
||||
|
||||
- (NSArray*)split;
|
||||
- (NSArray*)splitByRegexp:(id)pattern;
|
||||
- (NSArray*)splitByRegexp:(id)pattern limit:(int)limit;
|
||||
|
||||
// based on ruby's gsub
|
||||
|
||||
- (NSString*)replaceByRegexp:(id)pattern with:(NSString*)string;
|
||||
- (NSString*)replaceAllByRegexp:(id)pattern with:(NSString*)string;
|
||||
|
||||
- (NSString*)replaceByRegexp:(id)pattern withCallback:(id)object selector:(SEL)sel;
|
||||
- (NSString*)replaceAllByRegexp:(id)pattern withCallback:(id)object selector:(SEL)sel;
|
||||
|
||||
#if defined(NS_BLOCKS_AVAILABLE)
|
||||
- (NSString*)replaceByRegexp:(id)pattern withBlock:(NSString* (^)(OnigResult*))block;
|
||||
- (NSString*)replaceAllByRegexp:(id)pattern withBlock:(NSString* (^)(OnigResult*))block;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface NSMutableString (OnigRegexpUtility)
|
||||
|
||||
// pattern is OnigRegexp or NSString
|
||||
|
||||
// based on ruby's gsub
|
||||
|
||||
- (NSMutableString*)replaceByRegexp:(id)pattern with:(NSString*)string;
|
||||
- (NSMutableString*)replaceAllByRegexp:(id)pattern with:(NSString*)string;
|
||||
|
||||
- (NSMutableString*)replaceByRegexp:(id)pattern withCallback:(id)object selector:(SEL)sel;
|
||||
- (NSMutableString*)replaceAllByRegexp:(id)pattern withCallback:(id)object selector:(SEL)sel;
|
||||
|
||||
#if defined(NS_BLOCKS_AVAILABLE)
|
||||
- (NSMutableString*)replaceByRegexp:(id)pattern withBlock:(NSString* (^)(OnigResult*))block;
|
||||
- (NSMutableString*)replaceAllByRegexp:(id)pattern withBlock:(NSString* (^)(OnigResult*))block;
|
||||
#endif
|
||||
@end
|
||||
@@ -1,770 +0,0 @@
|
||||
#ifndef ONIGURUMA_H
|
||||
#define ONIGURUMA_H
|
||||
/**********************************************************************
|
||||
oniguruma.h - Oniguruma (regular expression library)
|
||||
**********************************************************************/
|
||||
/*-
|
||||
* Copyright (c) 2002-2009 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ONIGURUMA
|
||||
#define ONIGURUMA_VERSION_MAJOR 5
|
||||
#define ONIGURUMA_VERSION_MINOR 9
|
||||
#define ONIGURUMA_VERSION_TEENY 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef HAVE_PROTOTYPES
|
||||
# define HAVE_PROTOTYPES 1
|
||||
# endif
|
||||
# ifndef HAVE_STDARG_PROTOTYPES
|
||||
# define HAVE_STDARG_PROTOTYPES 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* escape Mac OS X/Xcode 2.4/gcc 4.0.1 problem */
|
||||
#if defined(__APPLE__) && defined(__GNUC__) && __GNUC__ >= 4
|
||||
# ifndef HAVE_STDARG_PROTOTYPES
|
||||
# define HAVE_STDARG_PROTOTYPES 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
# ifndef HAVE_STDARG_PROTOTYPES
|
||||
# define HAVE_STDARG_PROTOTYPES 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef P_
|
||||
#if defined(__STDC__) || defined(_WIN32)
|
||||
# define P_(args) args
|
||||
#else
|
||||
# define P_(args) ()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PV_
|
||||
#ifdef HAVE_STDARG_PROTOTYPES
|
||||
# define PV_(args) args
|
||||
#else
|
||||
# define PV_(args) ()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ONIG_EXTERN
|
||||
#if defined(_WIN32) && !defined(__GNUC__)
|
||||
#if defined(EXPORT) || defined(RUBY_EXPORT)
|
||||
#define ONIG_EXTERN extern __declspec(dllexport)
|
||||
#else
|
||||
#define ONIG_EXTERN extern __declspec(dllimport)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ONIG_EXTERN
|
||||
#define ONIG_EXTERN extern
|
||||
#endif
|
||||
|
||||
/* PART: character encoding */
|
||||
|
||||
#ifndef ONIG_ESCAPE_UCHAR_COLLISION
|
||||
#define UChar OnigUChar
|
||||
#endif
|
||||
|
||||
typedef unsigned char OnigUChar;
|
||||
typedef unsigned long OnigCodePoint;
|
||||
typedef unsigned int OnigCtype;
|
||||
typedef unsigned int OnigDistance;
|
||||
|
||||
#define ONIG_INFINITE_DISTANCE ~((OnigDistance )0)
|
||||
|
||||
typedef unsigned int OnigCaseFoldType; /* case fold flag */
|
||||
|
||||
ONIG_EXTERN OnigCaseFoldType OnigDefaultCaseFoldFlag;
|
||||
|
||||
/* #define ONIGENC_CASE_FOLD_HIRAGANA_KATAKANA (1<<1) */
|
||||
/* #define ONIGENC_CASE_FOLD_KATAKANA_WIDTH (1<<2) */
|
||||
#define ONIGENC_CASE_FOLD_TURKISH_AZERI (1<<20)
|
||||
#define INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR (1<<30)
|
||||
|
||||
#define ONIGENC_CASE_FOLD_MIN INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR
|
||||
#define ONIGENC_CASE_FOLD_DEFAULT OnigDefaultCaseFoldFlag
|
||||
|
||||
|
||||
#define ONIGENC_MAX_COMP_CASE_FOLD_CODE_LEN 3
|
||||
#define ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM 13
|
||||
/* 13 => Unicode:0x1ffc */
|
||||
|
||||
/* code range */
|
||||
#define ONIGENC_CODE_RANGE_NUM(range) ((int )range[0])
|
||||
#define ONIGENC_CODE_RANGE_FROM(range,i) range[((i)*2) + 1]
|
||||
#define ONIGENC_CODE_RANGE_TO(range,i) range[((i)*2) + 2]
|
||||
|
||||
typedef struct {
|
||||
int byte_len; /* argument(original) character(s) byte length */
|
||||
int code_len; /* number of code */
|
||||
OnigCodePoint code[ONIGENC_MAX_COMP_CASE_FOLD_CODE_LEN];
|
||||
} OnigCaseFoldCodeItem;
|
||||
|
||||
typedef struct {
|
||||
OnigCodePoint esc;
|
||||
OnigCodePoint anychar;
|
||||
OnigCodePoint anytime;
|
||||
OnigCodePoint zero_or_one_time;
|
||||
OnigCodePoint one_or_more_time;
|
||||
OnigCodePoint anychar_anytime;
|
||||
} OnigMetaCharTableType;
|
||||
|
||||
typedef int (*OnigApplyAllCaseFoldFunc)(OnigCodePoint from, OnigCodePoint* to, int to_len, void* arg);
|
||||
|
||||
typedef struct OnigEncodingTypeST {
|
||||
int (*mbc_enc_len)(const OnigUChar* p);
|
||||
const char* name;
|
||||
int max_enc_len;
|
||||
int min_enc_len;
|
||||
int (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end);
|
||||
OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end);
|
||||
int (*code_to_mbclen)(OnigCodePoint code);
|
||||
int (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf);
|
||||
int (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to);
|
||||
int (*apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg);
|
||||
int (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[]);
|
||||
int (*property_name_to_ctype)(struct OnigEncodingTypeST* enc, OnigUChar* p, OnigUChar* end);
|
||||
int (*is_code_ctype)(OnigCodePoint code, OnigCtype ctype);
|
||||
int (*get_ctype_code_range)(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[]);
|
||||
OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p);
|
||||
int (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end);
|
||||
} OnigEncodingType;
|
||||
|
||||
typedef OnigEncodingType* OnigEncoding;
|
||||
|
||||
ONIG_EXTERN OnigEncodingType OnigEncodingASCII;
|
||||
ONIG_EXTERN OnigEncodingType OnigEncodingUTF16_BE;
|
||||
ONIG_EXTERN OnigEncodingType OnigEncodingUTF16_LE;
|
||||
ONIG_EXTERN OnigEncodingType OnigEncodingUTF32_BE;
|
||||
ONIG_EXTERN OnigEncodingType OnigEncodingUTF32_LE;
|
||||
|
||||
#define ONIG_ENCODING_ASCII (&OnigEncodingASCII)
|
||||
#define ONIG_ENCODING_UTF16_BE (&OnigEncodingUTF16_BE)
|
||||
#define ONIG_ENCODING_UTF16_LE (&OnigEncodingUTF16_LE)
|
||||
#define ONIG_ENCODING_UTF32_BE (&OnigEncodingUTF32_BE)
|
||||
#define ONIG_ENCODING_UTF32_LE (&OnigEncodingUTF32_LE)
|
||||
|
||||
#define ONIG_ENCODING_UNDEF ((OnigEncoding )0)
|
||||
|
||||
|
||||
/* work size */
|
||||
#define ONIGENC_CODE_TO_MBC_MAXLEN 7
|
||||
#define ONIGENC_MBC_CASE_FOLD_MAXLEN 18
|
||||
/* 18: 6(max-byte) * 3(case-fold chars) */
|
||||
|
||||
/* character types */
|
||||
#define ONIGENC_CTYPE_NEWLINE 0
|
||||
#define ONIGENC_CTYPE_ALPHA 1
|
||||
#define ONIGENC_CTYPE_BLANK 2
|
||||
#define ONIGENC_CTYPE_CNTRL 3
|
||||
#define ONIGENC_CTYPE_DIGIT 4
|
||||
#define ONIGENC_CTYPE_GRAPH 5
|
||||
#define ONIGENC_CTYPE_LOWER 6
|
||||
#define ONIGENC_CTYPE_PRINT 7
|
||||
#define ONIGENC_CTYPE_PUNCT 8
|
||||
#define ONIGENC_CTYPE_SPACE 9
|
||||
#define ONIGENC_CTYPE_UPPER 10
|
||||
#define ONIGENC_CTYPE_XDIGIT 11
|
||||
#define ONIGENC_CTYPE_WORD 12
|
||||
#define ONIGENC_CTYPE_ALNUM 13 /* alpha || digit */
|
||||
#define ONIGENC_CTYPE_ASCII 14
|
||||
#define ONIGENC_MAX_STD_CTYPE ONIGENC_CTYPE_ASCII
|
||||
|
||||
|
||||
#define onig_enc_len(enc,p,end) ONIGENC_MBC_ENC_LEN(enc,p)
|
||||
|
||||
#define ONIGENC_IS_UNDEF(enc) ((enc) == ONIG_ENCODING_UNDEF)
|
||||
#define ONIGENC_IS_SINGLEBYTE(enc) (ONIGENC_MBC_MAXLEN(enc) == 1)
|
||||
#define ONIGENC_IS_MBC_HEAD(enc,p) (ONIGENC_MBC_ENC_LEN(enc,p) != 1)
|
||||
#define ONIGENC_IS_MBC_ASCII(p) (*(p) < 128)
|
||||
#define ONIGENC_IS_CODE_ASCII(code) ((code) < 128)
|
||||
#define ONIGENC_IS_MBC_WORD(enc,s,end) \
|
||||
ONIGENC_IS_CODE_WORD(enc,ONIGENC_MBC_TO_CODE(enc,s,end))
|
||||
|
||||
|
||||
#define ONIGENC_NAME(enc) ((enc)->name)
|
||||
|
||||
#define ONIGENC_MBC_CASE_FOLD(enc,flag,pp,end,buf) \
|
||||
(enc)->mbc_case_fold(flag,(const OnigUChar** )pp,end,buf)
|
||||
#define ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc,s,end) \
|
||||
(enc)->is_allowed_reverse_match(s,end)
|
||||
#define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,start,s) \
|
||||
(enc)->left_adjust_char_head(start, s)
|
||||
#define ONIGENC_APPLY_ALL_CASE_FOLD(enc,case_fold_flag,f,arg) \
|
||||
(enc)->apply_all_case_fold(case_fold_flag,f,arg)
|
||||
#define ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc,case_fold_flag,p,end,acs) \
|
||||
(enc)->get_case_fold_codes_by_str(case_fold_flag,p,end,acs)
|
||||
#define ONIGENC_STEP_BACK(enc,start,s,n) \
|
||||
onigenc_step_back((enc),(start),(s),(n))
|
||||
|
||||
#define ONIGENC_MBC_ENC_LEN(enc,p) (enc)->mbc_enc_len(p)
|
||||
#define ONIGENC_MBC_MAXLEN(enc) ((enc)->max_enc_len)
|
||||
#define ONIGENC_MBC_MAXLEN_DIST(enc) ONIGENC_MBC_MAXLEN(enc)
|
||||
#define ONIGENC_MBC_MINLEN(enc) ((enc)->min_enc_len)
|
||||
#define ONIGENC_IS_MBC_NEWLINE(enc,p,end) (enc)->is_mbc_newline((p),(end))
|
||||
#define ONIGENC_MBC_TO_CODE(enc,p,end) (enc)->mbc_to_code((p),(end))
|
||||
#define ONIGENC_CODE_TO_MBCLEN(enc,code) (enc)->code_to_mbclen(code)
|
||||
#define ONIGENC_CODE_TO_MBC(enc,code,buf) (enc)->code_to_mbc(code,buf)
|
||||
#define ONIGENC_PROPERTY_NAME_TO_CTYPE(enc,p,end) \
|
||||
(enc)->property_name_to_ctype(enc,p,end)
|
||||
|
||||
#define ONIGENC_IS_CODE_CTYPE(enc,code,ctype) (enc)->is_code_ctype(code,ctype)
|
||||
|
||||
#define ONIGENC_IS_CODE_NEWLINE(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_NEWLINE)
|
||||
#define ONIGENC_IS_CODE_GRAPH(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_GRAPH)
|
||||
#define ONIGENC_IS_CODE_PRINT(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PRINT)
|
||||
#define ONIGENC_IS_CODE_ALNUM(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALNUM)
|
||||
#define ONIGENC_IS_CODE_ALPHA(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALPHA)
|
||||
#define ONIGENC_IS_CODE_LOWER(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_LOWER)
|
||||
#define ONIGENC_IS_CODE_UPPER(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_UPPER)
|
||||
#define ONIGENC_IS_CODE_CNTRL(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_CNTRL)
|
||||
#define ONIGENC_IS_CODE_PUNCT(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PUNCT)
|
||||
#define ONIGENC_IS_CODE_SPACE(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_SPACE)
|
||||
#define ONIGENC_IS_CODE_BLANK(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_BLANK)
|
||||
#define ONIGENC_IS_CODE_DIGIT(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_DIGIT)
|
||||
#define ONIGENC_IS_CODE_XDIGIT(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_XDIGIT)
|
||||
#define ONIGENC_IS_CODE_WORD(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_WORD)
|
||||
|
||||
#define ONIGENC_GET_CTYPE_CODE_RANGE(enc,ctype,sbout,ranges) \
|
||||
(enc)->get_ctype_code_range(ctype,sbout,ranges)
|
||||
|
||||
ONIG_EXTERN
|
||||
OnigUChar* onigenc_step_back P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, int n));
|
||||
|
||||
|
||||
/* encoding API */
|
||||
ONIG_EXTERN
|
||||
int onigenc_init P_((void));
|
||||
ONIG_EXTERN
|
||||
int onigenc_set_default_encoding P_((OnigEncoding enc));
|
||||
ONIG_EXTERN
|
||||
OnigEncoding onigenc_get_default_encoding P_((void));
|
||||
ONIG_EXTERN
|
||||
void onigenc_set_default_caseconv_table P_((const OnigUChar* table));
|
||||
ONIG_EXTERN
|
||||
OnigUChar* onigenc_get_right_adjust_char_head_with_prev P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar** prev));
|
||||
ONIG_EXTERN
|
||||
OnigUChar* onigenc_get_prev_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s));
|
||||
ONIG_EXTERN
|
||||
OnigUChar* onigenc_get_left_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s));
|
||||
ONIG_EXTERN
|
||||
OnigUChar* onigenc_get_right_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s));
|
||||
ONIG_EXTERN
|
||||
int onigenc_strlen P_((OnigEncoding enc, const OnigUChar* p, const OnigUChar* end));
|
||||
ONIG_EXTERN
|
||||
int onigenc_strlen_null P_((OnigEncoding enc, const OnigUChar* p));
|
||||
ONIG_EXTERN
|
||||
int onigenc_str_bytelen_null P_((OnigEncoding enc, const OnigUChar* p));
|
||||
|
||||
|
||||
|
||||
/* PART: regular expression */
|
||||
|
||||
/* config parameters */
|
||||
#define ONIG_NREGION 10
|
||||
#define ONIG_MAX_BACKREF_NUM 1000
|
||||
#define ONIG_MAX_REPEAT_NUM 100000
|
||||
#define ONIG_MAX_MULTI_BYTE_RANGES_NUM 10000
|
||||
/* constants */
|
||||
#define ONIG_MAX_ERROR_MESSAGE_LEN 90
|
||||
|
||||
typedef unsigned int OnigOptionType;
|
||||
|
||||
#define ONIG_OPTION_DEFAULT ONIG_OPTION_NONE
|
||||
|
||||
/* options */
|
||||
#define ONIG_OPTION_NONE 0U
|
||||
#define ONIG_OPTION_IGNORECASE 1U
|
||||
#define ONIG_OPTION_EXTEND (ONIG_OPTION_IGNORECASE << 1)
|
||||
#define ONIG_OPTION_MULTILINE (ONIG_OPTION_EXTEND << 1)
|
||||
#define ONIG_OPTION_SINGLELINE (ONIG_OPTION_MULTILINE << 1)
|
||||
#define ONIG_OPTION_FIND_LONGEST (ONIG_OPTION_SINGLELINE << 1)
|
||||
#define ONIG_OPTION_FIND_NOT_EMPTY (ONIG_OPTION_FIND_LONGEST << 1)
|
||||
#define ONIG_OPTION_NEGATE_SINGLELINE (ONIG_OPTION_FIND_NOT_EMPTY << 1)
|
||||
#define ONIG_OPTION_DONT_CAPTURE_GROUP (ONIG_OPTION_NEGATE_SINGLELINE << 1)
|
||||
#define ONIG_OPTION_CAPTURE_GROUP (ONIG_OPTION_DONT_CAPTURE_GROUP << 1)
|
||||
/* options (search time) */
|
||||
#define ONIG_OPTION_NOTBOL (ONIG_OPTION_CAPTURE_GROUP << 1)
|
||||
#define ONIG_OPTION_NOTEOL (ONIG_OPTION_NOTBOL << 1)
|
||||
#define ONIG_OPTION_POSIX_REGION (ONIG_OPTION_NOTEOL << 1)
|
||||
#define ONIG_OPTION_MAXBIT ONIG_OPTION_POSIX_REGION /* limit */
|
||||
|
||||
#define ONIG_OPTION_ON(options,regopt) ((options) |= (regopt))
|
||||
#define ONIG_OPTION_OFF(options,regopt) ((options) &= ~(regopt))
|
||||
#define ONIG_IS_OPTION_ON(options,option) ((options) & (option))
|
||||
|
||||
/* syntax */
|
||||
typedef struct {
|
||||
unsigned int op;
|
||||
unsigned int op2;
|
||||
unsigned int behavior;
|
||||
OnigOptionType options; /* default option */
|
||||
OnigMetaCharTableType meta_char_table;
|
||||
} OnigSyntaxType;
|
||||
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxASIS;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixBasic;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixExtended;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxEmacs;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxGrep;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxGnuRegex;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxJava;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl_NG;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby;
|
||||
|
||||
/* predefined syntaxes (see regsyntax.c) */
|
||||
#define ONIG_SYNTAX_ASIS (&OnigSyntaxASIS)
|
||||
#define ONIG_SYNTAX_POSIX_BASIC (&OnigSyntaxPosixBasic)
|
||||
#define ONIG_SYNTAX_POSIX_EXTENDED (&OnigSyntaxPosixExtended)
|
||||
#define ONIG_SYNTAX_EMACS (&OnigSyntaxEmacs)
|
||||
#define ONIG_SYNTAX_GREP (&OnigSyntaxGrep)
|
||||
#define ONIG_SYNTAX_GNU_REGEX (&OnigSyntaxGnuRegex)
|
||||
#define ONIG_SYNTAX_JAVA (&OnigSyntaxJava)
|
||||
#define ONIG_SYNTAX_PERL (&OnigSyntaxPerl)
|
||||
#define ONIG_SYNTAX_PERL_NG (&OnigSyntaxPerl_NG)
|
||||
#define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby)
|
||||
|
||||
/* default syntax */
|
||||
ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax;
|
||||
#define ONIG_SYNTAX_DEFAULT OnigDefaultSyntax
|
||||
|
||||
/* syntax (operators) */
|
||||
#define ONIG_SYN_OP_VARIABLE_META_CHARACTERS (1U<<0)
|
||||
#define ONIG_SYN_OP_DOT_ANYCHAR (1U<<1) /* . */
|
||||
#define ONIG_SYN_OP_ASTERISK_ZERO_INF (1U<<2) /* * */
|
||||
#define ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF (1U<<3)
|
||||
#define ONIG_SYN_OP_PLUS_ONE_INF (1U<<4) /* + */
|
||||
#define ONIG_SYN_OP_ESC_PLUS_ONE_INF (1U<<5)
|
||||
#define ONIG_SYN_OP_QMARK_ZERO_ONE (1U<<6) /* ? */
|
||||
#define ONIG_SYN_OP_ESC_QMARK_ZERO_ONE (1U<<7)
|
||||
#define ONIG_SYN_OP_BRACE_INTERVAL (1U<<8) /* {lower,upper} */
|
||||
#define ONIG_SYN_OP_ESC_BRACE_INTERVAL (1U<<9) /* \{lower,upper\} */
|
||||
#define ONIG_SYN_OP_VBAR_ALT (1U<<10) /* | */
|
||||
#define ONIG_SYN_OP_ESC_VBAR_ALT (1U<<11) /* \| */
|
||||
#define ONIG_SYN_OP_LPAREN_SUBEXP (1U<<12) /* (...) */
|
||||
#define ONIG_SYN_OP_ESC_LPAREN_SUBEXP (1U<<13) /* \(...\) */
|
||||
#define ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR (1U<<14) /* \A, \Z, \z */
|
||||
#define ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR (1U<<15) /* \G */
|
||||
#define ONIG_SYN_OP_DECIMAL_BACKREF (1U<<16) /* \num */
|
||||
#define ONIG_SYN_OP_BRACKET_CC (1U<<17) /* [...] */
|
||||
#define ONIG_SYN_OP_ESC_W_WORD (1U<<18) /* \w, \W */
|
||||
#define ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END (1U<<19) /* \<. \> */
|
||||
#define ONIG_SYN_OP_ESC_B_WORD_BOUND (1U<<20) /* \b, \B */
|
||||
#define ONIG_SYN_OP_ESC_S_WHITE_SPACE (1U<<21) /* \s, \S */
|
||||
#define ONIG_SYN_OP_ESC_D_DIGIT (1U<<22) /* \d, \D */
|
||||
#define ONIG_SYN_OP_LINE_ANCHOR (1U<<23) /* ^, $ */
|
||||
#define ONIG_SYN_OP_POSIX_BRACKET (1U<<24) /* [:xxxx:] */
|
||||
#define ONIG_SYN_OP_QMARK_NON_GREEDY (1U<<25) /* ??,*?,+?,{n,m}? */
|
||||
#define ONIG_SYN_OP_ESC_CONTROL_CHARS (1U<<26) /* \n,\r,\t,\a ... */
|
||||
#define ONIG_SYN_OP_ESC_C_CONTROL (1U<<27) /* \cx */
|
||||
#define ONIG_SYN_OP_ESC_OCTAL3 (1U<<28) /* \OOO */
|
||||
#define ONIG_SYN_OP_ESC_X_HEX2 (1U<<29) /* \xHH */
|
||||
#define ONIG_SYN_OP_ESC_X_BRACE_HEX8 (1U<<30) /* \x{7HHHHHHH} */
|
||||
|
||||
#define ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE (1U<<0) /* \Q...\E */
|
||||
#define ONIG_SYN_OP2_QMARK_GROUP_EFFECT (1U<<1) /* (?...) */
|
||||
#define ONIG_SYN_OP2_OPTION_PERL (1U<<2) /* (?imsx),(?-imsx) */
|
||||
#define ONIG_SYN_OP2_OPTION_RUBY (1U<<3) /* (?imx), (?-imx) */
|
||||
#define ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT (1U<<4) /* ?+,*+,++ */
|
||||
#define ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL (1U<<5) /* {n,m}+ */
|
||||
#define ONIG_SYN_OP2_CCLASS_SET_OP (1U<<6) /* [...&&..[..]..] */
|
||||
#define ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP (1U<<7) /* (?<name>...) */
|
||||
#define ONIG_SYN_OP2_ESC_K_NAMED_BACKREF (1U<<8) /* \k<name> */
|
||||
#define ONIG_SYN_OP2_ESC_G_SUBEXP_CALL (1U<<9) /* \g<name>, \g<n> */
|
||||
#define ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY (1U<<10) /* (?@..),(?@<x>..) */
|
||||
#define ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL (1U<<11) /* \C-x */
|
||||
#define ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META (1U<<12) /* \M-x */
|
||||
#define ONIG_SYN_OP2_ESC_V_VTAB (1U<<13) /* \v as VTAB */
|
||||
#define ONIG_SYN_OP2_ESC_U_HEX4 (1U<<14) /* \uHHHH */
|
||||
#define ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR (1U<<15) /* \`, \' */
|
||||
#define ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY (1U<<16) /* \p{...}, \P{...} */
|
||||
#define ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT (1U<<17) /* \p{^..}, \P{^..} */
|
||||
/* #define ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS (1U<<18) */
|
||||
#define ONIG_SYN_OP2_ESC_H_XDIGIT (1U<<19) /* \h, \H */
|
||||
#define ONIG_SYN_OP2_INEFFECTIVE_ESCAPE (1U<<20) /* \ */
|
||||
|
||||
/* syntax (behavior) */
|
||||
#define ONIG_SYN_CONTEXT_INDEP_ANCHORS (1U<<31) /* not implemented */
|
||||
#define ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS (1U<<0) /* ?, *, +, {n,m} */
|
||||
#define ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS (1U<<1) /* error or ignore */
|
||||
#define ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP (1U<<2) /* ...)... */
|
||||
#define ONIG_SYN_ALLOW_INVALID_INTERVAL (1U<<3) /* {??? */
|
||||
#define ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV (1U<<4) /* {,n} => {0,n} */
|
||||
#define ONIG_SYN_STRICT_CHECK_BACKREF (1U<<5) /* /(\1)/,/\1()/ ..*/
|
||||
#define ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND (1U<<6) /* (?<=a|bc) */
|
||||
#define ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP (1U<<7) /* see doc/RE */
|
||||
#define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME (1U<<8) /* (?<x>)(?<x>) */
|
||||
#define ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY (1U<<9) /* a{n}?=(?:a{n})? */
|
||||
|
||||
/* syntax (behavior) in char class [...] */
|
||||
#define ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC (1U<<20) /* [^...] */
|
||||
#define ONIG_SYN_BACKSLASH_ESCAPE_IN_CC (1U<<21) /* [..\w..] etc.. */
|
||||
#define ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC (1U<<22)
|
||||
#define ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC (1U<<23) /* [0-9-a]=[0-9\-a] */
|
||||
/* syntax (behavior) warning */
|
||||
#define ONIG_SYN_WARN_CC_OP_NOT_ESCAPED (1U<<24) /* [,-,] */
|
||||
#define ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT (1U<<25) /* (?:a*)+ */
|
||||
|
||||
/* meta character specifiers (onig_set_meta_char()) */
|
||||
#define ONIG_META_CHAR_ESCAPE 0
|
||||
#define ONIG_META_CHAR_ANYCHAR 1
|
||||
#define ONIG_META_CHAR_ANYTIME 2
|
||||
#define ONIG_META_CHAR_ZERO_OR_ONE_TIME 3
|
||||
#define ONIG_META_CHAR_ONE_OR_MORE_TIME 4
|
||||
#define ONIG_META_CHAR_ANYCHAR_ANYTIME 5
|
||||
|
||||
#define ONIG_INEFFECTIVE_META_CHAR 0
|
||||
|
||||
/* error codes */
|
||||
#define ONIG_IS_PATTERN_ERROR(ecode) ((ecode) <= -100 && (ecode) > -1000)
|
||||
/* normal return */
|
||||
#define ONIG_NORMAL 0
|
||||
#define ONIG_MISMATCH -1
|
||||
#define ONIG_NO_SUPPORT_CONFIG -2
|
||||
|
||||
/* internal error */
|
||||
#define ONIGERR_MEMORY -5
|
||||
#define ONIGERR_TYPE_BUG -6
|
||||
#define ONIGERR_PARSER_BUG -11
|
||||
#define ONIGERR_STACK_BUG -12
|
||||
#define ONIGERR_UNDEFINED_BYTECODE -13
|
||||
#define ONIGERR_UNEXPECTED_BYTECODE -14
|
||||
#define ONIGERR_MATCH_STACK_LIMIT_OVER -15
|
||||
#define ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED -21
|
||||
#define ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR -22
|
||||
/* general error */
|
||||
#define ONIGERR_INVALID_ARGUMENT -30
|
||||
/* syntax error */
|
||||
#define ONIGERR_END_PATTERN_AT_LEFT_BRACE -100
|
||||
#define ONIGERR_END_PATTERN_AT_LEFT_BRACKET -101
|
||||
#define ONIGERR_EMPTY_CHAR_CLASS -102
|
||||
#define ONIGERR_PREMATURE_END_OF_CHAR_CLASS -103
|
||||
#define ONIGERR_END_PATTERN_AT_ESCAPE -104
|
||||
#define ONIGERR_END_PATTERN_AT_META -105
|
||||
#define ONIGERR_END_PATTERN_AT_CONTROL -106
|
||||
#define ONIGERR_META_CODE_SYNTAX -108
|
||||
#define ONIGERR_CONTROL_CODE_SYNTAX -109
|
||||
#define ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE -110
|
||||
#define ONIGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE -111
|
||||
#define ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS -112
|
||||
#define ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED -113
|
||||
#define ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID -114
|
||||
#define ONIGERR_NESTED_REPEAT_OPERATOR -115
|
||||
#define ONIGERR_UNMATCHED_CLOSE_PARENTHESIS -116
|
||||
#define ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS -117
|
||||
#define ONIGERR_END_PATTERN_IN_GROUP -118
|
||||
#define ONIGERR_UNDEFINED_GROUP_OPTION -119
|
||||
#define ONIGERR_INVALID_POSIX_BRACKET_TYPE -121
|
||||
#define ONIGERR_INVALID_LOOK_BEHIND_PATTERN -122
|
||||
#define ONIGERR_INVALID_REPEAT_RANGE_PATTERN -123
|
||||
/* values error (syntax error) */
|
||||
#define ONIGERR_TOO_BIG_NUMBER -200
|
||||
#define ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE -201
|
||||
#define ONIGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE -202
|
||||
#define ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS -203
|
||||
#define ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE -204
|
||||
#define ONIGERR_TOO_MANY_MULTI_BYTE_RANGES -205
|
||||
#define ONIGERR_TOO_SHORT_MULTI_BYTE_STRING -206
|
||||
#define ONIGERR_TOO_BIG_BACKREF_NUMBER -207
|
||||
#define ONIGERR_INVALID_BACKREF -208
|
||||
#define ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED -209
|
||||
#define ONIGERR_TOO_LONG_WIDE_CHAR_VALUE -212
|
||||
#define ONIGERR_EMPTY_GROUP_NAME -214
|
||||
#define ONIGERR_INVALID_GROUP_NAME -215
|
||||
#define ONIGERR_INVALID_CHAR_IN_GROUP_NAME -216
|
||||
#define ONIGERR_UNDEFINED_NAME_REFERENCE -217
|
||||
#define ONIGERR_UNDEFINED_GROUP_REFERENCE -218
|
||||
#define ONIGERR_MULTIPLEX_DEFINED_NAME -219
|
||||
#define ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL -220
|
||||
#define ONIGERR_NEVER_ENDING_RECURSION -221
|
||||
#define ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY -222
|
||||
#define ONIGERR_INVALID_CHAR_PROPERTY_NAME -223
|
||||
#define ONIGERR_INVALID_CODE_POINT_VALUE -400
|
||||
#define ONIGERR_INVALID_WIDE_CHAR_VALUE -400
|
||||
#define ONIGERR_TOO_BIG_WIDE_CHAR_VALUE -401
|
||||
#define ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION -402
|
||||
#define ONIGERR_INVALID_COMBINATION_OF_OPTIONS -403
|
||||
|
||||
/* errors related to thread */
|
||||
#define ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT -1001
|
||||
|
||||
|
||||
/* must be smaller than BIT_STATUS_BITS_NUM (unsigned int * 8) */
|
||||
#define ONIG_MAX_CAPTURE_HISTORY_GROUP 31
|
||||
#define ONIG_IS_CAPTURE_HISTORY_GROUP(r, i) \
|
||||
((i) <= ONIG_MAX_CAPTURE_HISTORY_GROUP && (r)->list && (r)->list[i])
|
||||
|
||||
typedef struct OnigCaptureTreeNodeStruct {
|
||||
int group; /* group number */
|
||||
int beg;
|
||||
int end;
|
||||
int allocated;
|
||||
int num_childs;
|
||||
struct OnigCaptureTreeNodeStruct** childs;
|
||||
} OnigCaptureTreeNode;
|
||||
|
||||
/* match result region type */
|
||||
struct re_registers {
|
||||
int allocated;
|
||||
int num_regs;
|
||||
int* beg;
|
||||
int* end;
|
||||
/* extended */
|
||||
OnigCaptureTreeNode* history_root; /* capture history tree root */
|
||||
};
|
||||
|
||||
/* capture tree traverse */
|
||||
#define ONIG_TRAVERSE_CALLBACK_AT_FIRST 1
|
||||
#define ONIG_TRAVERSE_CALLBACK_AT_LAST 2
|
||||
#define ONIG_TRAVERSE_CALLBACK_AT_BOTH \
|
||||
( ONIG_TRAVERSE_CALLBACK_AT_FIRST | ONIG_TRAVERSE_CALLBACK_AT_LAST )
|
||||
|
||||
|
||||
#define ONIG_REGION_NOTPOS -1
|
||||
|
||||
typedef struct re_registers OnigRegion;
|
||||
|
||||
typedef struct {
|
||||
OnigEncoding enc;
|
||||
OnigUChar* par;
|
||||
OnigUChar* par_end;
|
||||
} OnigErrorInfo;
|
||||
|
||||
typedef struct {
|
||||
int lower;
|
||||
int upper;
|
||||
} OnigRepeatRange;
|
||||
|
||||
typedef void (*OnigWarnFunc) P_((const char* s));
|
||||
extern void onig_null_warn P_((const char* s));
|
||||
#define ONIG_NULL_WARN onig_null_warn
|
||||
|
||||
#define ONIG_CHAR_TABLE_SIZE 256
|
||||
|
||||
/* regex_t state */
|
||||
#define ONIG_STATE_NORMAL 0
|
||||
#define ONIG_STATE_SEARCHING 1
|
||||
#define ONIG_STATE_COMPILING -1
|
||||
#define ONIG_STATE_MODIFY -2
|
||||
|
||||
#define ONIG_STATE(reg) \
|
||||
((reg)->state > 0 ? ONIG_STATE_SEARCHING : (reg)->state)
|
||||
|
||||
typedef struct re_pattern_buffer {
|
||||
/* common members of BBuf(bytes-buffer) */
|
||||
unsigned char* p; /* compiled pattern */
|
||||
unsigned int used; /* used space for p */
|
||||
unsigned int alloc; /* allocated space for p */
|
||||
|
||||
int state; /* normal, searching, compiling */
|
||||
int num_mem; /* used memory(...) num counted from 1 */
|
||||
int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */
|
||||
int num_null_check; /* OP_NULL_CHECK_START/END id counter */
|
||||
int num_comb_exp_check; /* combination explosion check */
|
||||
int num_call; /* number of subexp call */
|
||||
unsigned int capture_history; /* (?@...) flag (1-31) */
|
||||
unsigned int bt_mem_start; /* need backtrack flag */
|
||||
unsigned int bt_mem_end; /* need backtrack flag */
|
||||
int stack_pop_level;
|
||||
int repeat_range_alloc;
|
||||
OnigRepeatRange* repeat_range;
|
||||
|
||||
OnigEncoding enc;
|
||||
OnigOptionType options;
|
||||
OnigSyntaxType* syntax;
|
||||
OnigCaseFoldType case_fold_flag;
|
||||
void* name_table;
|
||||
|
||||
/* optimization info (string search, char-map and anchors) */
|
||||
int optimize; /* optimize flag */
|
||||
int threshold_len; /* search str-length for apply optimize */
|
||||
int anchor; /* BEGIN_BUF, BEGIN_POS, (SEMI_)END_BUF */
|
||||
OnigDistance anchor_dmin; /* (SEMI_)END_BUF anchor distance */
|
||||
OnigDistance anchor_dmax; /* (SEMI_)END_BUF anchor distance */
|
||||
int sub_anchor; /* start-anchor for exact or map */
|
||||
unsigned char *exact;
|
||||
unsigned char *exact_end;
|
||||
unsigned char map[ONIG_CHAR_TABLE_SIZE]; /* used as BM skip or char-map */
|
||||
int *int_map; /* BM skip for exact_len > 255 */
|
||||
int *int_map_backward; /* BM skip for backward search */
|
||||
OnigDistance dmin; /* min-distance of exact or map */
|
||||
OnigDistance dmax; /* max-distance of exact or map */
|
||||
|
||||
/* regex_t link chain */
|
||||
struct re_pattern_buffer* chain; /* escape compile-conflict */
|
||||
} OnigRegexType;
|
||||
|
||||
typedef OnigRegexType* OnigRegex;
|
||||
|
||||
#ifndef ONIG_ESCAPE_REGEX_T_COLLISION
|
||||
typedef OnigRegexType regex_t;
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
int num_of_elements;
|
||||
OnigEncoding pattern_enc;
|
||||
OnigEncoding target_enc;
|
||||
OnigSyntaxType* syntax;
|
||||
OnigOptionType option;
|
||||
OnigCaseFoldType case_fold_flag;
|
||||
} OnigCompileInfo;
|
||||
|
||||
/* Oniguruma Native API */
|
||||
ONIG_EXTERN
|
||||
int onig_init P_((void));
|
||||
ONIG_EXTERN
|
||||
int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));
|
||||
ONIG_EXTERN
|
||||
void onig_set_warn_func P_((OnigWarnFunc f));
|
||||
ONIG_EXTERN
|
||||
void onig_set_verb_warn_func P_((OnigWarnFunc f));
|
||||
ONIG_EXTERN
|
||||
int onig_new P_((OnigRegex*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
|
||||
ONIG_EXTERN
|
||||
int onig_reg_init P_((regex_t* reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, OnigSyntaxType* syntax));
|
||||
int onig_new_without_alloc P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
|
||||
ONIG_EXTERN
|
||||
int onig_new_deluxe P_((OnigRegex* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
|
||||
ONIG_EXTERN
|
||||
void onig_free P_((OnigRegex));
|
||||
ONIG_EXTERN
|
||||
void onig_free_body P_((OnigRegex));
|
||||
ONIG_EXTERN
|
||||
int onig_recompile P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
|
||||
ONIG_EXTERN
|
||||
int onig_recompile_deluxe P_((OnigRegex reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
|
||||
ONIG_EXTERN
|
||||
int onig_search P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option));
|
||||
ONIG_EXTERN
|
||||
int onig_match P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option));
|
||||
ONIG_EXTERN
|
||||
OnigRegion* onig_region_new P_((void));
|
||||
ONIG_EXTERN
|
||||
void onig_region_init P_((OnigRegion* region));
|
||||
ONIG_EXTERN
|
||||
void onig_region_free P_((OnigRegion* region, int free_self));
|
||||
ONIG_EXTERN
|
||||
void onig_region_copy P_((OnigRegion* to, OnigRegion* from));
|
||||
ONIG_EXTERN
|
||||
void onig_region_clear P_((OnigRegion* region));
|
||||
ONIG_EXTERN
|
||||
int onig_region_resize P_((OnigRegion* region, int n));
|
||||
ONIG_EXTERN
|
||||
int onig_region_set P_((OnigRegion* region, int at, int beg, int end));
|
||||
ONIG_EXTERN
|
||||
int onig_name_to_group_numbers P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, int** nums));
|
||||
ONIG_EXTERN
|
||||
int onig_name_to_backref_number P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, OnigRegion *region));
|
||||
ONIG_EXTERN
|
||||
int onig_foreach_name P_((OnigRegex reg, int (*func)(const OnigUChar*, const OnigUChar*,int,int*,OnigRegex,void*), void* arg));
|
||||
ONIG_EXTERN
|
||||
int onig_number_of_names P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
int onig_number_of_captures P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
int onig_number_of_capture_histories P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
OnigCaptureTreeNode* onig_get_capture_tree P_((OnigRegion* region));
|
||||
ONIG_EXTERN
|
||||
int onig_capture_tree_traverse P_((OnigRegion* region, int at, int(*callback_func)(int,int,int,int,int,void*), void* arg));
|
||||
ONIG_EXTERN
|
||||
int onig_noname_group_capture_is_active P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
OnigEncoding onig_get_encoding P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
OnigOptionType onig_get_options P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
OnigCaseFoldType onig_get_case_fold_flag P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
OnigSyntaxType* onig_get_syntax P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
int onig_set_default_syntax P_((OnigSyntaxType* syntax));
|
||||
ONIG_EXTERN
|
||||
void onig_copy_syntax P_((OnigSyntaxType* to, OnigSyntaxType* from));
|
||||
ONIG_EXTERN
|
||||
unsigned int onig_get_syntax_op P_((OnigSyntaxType* syntax));
|
||||
ONIG_EXTERN
|
||||
unsigned int onig_get_syntax_op2 P_((OnigSyntaxType* syntax));
|
||||
ONIG_EXTERN
|
||||
unsigned int onig_get_syntax_behavior P_((OnigSyntaxType* syntax));
|
||||
ONIG_EXTERN
|
||||
OnigOptionType onig_get_syntax_options P_((OnigSyntaxType* syntax));
|
||||
ONIG_EXTERN
|
||||
void onig_set_syntax_op P_((OnigSyntaxType* syntax, unsigned int op));
|
||||
ONIG_EXTERN
|
||||
void onig_set_syntax_op2 P_((OnigSyntaxType* syntax, unsigned int op2));
|
||||
ONIG_EXTERN
|
||||
void onig_set_syntax_behavior P_((OnigSyntaxType* syntax, unsigned int behavior));
|
||||
ONIG_EXTERN
|
||||
void onig_set_syntax_options P_((OnigSyntaxType* syntax, OnigOptionType options));
|
||||
ONIG_EXTERN
|
||||
int onig_set_meta_char P_((OnigSyntaxType* syntax, unsigned int what, OnigCodePoint code));
|
||||
ONIG_EXTERN
|
||||
void onig_copy_encoding P_((OnigEncoding to, OnigEncoding from));
|
||||
ONIG_EXTERN
|
||||
OnigCaseFoldType onig_get_default_case_fold_flag P_((void));
|
||||
ONIG_EXTERN
|
||||
int onig_set_default_case_fold_flag P_((OnigCaseFoldType case_fold_flag));
|
||||
ONIG_EXTERN
|
||||
unsigned int onig_get_match_stack_limit_size P_((void));
|
||||
ONIG_EXTERN
|
||||
int onig_set_match_stack_limit_size P_((unsigned int size));
|
||||
ONIG_EXTERN
|
||||
int onig_end P_((void));
|
||||
ONIG_EXTERN
|
||||
const char* onig_version P_((void));
|
||||
ONIG_EXTERN
|
||||
const char* onig_copyright P_((void));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ONIGURUMA_H */
|
||||
BIN
Arquivo binário não exibido.
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>11E2620</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>CocoaOniguruma</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>net.limechat.CocoaOniguruma</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>CocoaOniguruma</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>DTCompiler</key>
|
||||
<string></string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>4E3002</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>11E2620</string>
|
||||
<key>DTSDKName</key>
|
||||
<string></string>
|
||||
<key>DTXcode</key>
|
||||
<string>0433</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>4E3002</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Arquivo binário não exibido.
@@ -1,91 +0,0 @@
|
||||
// CocoaOniguruma is copyrighted free software by Satoshi Nakagawa <psychs AT limechat DOT net>.
|
||||
// You can redistribute it and/or modify it under the new BSD license.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "oniguruma.h"
|
||||
#import "OnigRegexpUtility.h"
|
||||
|
||||
|
||||
@class OnigResult;
|
||||
|
||||
typedef enum {
|
||||
OnigOptionNone = ONIG_OPTION_NONE,
|
||||
OnigOptionIgnorecase = ONIG_OPTION_IGNORECASE,
|
||||
OnigOptionExtend = ONIG_OPTION_EXTEND,
|
||||
OnigOptionMultiline = ONIG_OPTION_MULTILINE,
|
||||
OnigOptionSingleline = ONIG_OPTION_SINGLELINE,
|
||||
OnigOptionFindLongest = ONIG_OPTION_FIND_LONGEST,
|
||||
OnigOptionFindNotEmpty = ONIG_OPTION_FIND_NOT_EMPTY,
|
||||
OnigOptionNegateSingleLine = ONIG_OPTION_NEGATE_SINGLELINE,
|
||||
OnigOptionDontCaptureGroup = ONIG_OPTION_DONT_CAPTURE_GROUP,
|
||||
OnigOptionCaptureGroup = ONIG_OPTION_CAPTURE_GROUP,
|
||||
|
||||
/* options (search time) */
|
||||
OnigOptionNotbol = ONIG_OPTION_NOTBOL,
|
||||
OnigOptionNoteol = ONIG_OPTION_NOTEOL,
|
||||
OnigOptionPosixRegion = ONIG_OPTION_POSIX_REGION,
|
||||
OnigOptionMaxbit = ONIG_OPTION_MAXBIT
|
||||
} OnigOption;
|
||||
|
||||
@interface OnigRegexp : NSObject
|
||||
{
|
||||
regex_t* _entity;
|
||||
NSString* _expression;
|
||||
}
|
||||
|
||||
+ (OnigRegexp*)compile:(NSString*)expression;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression error:(NSError **)error;
|
||||
+ (OnigRegexp*)compileIgnorecase:(NSString*)expression;
|
||||
+ (OnigRegexp*)compileIgnorecase:(NSString*)expression error:(NSError **)error;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression ignorecase:(BOOL)ignorecase multiline:(BOOL)multiline;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression ignorecase:(BOOL)ignorecase multiline:(BOOL)multiline error:(NSError **)error;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression ignorecase:(BOOL)ignorecase multiline:(BOOL)multiline extended:(BOOL)extended;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression ignorecase:(BOOL)ignorecase multiline:(BOOL)multiline extended:(BOOL)extended error:(NSError **)error;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression options:(OnigOption)options;
|
||||
+ (OnigRegexp*)compile:(NSString*)expression options:(OnigOption)options error:(NSError **)error;
|
||||
|
||||
- (OnigResult*)search:(NSString*)target;
|
||||
- (OnigResult*)search:(NSString*)target start:(int)start;
|
||||
- (OnigResult*)search:(NSString*)target start:(int)start end:(int)end;
|
||||
- (OnigResult*)search:(NSString*)target range:(NSRange)range;
|
||||
|
||||
- (OnigResult*)match:(NSString*)target;
|
||||
- (OnigResult*)match:(NSString*)target start:(int)start;
|
||||
|
||||
- (NSUInteger)captureCount;
|
||||
- (NSString*)expression;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface OnigResult : NSObject
|
||||
{
|
||||
OnigRegexp* _expression;
|
||||
OnigRegion* _region;
|
||||
NSString* _target;
|
||||
NSMutableArray* _captureNames;
|
||||
}
|
||||
|
||||
- (NSString*)target;
|
||||
|
||||
- (int)count;
|
||||
- (NSString*)stringAt:(int)index;
|
||||
- (NSArray*)strings;
|
||||
- (NSRange)rangeAt:(int)index;
|
||||
- (int)locationAt:(int)index;
|
||||
- (int)lengthAt:(int)index;
|
||||
|
||||
- (NSString*)body;
|
||||
- (NSRange)bodyRange;
|
||||
|
||||
- (NSString*)preMatch;
|
||||
- (NSString*)postMatch;
|
||||
|
||||
// named capture support
|
||||
- (NSArray*)captureNames;
|
||||
- (int)indexForName:(NSString*)name;
|
||||
- (NSIndexSet*)indexesForName:(NSString*)name;
|
||||
- (NSString*)stringForName:(NSString*)name;
|
||||
- (NSArray*)stringsForName:(NSString*)name;
|
||||
|
||||
@end
|
||||
@@ -1,57 +0,0 @@
|
||||
// CocoaOniguruma is copyrighted free software by Satoshi Nakagawa <psychs AT limechat DOT net>.
|
||||
// You can redistribute it and/or modify it under the new BSD license.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "oniguruma.h"
|
||||
#import "OnigRegexp.h"
|
||||
|
||||
|
||||
@class OnigRegexp;
|
||||
@class OnigResult;
|
||||
|
||||
|
||||
@interface NSString (OnigRegexpUtility)
|
||||
|
||||
// pattern is OnigRegexp or NSString
|
||||
|
||||
- (NSRange)rangeOfRegexp:(id)pattern;
|
||||
|
||||
// based on ruby's split
|
||||
|
||||
- (NSArray*)split;
|
||||
- (NSArray*)splitByRegexp:(id)pattern;
|
||||
- (NSArray*)splitByRegexp:(id)pattern limit:(int)limit;
|
||||
|
||||
// based on ruby's gsub
|
||||
|
||||
- (NSString*)replaceByRegexp:(id)pattern with:(NSString*)string;
|
||||
- (NSString*)replaceAllByRegexp:(id)pattern with:(NSString*)string;
|
||||
|
||||
- (NSString*)replaceByRegexp:(id)pattern withCallback:(id)object selector:(SEL)sel;
|
||||
- (NSString*)replaceAllByRegexp:(id)pattern withCallback:(id)object selector:(SEL)sel;
|
||||
|
||||
#if defined(NS_BLOCKS_AVAILABLE)
|
||||
- (NSString*)replaceByRegexp:(id)pattern withBlock:(NSString* (^)(OnigResult*))block;
|
||||
- (NSString*)replaceAllByRegexp:(id)pattern withBlock:(NSString* (^)(OnigResult*))block;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface NSMutableString (OnigRegexpUtility)
|
||||
|
||||
// pattern is OnigRegexp or NSString
|
||||
|
||||
// based on ruby's gsub
|
||||
|
||||
- (NSMutableString*)replaceByRegexp:(id)pattern with:(NSString*)string;
|
||||
- (NSMutableString*)replaceAllByRegexp:(id)pattern with:(NSString*)string;
|
||||
|
||||
- (NSMutableString*)replaceByRegexp:(id)pattern withCallback:(id)object selector:(SEL)sel;
|
||||
- (NSMutableString*)replaceAllByRegexp:(id)pattern withCallback:(id)object selector:(SEL)sel;
|
||||
|
||||
#if defined(NS_BLOCKS_AVAILABLE)
|
||||
- (NSMutableString*)replaceByRegexp:(id)pattern withBlock:(NSString* (^)(OnigResult*))block;
|
||||
- (NSMutableString*)replaceAllByRegexp:(id)pattern withBlock:(NSString* (^)(OnigResult*))block;
|
||||
#endif
|
||||
@end
|
||||
@@ -1,770 +0,0 @@
|
||||
#ifndef ONIGURUMA_H
|
||||
#define ONIGURUMA_H
|
||||
/**********************************************************************
|
||||
oniguruma.h - Oniguruma (regular expression library)
|
||||
**********************************************************************/
|
||||
/*-
|
||||
* Copyright (c) 2002-2009 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ONIGURUMA
|
||||
#define ONIGURUMA_VERSION_MAJOR 5
|
||||
#define ONIGURUMA_VERSION_MINOR 9
|
||||
#define ONIGURUMA_VERSION_TEENY 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef HAVE_PROTOTYPES
|
||||
# define HAVE_PROTOTYPES 1
|
||||
# endif
|
||||
# ifndef HAVE_STDARG_PROTOTYPES
|
||||
# define HAVE_STDARG_PROTOTYPES 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* escape Mac OS X/Xcode 2.4/gcc 4.0.1 problem */
|
||||
#if defined(__APPLE__) && defined(__GNUC__) && __GNUC__ >= 4
|
||||
# ifndef HAVE_STDARG_PROTOTYPES
|
||||
# define HAVE_STDARG_PROTOTYPES 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
# ifndef HAVE_STDARG_PROTOTYPES
|
||||
# define HAVE_STDARG_PROTOTYPES 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef P_
|
||||
#if defined(__STDC__) || defined(_WIN32)
|
||||
# define P_(args) args
|
||||
#else
|
||||
# define P_(args) ()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PV_
|
||||
#ifdef HAVE_STDARG_PROTOTYPES
|
||||
# define PV_(args) args
|
||||
#else
|
||||
# define PV_(args) ()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ONIG_EXTERN
|
||||
#if defined(_WIN32) && !defined(__GNUC__)
|
||||
#if defined(EXPORT) || defined(RUBY_EXPORT)
|
||||
#define ONIG_EXTERN extern __declspec(dllexport)
|
||||
#else
|
||||
#define ONIG_EXTERN extern __declspec(dllimport)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ONIG_EXTERN
|
||||
#define ONIG_EXTERN extern
|
||||
#endif
|
||||
|
||||
/* PART: character encoding */
|
||||
|
||||
#ifndef ONIG_ESCAPE_UCHAR_COLLISION
|
||||
#define UChar OnigUChar
|
||||
#endif
|
||||
|
||||
typedef unsigned char OnigUChar;
|
||||
typedef unsigned long OnigCodePoint;
|
||||
typedef unsigned int OnigCtype;
|
||||
typedef unsigned int OnigDistance;
|
||||
|
||||
#define ONIG_INFINITE_DISTANCE ~((OnigDistance )0)
|
||||
|
||||
typedef unsigned int OnigCaseFoldType; /* case fold flag */
|
||||
|
||||
ONIG_EXTERN OnigCaseFoldType OnigDefaultCaseFoldFlag;
|
||||
|
||||
/* #define ONIGENC_CASE_FOLD_HIRAGANA_KATAKANA (1<<1) */
|
||||
/* #define ONIGENC_CASE_FOLD_KATAKANA_WIDTH (1<<2) */
|
||||
#define ONIGENC_CASE_FOLD_TURKISH_AZERI (1<<20)
|
||||
#define INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR (1<<30)
|
||||
|
||||
#define ONIGENC_CASE_FOLD_MIN INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR
|
||||
#define ONIGENC_CASE_FOLD_DEFAULT OnigDefaultCaseFoldFlag
|
||||
|
||||
|
||||
#define ONIGENC_MAX_COMP_CASE_FOLD_CODE_LEN 3
|
||||
#define ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM 13
|
||||
/* 13 => Unicode:0x1ffc */
|
||||
|
||||
/* code range */
|
||||
#define ONIGENC_CODE_RANGE_NUM(range) ((int )range[0])
|
||||
#define ONIGENC_CODE_RANGE_FROM(range,i) range[((i)*2) + 1]
|
||||
#define ONIGENC_CODE_RANGE_TO(range,i) range[((i)*2) + 2]
|
||||
|
||||
typedef struct {
|
||||
int byte_len; /* argument(original) character(s) byte length */
|
||||
int code_len; /* number of code */
|
||||
OnigCodePoint code[ONIGENC_MAX_COMP_CASE_FOLD_CODE_LEN];
|
||||
} OnigCaseFoldCodeItem;
|
||||
|
||||
typedef struct {
|
||||
OnigCodePoint esc;
|
||||
OnigCodePoint anychar;
|
||||
OnigCodePoint anytime;
|
||||
OnigCodePoint zero_or_one_time;
|
||||
OnigCodePoint one_or_more_time;
|
||||
OnigCodePoint anychar_anytime;
|
||||
} OnigMetaCharTableType;
|
||||
|
||||
typedef int (*OnigApplyAllCaseFoldFunc)(OnigCodePoint from, OnigCodePoint* to, int to_len, void* arg);
|
||||
|
||||
typedef struct OnigEncodingTypeST {
|
||||
int (*mbc_enc_len)(const OnigUChar* p);
|
||||
const char* name;
|
||||
int max_enc_len;
|
||||
int min_enc_len;
|
||||
int (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end);
|
||||
OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end);
|
||||
int (*code_to_mbclen)(OnigCodePoint code);
|
||||
int (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf);
|
||||
int (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to);
|
||||
int (*apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg);
|
||||
int (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[]);
|
||||
int (*property_name_to_ctype)(struct OnigEncodingTypeST* enc, OnigUChar* p, OnigUChar* end);
|
||||
int (*is_code_ctype)(OnigCodePoint code, OnigCtype ctype);
|
||||
int (*get_ctype_code_range)(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[]);
|
||||
OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p);
|
||||
int (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end);
|
||||
} OnigEncodingType;
|
||||
|
||||
typedef OnigEncodingType* OnigEncoding;
|
||||
|
||||
ONIG_EXTERN OnigEncodingType OnigEncodingASCII;
|
||||
ONIG_EXTERN OnigEncodingType OnigEncodingUTF16_BE;
|
||||
ONIG_EXTERN OnigEncodingType OnigEncodingUTF16_LE;
|
||||
ONIG_EXTERN OnigEncodingType OnigEncodingUTF32_BE;
|
||||
ONIG_EXTERN OnigEncodingType OnigEncodingUTF32_LE;
|
||||
|
||||
#define ONIG_ENCODING_ASCII (&OnigEncodingASCII)
|
||||
#define ONIG_ENCODING_UTF16_BE (&OnigEncodingUTF16_BE)
|
||||
#define ONIG_ENCODING_UTF16_LE (&OnigEncodingUTF16_LE)
|
||||
#define ONIG_ENCODING_UTF32_BE (&OnigEncodingUTF32_BE)
|
||||
#define ONIG_ENCODING_UTF32_LE (&OnigEncodingUTF32_LE)
|
||||
|
||||
#define ONIG_ENCODING_UNDEF ((OnigEncoding )0)
|
||||
|
||||
|
||||
/* work size */
|
||||
#define ONIGENC_CODE_TO_MBC_MAXLEN 7
|
||||
#define ONIGENC_MBC_CASE_FOLD_MAXLEN 18
|
||||
/* 18: 6(max-byte) * 3(case-fold chars) */
|
||||
|
||||
/* character types */
|
||||
#define ONIGENC_CTYPE_NEWLINE 0
|
||||
#define ONIGENC_CTYPE_ALPHA 1
|
||||
#define ONIGENC_CTYPE_BLANK 2
|
||||
#define ONIGENC_CTYPE_CNTRL 3
|
||||
#define ONIGENC_CTYPE_DIGIT 4
|
||||
#define ONIGENC_CTYPE_GRAPH 5
|
||||
#define ONIGENC_CTYPE_LOWER 6
|
||||
#define ONIGENC_CTYPE_PRINT 7
|
||||
#define ONIGENC_CTYPE_PUNCT 8
|
||||
#define ONIGENC_CTYPE_SPACE 9
|
||||
#define ONIGENC_CTYPE_UPPER 10
|
||||
#define ONIGENC_CTYPE_XDIGIT 11
|
||||
#define ONIGENC_CTYPE_WORD 12
|
||||
#define ONIGENC_CTYPE_ALNUM 13 /* alpha || digit */
|
||||
#define ONIGENC_CTYPE_ASCII 14
|
||||
#define ONIGENC_MAX_STD_CTYPE ONIGENC_CTYPE_ASCII
|
||||
|
||||
|
||||
#define onig_enc_len(enc,p,end) ONIGENC_MBC_ENC_LEN(enc,p)
|
||||
|
||||
#define ONIGENC_IS_UNDEF(enc) ((enc) == ONIG_ENCODING_UNDEF)
|
||||
#define ONIGENC_IS_SINGLEBYTE(enc) (ONIGENC_MBC_MAXLEN(enc) == 1)
|
||||
#define ONIGENC_IS_MBC_HEAD(enc,p) (ONIGENC_MBC_ENC_LEN(enc,p) != 1)
|
||||
#define ONIGENC_IS_MBC_ASCII(p) (*(p) < 128)
|
||||
#define ONIGENC_IS_CODE_ASCII(code) ((code) < 128)
|
||||
#define ONIGENC_IS_MBC_WORD(enc,s,end) \
|
||||
ONIGENC_IS_CODE_WORD(enc,ONIGENC_MBC_TO_CODE(enc,s,end))
|
||||
|
||||
|
||||
#define ONIGENC_NAME(enc) ((enc)->name)
|
||||
|
||||
#define ONIGENC_MBC_CASE_FOLD(enc,flag,pp,end,buf) \
|
||||
(enc)->mbc_case_fold(flag,(const OnigUChar** )pp,end,buf)
|
||||
#define ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc,s,end) \
|
||||
(enc)->is_allowed_reverse_match(s,end)
|
||||
#define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,start,s) \
|
||||
(enc)->left_adjust_char_head(start, s)
|
||||
#define ONIGENC_APPLY_ALL_CASE_FOLD(enc,case_fold_flag,f,arg) \
|
||||
(enc)->apply_all_case_fold(case_fold_flag,f,arg)
|
||||
#define ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc,case_fold_flag,p,end,acs) \
|
||||
(enc)->get_case_fold_codes_by_str(case_fold_flag,p,end,acs)
|
||||
#define ONIGENC_STEP_BACK(enc,start,s,n) \
|
||||
onigenc_step_back((enc),(start),(s),(n))
|
||||
|
||||
#define ONIGENC_MBC_ENC_LEN(enc,p) (enc)->mbc_enc_len(p)
|
||||
#define ONIGENC_MBC_MAXLEN(enc) ((enc)->max_enc_len)
|
||||
#define ONIGENC_MBC_MAXLEN_DIST(enc) ONIGENC_MBC_MAXLEN(enc)
|
||||
#define ONIGENC_MBC_MINLEN(enc) ((enc)->min_enc_len)
|
||||
#define ONIGENC_IS_MBC_NEWLINE(enc,p,end) (enc)->is_mbc_newline((p),(end))
|
||||
#define ONIGENC_MBC_TO_CODE(enc,p,end) (enc)->mbc_to_code((p),(end))
|
||||
#define ONIGENC_CODE_TO_MBCLEN(enc,code) (enc)->code_to_mbclen(code)
|
||||
#define ONIGENC_CODE_TO_MBC(enc,code,buf) (enc)->code_to_mbc(code,buf)
|
||||
#define ONIGENC_PROPERTY_NAME_TO_CTYPE(enc,p,end) \
|
||||
(enc)->property_name_to_ctype(enc,p,end)
|
||||
|
||||
#define ONIGENC_IS_CODE_CTYPE(enc,code,ctype) (enc)->is_code_ctype(code,ctype)
|
||||
|
||||
#define ONIGENC_IS_CODE_NEWLINE(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_NEWLINE)
|
||||
#define ONIGENC_IS_CODE_GRAPH(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_GRAPH)
|
||||
#define ONIGENC_IS_CODE_PRINT(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PRINT)
|
||||
#define ONIGENC_IS_CODE_ALNUM(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALNUM)
|
||||
#define ONIGENC_IS_CODE_ALPHA(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALPHA)
|
||||
#define ONIGENC_IS_CODE_LOWER(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_LOWER)
|
||||
#define ONIGENC_IS_CODE_UPPER(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_UPPER)
|
||||
#define ONIGENC_IS_CODE_CNTRL(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_CNTRL)
|
||||
#define ONIGENC_IS_CODE_PUNCT(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PUNCT)
|
||||
#define ONIGENC_IS_CODE_SPACE(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_SPACE)
|
||||
#define ONIGENC_IS_CODE_BLANK(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_BLANK)
|
||||
#define ONIGENC_IS_CODE_DIGIT(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_DIGIT)
|
||||
#define ONIGENC_IS_CODE_XDIGIT(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_XDIGIT)
|
||||
#define ONIGENC_IS_CODE_WORD(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_WORD)
|
||||
|
||||
#define ONIGENC_GET_CTYPE_CODE_RANGE(enc,ctype,sbout,ranges) \
|
||||
(enc)->get_ctype_code_range(ctype,sbout,ranges)
|
||||
|
||||
ONIG_EXTERN
|
||||
OnigUChar* onigenc_step_back P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, int n));
|
||||
|
||||
|
||||
/* encoding API */
|
||||
ONIG_EXTERN
|
||||
int onigenc_init P_((void));
|
||||
ONIG_EXTERN
|
||||
int onigenc_set_default_encoding P_((OnigEncoding enc));
|
||||
ONIG_EXTERN
|
||||
OnigEncoding onigenc_get_default_encoding P_((void));
|
||||
ONIG_EXTERN
|
||||
void onigenc_set_default_caseconv_table P_((const OnigUChar* table));
|
||||
ONIG_EXTERN
|
||||
OnigUChar* onigenc_get_right_adjust_char_head_with_prev P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar** prev));
|
||||
ONIG_EXTERN
|
||||
OnigUChar* onigenc_get_prev_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s));
|
||||
ONIG_EXTERN
|
||||
OnigUChar* onigenc_get_left_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s));
|
||||
ONIG_EXTERN
|
||||
OnigUChar* onigenc_get_right_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s));
|
||||
ONIG_EXTERN
|
||||
int onigenc_strlen P_((OnigEncoding enc, const OnigUChar* p, const OnigUChar* end));
|
||||
ONIG_EXTERN
|
||||
int onigenc_strlen_null P_((OnigEncoding enc, const OnigUChar* p));
|
||||
ONIG_EXTERN
|
||||
int onigenc_str_bytelen_null P_((OnigEncoding enc, const OnigUChar* p));
|
||||
|
||||
|
||||
|
||||
/* PART: regular expression */
|
||||
|
||||
/* config parameters */
|
||||
#define ONIG_NREGION 10
|
||||
#define ONIG_MAX_BACKREF_NUM 1000
|
||||
#define ONIG_MAX_REPEAT_NUM 100000
|
||||
#define ONIG_MAX_MULTI_BYTE_RANGES_NUM 10000
|
||||
/* constants */
|
||||
#define ONIG_MAX_ERROR_MESSAGE_LEN 90
|
||||
|
||||
typedef unsigned int OnigOptionType;
|
||||
|
||||
#define ONIG_OPTION_DEFAULT ONIG_OPTION_NONE
|
||||
|
||||
/* options */
|
||||
#define ONIG_OPTION_NONE 0U
|
||||
#define ONIG_OPTION_IGNORECASE 1U
|
||||
#define ONIG_OPTION_EXTEND (ONIG_OPTION_IGNORECASE << 1)
|
||||
#define ONIG_OPTION_MULTILINE (ONIG_OPTION_EXTEND << 1)
|
||||
#define ONIG_OPTION_SINGLELINE (ONIG_OPTION_MULTILINE << 1)
|
||||
#define ONIG_OPTION_FIND_LONGEST (ONIG_OPTION_SINGLELINE << 1)
|
||||
#define ONIG_OPTION_FIND_NOT_EMPTY (ONIG_OPTION_FIND_LONGEST << 1)
|
||||
#define ONIG_OPTION_NEGATE_SINGLELINE (ONIG_OPTION_FIND_NOT_EMPTY << 1)
|
||||
#define ONIG_OPTION_DONT_CAPTURE_GROUP (ONIG_OPTION_NEGATE_SINGLELINE << 1)
|
||||
#define ONIG_OPTION_CAPTURE_GROUP (ONIG_OPTION_DONT_CAPTURE_GROUP << 1)
|
||||
/* options (search time) */
|
||||
#define ONIG_OPTION_NOTBOL (ONIG_OPTION_CAPTURE_GROUP << 1)
|
||||
#define ONIG_OPTION_NOTEOL (ONIG_OPTION_NOTBOL << 1)
|
||||
#define ONIG_OPTION_POSIX_REGION (ONIG_OPTION_NOTEOL << 1)
|
||||
#define ONIG_OPTION_MAXBIT ONIG_OPTION_POSIX_REGION /* limit */
|
||||
|
||||
#define ONIG_OPTION_ON(options,regopt) ((options) |= (regopt))
|
||||
#define ONIG_OPTION_OFF(options,regopt) ((options) &= ~(regopt))
|
||||
#define ONIG_IS_OPTION_ON(options,option) ((options) & (option))
|
||||
|
||||
/* syntax */
|
||||
typedef struct {
|
||||
unsigned int op;
|
||||
unsigned int op2;
|
||||
unsigned int behavior;
|
||||
OnigOptionType options; /* default option */
|
||||
OnigMetaCharTableType meta_char_table;
|
||||
} OnigSyntaxType;
|
||||
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxASIS;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixBasic;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixExtended;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxEmacs;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxGrep;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxGnuRegex;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxJava;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl_NG;
|
||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby;
|
||||
|
||||
/* predefined syntaxes (see regsyntax.c) */
|
||||
#define ONIG_SYNTAX_ASIS (&OnigSyntaxASIS)
|
||||
#define ONIG_SYNTAX_POSIX_BASIC (&OnigSyntaxPosixBasic)
|
||||
#define ONIG_SYNTAX_POSIX_EXTENDED (&OnigSyntaxPosixExtended)
|
||||
#define ONIG_SYNTAX_EMACS (&OnigSyntaxEmacs)
|
||||
#define ONIG_SYNTAX_GREP (&OnigSyntaxGrep)
|
||||
#define ONIG_SYNTAX_GNU_REGEX (&OnigSyntaxGnuRegex)
|
||||
#define ONIG_SYNTAX_JAVA (&OnigSyntaxJava)
|
||||
#define ONIG_SYNTAX_PERL (&OnigSyntaxPerl)
|
||||
#define ONIG_SYNTAX_PERL_NG (&OnigSyntaxPerl_NG)
|
||||
#define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby)
|
||||
|
||||
/* default syntax */
|
||||
ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax;
|
||||
#define ONIG_SYNTAX_DEFAULT OnigDefaultSyntax
|
||||
|
||||
/* syntax (operators) */
|
||||
#define ONIG_SYN_OP_VARIABLE_META_CHARACTERS (1U<<0)
|
||||
#define ONIG_SYN_OP_DOT_ANYCHAR (1U<<1) /* . */
|
||||
#define ONIG_SYN_OP_ASTERISK_ZERO_INF (1U<<2) /* * */
|
||||
#define ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF (1U<<3)
|
||||
#define ONIG_SYN_OP_PLUS_ONE_INF (1U<<4) /* + */
|
||||
#define ONIG_SYN_OP_ESC_PLUS_ONE_INF (1U<<5)
|
||||
#define ONIG_SYN_OP_QMARK_ZERO_ONE (1U<<6) /* ? */
|
||||
#define ONIG_SYN_OP_ESC_QMARK_ZERO_ONE (1U<<7)
|
||||
#define ONIG_SYN_OP_BRACE_INTERVAL (1U<<8) /* {lower,upper} */
|
||||
#define ONIG_SYN_OP_ESC_BRACE_INTERVAL (1U<<9) /* \{lower,upper\} */
|
||||
#define ONIG_SYN_OP_VBAR_ALT (1U<<10) /* | */
|
||||
#define ONIG_SYN_OP_ESC_VBAR_ALT (1U<<11) /* \| */
|
||||
#define ONIG_SYN_OP_LPAREN_SUBEXP (1U<<12) /* (...) */
|
||||
#define ONIG_SYN_OP_ESC_LPAREN_SUBEXP (1U<<13) /* \(...\) */
|
||||
#define ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR (1U<<14) /* \A, \Z, \z */
|
||||
#define ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR (1U<<15) /* \G */
|
||||
#define ONIG_SYN_OP_DECIMAL_BACKREF (1U<<16) /* \num */
|
||||
#define ONIG_SYN_OP_BRACKET_CC (1U<<17) /* [...] */
|
||||
#define ONIG_SYN_OP_ESC_W_WORD (1U<<18) /* \w, \W */
|
||||
#define ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END (1U<<19) /* \<. \> */
|
||||
#define ONIG_SYN_OP_ESC_B_WORD_BOUND (1U<<20) /* \b, \B */
|
||||
#define ONIG_SYN_OP_ESC_S_WHITE_SPACE (1U<<21) /* \s, \S */
|
||||
#define ONIG_SYN_OP_ESC_D_DIGIT (1U<<22) /* \d, \D */
|
||||
#define ONIG_SYN_OP_LINE_ANCHOR (1U<<23) /* ^, $ */
|
||||
#define ONIG_SYN_OP_POSIX_BRACKET (1U<<24) /* [:xxxx:] */
|
||||
#define ONIG_SYN_OP_QMARK_NON_GREEDY (1U<<25) /* ??,*?,+?,{n,m}? */
|
||||
#define ONIG_SYN_OP_ESC_CONTROL_CHARS (1U<<26) /* \n,\r,\t,\a ... */
|
||||
#define ONIG_SYN_OP_ESC_C_CONTROL (1U<<27) /* \cx */
|
||||
#define ONIG_SYN_OP_ESC_OCTAL3 (1U<<28) /* \OOO */
|
||||
#define ONIG_SYN_OP_ESC_X_HEX2 (1U<<29) /* \xHH */
|
||||
#define ONIG_SYN_OP_ESC_X_BRACE_HEX8 (1U<<30) /* \x{7HHHHHHH} */
|
||||
|
||||
#define ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE (1U<<0) /* \Q...\E */
|
||||
#define ONIG_SYN_OP2_QMARK_GROUP_EFFECT (1U<<1) /* (?...) */
|
||||
#define ONIG_SYN_OP2_OPTION_PERL (1U<<2) /* (?imsx),(?-imsx) */
|
||||
#define ONIG_SYN_OP2_OPTION_RUBY (1U<<3) /* (?imx), (?-imx) */
|
||||
#define ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT (1U<<4) /* ?+,*+,++ */
|
||||
#define ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL (1U<<5) /* {n,m}+ */
|
||||
#define ONIG_SYN_OP2_CCLASS_SET_OP (1U<<6) /* [...&&..[..]..] */
|
||||
#define ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP (1U<<7) /* (?<name>...) */
|
||||
#define ONIG_SYN_OP2_ESC_K_NAMED_BACKREF (1U<<8) /* \k<name> */
|
||||
#define ONIG_SYN_OP2_ESC_G_SUBEXP_CALL (1U<<9) /* \g<name>, \g<n> */
|
||||
#define ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY (1U<<10) /* (?@..),(?@<x>..) */
|
||||
#define ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL (1U<<11) /* \C-x */
|
||||
#define ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META (1U<<12) /* \M-x */
|
||||
#define ONIG_SYN_OP2_ESC_V_VTAB (1U<<13) /* \v as VTAB */
|
||||
#define ONIG_SYN_OP2_ESC_U_HEX4 (1U<<14) /* \uHHHH */
|
||||
#define ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR (1U<<15) /* \`, \' */
|
||||
#define ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY (1U<<16) /* \p{...}, \P{...} */
|
||||
#define ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT (1U<<17) /* \p{^..}, \P{^..} */
|
||||
/* #define ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS (1U<<18) */
|
||||
#define ONIG_SYN_OP2_ESC_H_XDIGIT (1U<<19) /* \h, \H */
|
||||
#define ONIG_SYN_OP2_INEFFECTIVE_ESCAPE (1U<<20) /* \ */
|
||||
|
||||
/* syntax (behavior) */
|
||||
#define ONIG_SYN_CONTEXT_INDEP_ANCHORS (1U<<31) /* not implemented */
|
||||
#define ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS (1U<<0) /* ?, *, +, {n,m} */
|
||||
#define ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS (1U<<1) /* error or ignore */
|
||||
#define ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP (1U<<2) /* ...)... */
|
||||
#define ONIG_SYN_ALLOW_INVALID_INTERVAL (1U<<3) /* {??? */
|
||||
#define ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV (1U<<4) /* {,n} => {0,n} */
|
||||
#define ONIG_SYN_STRICT_CHECK_BACKREF (1U<<5) /* /(\1)/,/\1()/ ..*/
|
||||
#define ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND (1U<<6) /* (?<=a|bc) */
|
||||
#define ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP (1U<<7) /* see doc/RE */
|
||||
#define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME (1U<<8) /* (?<x>)(?<x>) */
|
||||
#define ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY (1U<<9) /* a{n}?=(?:a{n})? */
|
||||
|
||||
/* syntax (behavior) in char class [...] */
|
||||
#define ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC (1U<<20) /* [^...] */
|
||||
#define ONIG_SYN_BACKSLASH_ESCAPE_IN_CC (1U<<21) /* [..\w..] etc.. */
|
||||
#define ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC (1U<<22)
|
||||
#define ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC (1U<<23) /* [0-9-a]=[0-9\-a] */
|
||||
/* syntax (behavior) warning */
|
||||
#define ONIG_SYN_WARN_CC_OP_NOT_ESCAPED (1U<<24) /* [,-,] */
|
||||
#define ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT (1U<<25) /* (?:a*)+ */
|
||||
|
||||
/* meta character specifiers (onig_set_meta_char()) */
|
||||
#define ONIG_META_CHAR_ESCAPE 0
|
||||
#define ONIG_META_CHAR_ANYCHAR 1
|
||||
#define ONIG_META_CHAR_ANYTIME 2
|
||||
#define ONIG_META_CHAR_ZERO_OR_ONE_TIME 3
|
||||
#define ONIG_META_CHAR_ONE_OR_MORE_TIME 4
|
||||
#define ONIG_META_CHAR_ANYCHAR_ANYTIME 5
|
||||
|
||||
#define ONIG_INEFFECTIVE_META_CHAR 0
|
||||
|
||||
/* error codes */
|
||||
#define ONIG_IS_PATTERN_ERROR(ecode) ((ecode) <= -100 && (ecode) > -1000)
|
||||
/* normal return */
|
||||
#define ONIG_NORMAL 0
|
||||
#define ONIG_MISMATCH -1
|
||||
#define ONIG_NO_SUPPORT_CONFIG -2
|
||||
|
||||
/* internal error */
|
||||
#define ONIGERR_MEMORY -5
|
||||
#define ONIGERR_TYPE_BUG -6
|
||||
#define ONIGERR_PARSER_BUG -11
|
||||
#define ONIGERR_STACK_BUG -12
|
||||
#define ONIGERR_UNDEFINED_BYTECODE -13
|
||||
#define ONIGERR_UNEXPECTED_BYTECODE -14
|
||||
#define ONIGERR_MATCH_STACK_LIMIT_OVER -15
|
||||
#define ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED -21
|
||||
#define ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR -22
|
||||
/* general error */
|
||||
#define ONIGERR_INVALID_ARGUMENT -30
|
||||
/* syntax error */
|
||||
#define ONIGERR_END_PATTERN_AT_LEFT_BRACE -100
|
||||
#define ONIGERR_END_PATTERN_AT_LEFT_BRACKET -101
|
||||
#define ONIGERR_EMPTY_CHAR_CLASS -102
|
||||
#define ONIGERR_PREMATURE_END_OF_CHAR_CLASS -103
|
||||
#define ONIGERR_END_PATTERN_AT_ESCAPE -104
|
||||
#define ONIGERR_END_PATTERN_AT_META -105
|
||||
#define ONIGERR_END_PATTERN_AT_CONTROL -106
|
||||
#define ONIGERR_META_CODE_SYNTAX -108
|
||||
#define ONIGERR_CONTROL_CODE_SYNTAX -109
|
||||
#define ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE -110
|
||||
#define ONIGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE -111
|
||||
#define ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS -112
|
||||
#define ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED -113
|
||||
#define ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID -114
|
||||
#define ONIGERR_NESTED_REPEAT_OPERATOR -115
|
||||
#define ONIGERR_UNMATCHED_CLOSE_PARENTHESIS -116
|
||||
#define ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS -117
|
||||
#define ONIGERR_END_PATTERN_IN_GROUP -118
|
||||
#define ONIGERR_UNDEFINED_GROUP_OPTION -119
|
||||
#define ONIGERR_INVALID_POSIX_BRACKET_TYPE -121
|
||||
#define ONIGERR_INVALID_LOOK_BEHIND_PATTERN -122
|
||||
#define ONIGERR_INVALID_REPEAT_RANGE_PATTERN -123
|
||||
/* values error (syntax error) */
|
||||
#define ONIGERR_TOO_BIG_NUMBER -200
|
||||
#define ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE -201
|
||||
#define ONIGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE -202
|
||||
#define ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS -203
|
||||
#define ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE -204
|
||||
#define ONIGERR_TOO_MANY_MULTI_BYTE_RANGES -205
|
||||
#define ONIGERR_TOO_SHORT_MULTI_BYTE_STRING -206
|
||||
#define ONIGERR_TOO_BIG_BACKREF_NUMBER -207
|
||||
#define ONIGERR_INVALID_BACKREF -208
|
||||
#define ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED -209
|
||||
#define ONIGERR_TOO_LONG_WIDE_CHAR_VALUE -212
|
||||
#define ONIGERR_EMPTY_GROUP_NAME -214
|
||||
#define ONIGERR_INVALID_GROUP_NAME -215
|
||||
#define ONIGERR_INVALID_CHAR_IN_GROUP_NAME -216
|
||||
#define ONIGERR_UNDEFINED_NAME_REFERENCE -217
|
||||
#define ONIGERR_UNDEFINED_GROUP_REFERENCE -218
|
||||
#define ONIGERR_MULTIPLEX_DEFINED_NAME -219
|
||||
#define ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL -220
|
||||
#define ONIGERR_NEVER_ENDING_RECURSION -221
|
||||
#define ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY -222
|
||||
#define ONIGERR_INVALID_CHAR_PROPERTY_NAME -223
|
||||
#define ONIGERR_INVALID_CODE_POINT_VALUE -400
|
||||
#define ONIGERR_INVALID_WIDE_CHAR_VALUE -400
|
||||
#define ONIGERR_TOO_BIG_WIDE_CHAR_VALUE -401
|
||||
#define ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION -402
|
||||
#define ONIGERR_INVALID_COMBINATION_OF_OPTIONS -403
|
||||
|
||||
/* errors related to thread */
|
||||
#define ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT -1001
|
||||
|
||||
|
||||
/* must be smaller than BIT_STATUS_BITS_NUM (unsigned int * 8) */
|
||||
#define ONIG_MAX_CAPTURE_HISTORY_GROUP 31
|
||||
#define ONIG_IS_CAPTURE_HISTORY_GROUP(r, i) \
|
||||
((i) <= ONIG_MAX_CAPTURE_HISTORY_GROUP && (r)->list && (r)->list[i])
|
||||
|
||||
typedef struct OnigCaptureTreeNodeStruct {
|
||||
int group; /* group number */
|
||||
int beg;
|
||||
int end;
|
||||
int allocated;
|
||||
int num_childs;
|
||||
struct OnigCaptureTreeNodeStruct** childs;
|
||||
} OnigCaptureTreeNode;
|
||||
|
||||
/* match result region type */
|
||||
struct re_registers {
|
||||
int allocated;
|
||||
int num_regs;
|
||||
int* beg;
|
||||
int* end;
|
||||
/* extended */
|
||||
OnigCaptureTreeNode* history_root; /* capture history tree root */
|
||||
};
|
||||
|
||||
/* capture tree traverse */
|
||||
#define ONIG_TRAVERSE_CALLBACK_AT_FIRST 1
|
||||
#define ONIG_TRAVERSE_CALLBACK_AT_LAST 2
|
||||
#define ONIG_TRAVERSE_CALLBACK_AT_BOTH \
|
||||
( ONIG_TRAVERSE_CALLBACK_AT_FIRST | ONIG_TRAVERSE_CALLBACK_AT_LAST )
|
||||
|
||||
|
||||
#define ONIG_REGION_NOTPOS -1
|
||||
|
||||
typedef struct re_registers OnigRegion;
|
||||
|
||||
typedef struct {
|
||||
OnigEncoding enc;
|
||||
OnigUChar* par;
|
||||
OnigUChar* par_end;
|
||||
} OnigErrorInfo;
|
||||
|
||||
typedef struct {
|
||||
int lower;
|
||||
int upper;
|
||||
} OnigRepeatRange;
|
||||
|
||||
typedef void (*OnigWarnFunc) P_((const char* s));
|
||||
extern void onig_null_warn P_((const char* s));
|
||||
#define ONIG_NULL_WARN onig_null_warn
|
||||
|
||||
#define ONIG_CHAR_TABLE_SIZE 256
|
||||
|
||||
/* regex_t state */
|
||||
#define ONIG_STATE_NORMAL 0
|
||||
#define ONIG_STATE_SEARCHING 1
|
||||
#define ONIG_STATE_COMPILING -1
|
||||
#define ONIG_STATE_MODIFY -2
|
||||
|
||||
#define ONIG_STATE(reg) \
|
||||
((reg)->state > 0 ? ONIG_STATE_SEARCHING : (reg)->state)
|
||||
|
||||
typedef struct re_pattern_buffer {
|
||||
/* common members of BBuf(bytes-buffer) */
|
||||
unsigned char* p; /* compiled pattern */
|
||||
unsigned int used; /* used space for p */
|
||||
unsigned int alloc; /* allocated space for p */
|
||||
|
||||
int state; /* normal, searching, compiling */
|
||||
int num_mem; /* used memory(...) num counted from 1 */
|
||||
int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */
|
||||
int num_null_check; /* OP_NULL_CHECK_START/END id counter */
|
||||
int num_comb_exp_check; /* combination explosion check */
|
||||
int num_call; /* number of subexp call */
|
||||
unsigned int capture_history; /* (?@...) flag (1-31) */
|
||||
unsigned int bt_mem_start; /* need backtrack flag */
|
||||
unsigned int bt_mem_end; /* need backtrack flag */
|
||||
int stack_pop_level;
|
||||
int repeat_range_alloc;
|
||||
OnigRepeatRange* repeat_range;
|
||||
|
||||
OnigEncoding enc;
|
||||
OnigOptionType options;
|
||||
OnigSyntaxType* syntax;
|
||||
OnigCaseFoldType case_fold_flag;
|
||||
void* name_table;
|
||||
|
||||
/* optimization info (string search, char-map and anchors) */
|
||||
int optimize; /* optimize flag */
|
||||
int threshold_len; /* search str-length for apply optimize */
|
||||
int anchor; /* BEGIN_BUF, BEGIN_POS, (SEMI_)END_BUF */
|
||||
OnigDistance anchor_dmin; /* (SEMI_)END_BUF anchor distance */
|
||||
OnigDistance anchor_dmax; /* (SEMI_)END_BUF anchor distance */
|
||||
int sub_anchor; /* start-anchor for exact or map */
|
||||
unsigned char *exact;
|
||||
unsigned char *exact_end;
|
||||
unsigned char map[ONIG_CHAR_TABLE_SIZE]; /* used as BM skip or char-map */
|
||||
int *int_map; /* BM skip for exact_len > 255 */
|
||||
int *int_map_backward; /* BM skip for backward search */
|
||||
OnigDistance dmin; /* min-distance of exact or map */
|
||||
OnigDistance dmax; /* max-distance of exact or map */
|
||||
|
||||
/* regex_t link chain */
|
||||
struct re_pattern_buffer* chain; /* escape compile-conflict */
|
||||
} OnigRegexType;
|
||||
|
||||
typedef OnigRegexType* OnigRegex;
|
||||
|
||||
#ifndef ONIG_ESCAPE_REGEX_T_COLLISION
|
||||
typedef OnigRegexType regex_t;
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
int num_of_elements;
|
||||
OnigEncoding pattern_enc;
|
||||
OnigEncoding target_enc;
|
||||
OnigSyntaxType* syntax;
|
||||
OnigOptionType option;
|
||||
OnigCaseFoldType case_fold_flag;
|
||||
} OnigCompileInfo;
|
||||
|
||||
/* Oniguruma Native API */
|
||||
ONIG_EXTERN
|
||||
int onig_init P_((void));
|
||||
ONIG_EXTERN
|
||||
int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));
|
||||
ONIG_EXTERN
|
||||
void onig_set_warn_func P_((OnigWarnFunc f));
|
||||
ONIG_EXTERN
|
||||
void onig_set_verb_warn_func P_((OnigWarnFunc f));
|
||||
ONIG_EXTERN
|
||||
int onig_new P_((OnigRegex*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
|
||||
ONIG_EXTERN
|
||||
int onig_reg_init P_((regex_t* reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, OnigSyntaxType* syntax));
|
||||
int onig_new_without_alloc P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
|
||||
ONIG_EXTERN
|
||||
int onig_new_deluxe P_((OnigRegex* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
|
||||
ONIG_EXTERN
|
||||
void onig_free P_((OnigRegex));
|
||||
ONIG_EXTERN
|
||||
void onig_free_body P_((OnigRegex));
|
||||
ONIG_EXTERN
|
||||
int onig_recompile P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
|
||||
ONIG_EXTERN
|
||||
int onig_recompile_deluxe P_((OnigRegex reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
|
||||
ONIG_EXTERN
|
||||
int onig_search P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option));
|
||||
ONIG_EXTERN
|
||||
int onig_match P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option));
|
||||
ONIG_EXTERN
|
||||
OnigRegion* onig_region_new P_((void));
|
||||
ONIG_EXTERN
|
||||
void onig_region_init P_((OnigRegion* region));
|
||||
ONIG_EXTERN
|
||||
void onig_region_free P_((OnigRegion* region, int free_self));
|
||||
ONIG_EXTERN
|
||||
void onig_region_copy P_((OnigRegion* to, OnigRegion* from));
|
||||
ONIG_EXTERN
|
||||
void onig_region_clear P_((OnigRegion* region));
|
||||
ONIG_EXTERN
|
||||
int onig_region_resize P_((OnigRegion* region, int n));
|
||||
ONIG_EXTERN
|
||||
int onig_region_set P_((OnigRegion* region, int at, int beg, int end));
|
||||
ONIG_EXTERN
|
||||
int onig_name_to_group_numbers P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, int** nums));
|
||||
ONIG_EXTERN
|
||||
int onig_name_to_backref_number P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, OnigRegion *region));
|
||||
ONIG_EXTERN
|
||||
int onig_foreach_name P_((OnigRegex reg, int (*func)(const OnigUChar*, const OnigUChar*,int,int*,OnigRegex,void*), void* arg));
|
||||
ONIG_EXTERN
|
||||
int onig_number_of_names P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
int onig_number_of_captures P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
int onig_number_of_capture_histories P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
OnigCaptureTreeNode* onig_get_capture_tree P_((OnigRegion* region));
|
||||
ONIG_EXTERN
|
||||
int onig_capture_tree_traverse P_((OnigRegion* region, int at, int(*callback_func)(int,int,int,int,int,void*), void* arg));
|
||||
ONIG_EXTERN
|
||||
int onig_noname_group_capture_is_active P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
OnigEncoding onig_get_encoding P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
OnigOptionType onig_get_options P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
OnigCaseFoldType onig_get_case_fold_flag P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
OnigSyntaxType* onig_get_syntax P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
int onig_set_default_syntax P_((OnigSyntaxType* syntax));
|
||||
ONIG_EXTERN
|
||||
void onig_copy_syntax P_((OnigSyntaxType* to, OnigSyntaxType* from));
|
||||
ONIG_EXTERN
|
||||
unsigned int onig_get_syntax_op P_((OnigSyntaxType* syntax));
|
||||
ONIG_EXTERN
|
||||
unsigned int onig_get_syntax_op2 P_((OnigSyntaxType* syntax));
|
||||
ONIG_EXTERN
|
||||
unsigned int onig_get_syntax_behavior P_((OnigSyntaxType* syntax));
|
||||
ONIG_EXTERN
|
||||
OnigOptionType onig_get_syntax_options P_((OnigSyntaxType* syntax));
|
||||
ONIG_EXTERN
|
||||
void onig_set_syntax_op P_((OnigSyntaxType* syntax, unsigned int op));
|
||||
ONIG_EXTERN
|
||||
void onig_set_syntax_op2 P_((OnigSyntaxType* syntax, unsigned int op2));
|
||||
ONIG_EXTERN
|
||||
void onig_set_syntax_behavior P_((OnigSyntaxType* syntax, unsigned int behavior));
|
||||
ONIG_EXTERN
|
||||
void onig_set_syntax_options P_((OnigSyntaxType* syntax, OnigOptionType options));
|
||||
ONIG_EXTERN
|
||||
int onig_set_meta_char P_((OnigSyntaxType* syntax, unsigned int what, OnigCodePoint code));
|
||||
ONIG_EXTERN
|
||||
void onig_copy_encoding P_((OnigEncoding to, OnigEncoding from));
|
||||
ONIG_EXTERN
|
||||
OnigCaseFoldType onig_get_default_case_fold_flag P_((void));
|
||||
ONIG_EXTERN
|
||||
int onig_set_default_case_fold_flag P_((OnigCaseFoldType case_fold_flag));
|
||||
ONIG_EXTERN
|
||||
unsigned int onig_get_match_stack_limit_size P_((void));
|
||||
ONIG_EXTERN
|
||||
int onig_set_match_stack_limit_size P_((unsigned int size));
|
||||
ONIG_EXTERN
|
||||
int onig_end P_((void));
|
||||
ONIG_EXTERN
|
||||
const char* onig_version P_((void));
|
||||
ONIG_EXTERN
|
||||
const char* onig_copyright P_((void));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ONIGURUMA_H */
|
||||
BIN
Arquivo binário não exibido.
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário