@@ -415,6 +415,7 @@ pub enum FileFavor {
415
415
416
416
bitflags ! {
417
417
/// Orderings that may be specified for Revwalk iteration.
418
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
418
419
pub struct Sort : u32 {
419
420
/// Sort the repository contents in no particular ordering.
420
421
///
@@ -449,6 +450,7 @@ impl Sort {
449
450
450
451
bitflags ! {
451
452
/// Types of credentials that can be requested by a credential callback.
453
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
452
454
pub struct CredentialType : u32 {
453
455
#[ allow( missing_docs) ]
454
456
const USER_PASS_PLAINTEXT = raw:: GIT_CREDTYPE_USERPASS_PLAINTEXT as u32 ;
@@ -485,6 +487,7 @@ impl Default for CredentialType {
485
487
486
488
bitflags ! {
487
489
/// Flags for the `flags` field of an IndexEntry.
490
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
488
491
pub struct IndexEntryFlag : u16 {
489
492
/// Set when the `extended_flags` field is valid.
490
493
const EXTENDED = raw:: GIT_INDEX_ENTRY_EXTENDED as u16 ;
@@ -500,6 +503,7 @@ impl IndexEntryFlag {
500
503
501
504
bitflags ! {
502
505
/// Flags for the `extended_flags` field of an IndexEntry.
506
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
503
507
pub struct IndexEntryExtendedFlag : u16 {
504
508
/// An "intent to add" entry from "git add -N"
505
509
const INTENT_TO_ADD = raw:: GIT_INDEX_ENTRY_INTENT_TO_ADD as u16 ;
@@ -519,6 +523,7 @@ impl IndexEntryExtendedFlag {
519
523
520
524
bitflags ! {
521
525
/// Flags for APIs that add files matching pathspec
526
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
522
527
pub struct IndexAddOption : u32 {
523
528
#[ allow( missing_docs) ]
524
529
const DEFAULT = raw:: GIT_INDEX_ADD_DEFAULT as u32 ;
@@ -550,6 +555,7 @@ impl Default for IndexAddOption {
550
555
551
556
bitflags ! {
552
557
/// Flags for `Repository::open_ext`
558
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
553
559
pub struct RepositoryOpenFlags : u32 {
554
560
/// Only open the specified path; don't walk upward searching.
555
561
const NO_SEARCH = raw:: GIT_REPOSITORY_OPEN_NO_SEARCH as u32 ;
@@ -574,6 +580,7 @@ impl RepositoryOpenFlags {
574
580
575
581
bitflags ! {
576
582
/// Flags for the return value of `Repository::revparse`
583
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
577
584
pub struct RevparseMode : u32 {
578
585
/// The spec targeted a single object
579
586
const SINGLE = raw:: GIT_REVPARSE_SINGLE as u32 ;
@@ -592,6 +599,7 @@ impl RevparseMode {
592
599
593
600
bitflags ! {
594
601
/// The results of `merge_analysis` indicating the merge opportunities.
602
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
595
603
pub struct MergeAnalysis : u32 {
596
604
/// No merge is possible.
597
605
const ANALYSIS_NONE = raw:: GIT_MERGE_ANALYSIS_NONE as u32 ;
@@ -622,6 +630,7 @@ impl MergeAnalysis {
622
630
623
631
bitflags ! {
624
632
/// The user's stated preference for merges.
633
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
625
634
pub struct MergePreference : u32 {
626
635
/// No configuration was found that suggests a preferred behavior for
627
636
/// merge.
@@ -643,6 +652,7 @@ impl MergePreference {
643
652
644
653
bitflags ! {
645
654
/// Flags controlling the behavior of ODB lookup operations
655
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
646
656
pub struct OdbLookupFlags : u32 {
647
657
/// Don't call `git_odb_refresh` if the lookup fails. Useful when doing
648
658
/// a batch of lookup operations for objects that may legitimately not
@@ -997,6 +1007,7 @@ bitflags! {
997
1007
/// represents the status of file in the index relative to the HEAD, and the
998
1008
/// `STATUS_WT_*` set of flags represent the status of the file in the
999
1009
/// working directory relative to the index.
1010
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1000
1011
pub struct Status : u32 {
1001
1012
#[ allow( missing_docs) ]
1002
1013
const CURRENT = raw:: GIT_STATUS_CURRENT as u32 ;
@@ -1047,6 +1058,7 @@ impl Status {
1047
1058
1048
1059
bitflags ! {
1049
1060
/// Mode options for RepositoryInitOptions
1061
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1050
1062
pub struct RepositoryInitMode : u32 {
1051
1063
/// Use permissions configured by umask - the default
1052
1064
const SHARED_UMASK = raw:: GIT_REPOSITORY_INIT_SHARED_UMASK as u32 ;
@@ -1179,6 +1191,7 @@ bitflags! {
1179
1191
/// Lastly, the following will only be returned for ignore "NONE".
1180
1192
///
1181
1193
/// * WD_UNTRACKED - workdir contains untracked files
1194
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1182
1195
pub struct SubmoduleStatus : u32 {
1183
1196
#[ allow( missing_docs) ]
1184
1197
const IN_HEAD = raw:: GIT_SUBMODULE_STATUS_IN_HEAD as u32 ;
@@ -1275,6 +1288,7 @@ pub enum SubmoduleUpdate {
1275
1288
1276
1289
bitflags ! {
1277
1290
/// ...
1291
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1278
1292
pub struct PathspecFlags : u32 {
1279
1293
/// Use the default pathspec matching configuration.
1280
1294
const DEFAULT = raw:: GIT_PATHSPEC_DEFAULT as u32 ;
@@ -1320,6 +1334,7 @@ impl Default for PathspecFlags {
1320
1334
1321
1335
bitflags ! {
1322
1336
/// Types of notifications emitted from checkouts.
1337
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1323
1338
pub struct CheckoutNotificationType : u32 {
1324
1339
/// Notification about a conflict.
1325
1340
const CONFLICT = raw:: GIT_CHECKOUT_NOTIFY_CONFLICT as u32 ;
@@ -1361,6 +1376,7 @@ pub enum DiffFormat {
1361
1376
1362
1377
bitflags ! {
1363
1378
/// Formatting options for diff stats
1379
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1364
1380
pub struct DiffStatsFormat : raw:: git_diff_stats_format_t {
1365
1381
/// Don't generate any stats
1366
1382
const NONE = raw:: GIT_DIFF_STATS_NONE ;
@@ -1431,6 +1447,7 @@ pub enum StashApplyProgress {
1431
1447
1432
1448
bitflags ! {
1433
1449
#[ allow( missing_docs) ]
1450
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1434
1451
pub struct StashApplyFlags : u32 {
1435
1452
#[ allow( missing_docs) ]
1436
1453
const DEFAULT = raw:: GIT_STASH_APPLY_DEFAULT as u32 ;
@@ -1453,6 +1470,7 @@ impl Default for StashApplyFlags {
1453
1470
1454
1471
bitflags ! {
1455
1472
#[ allow( missing_docs) ]
1473
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1456
1474
pub struct StashFlags : u32 {
1457
1475
#[ allow( missing_docs) ]
1458
1476
const DEFAULT = raw:: GIT_STASH_DEFAULT as u32 ;
@@ -1485,6 +1503,7 @@ impl Default for StashFlags {
1485
1503
1486
1504
bitflags ! {
1487
1505
#[ allow( missing_docs) ]
1506
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1488
1507
pub struct AttrCheckFlags : u32 {
1489
1508
/// Check the working directory, then the index.
1490
1509
const FILE_THEN_INDEX = raw:: GIT_ATTR_CHECK_FILE_THEN_INDEX as u32 ;
@@ -1505,6 +1524,7 @@ impl Default for AttrCheckFlags {
1505
1524
1506
1525
bitflags ! {
1507
1526
#[ allow( missing_docs) ]
1527
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1508
1528
pub struct DiffFlags : u32 {
1509
1529
/// File(s) treated as binary data.
1510
1530
const BINARY = raw:: GIT_DIFF_FLAG_BINARY as u32 ;
@@ -1526,6 +1546,7 @@ impl DiffFlags {
1526
1546
1527
1547
bitflags ! {
1528
1548
/// Options for [`Reference::normalize_name`].
1549
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1529
1550
pub struct ReferenceFormat : u32 {
1530
1551
/// No particular normalization.
1531
1552
const NORMAL = raw:: GIT_REFERENCE_FORMAT_NORMAL as u32 ;
@@ -1578,4 +1599,70 @@ mod tests {
1578
1599
assert_eq ! ( u32 :: from( FileMode :: BlobGroupWritable ) , 0o100664 ) ;
1579
1600
assert_eq ! ( u32 :: from( FileMode :: BlobExecutable ) , 0o100755 ) ;
1580
1601
}
1602
+
1603
+ #[ test]
1604
+ fn bitflags_partial_eq ( ) {
1605
+ use super :: {
1606
+ AttrCheckFlags , CheckoutNotificationType , CredentialType , DiffFlags , DiffStatsFormat ,
1607
+ IndexAddOption , IndexEntryExtendedFlag , IndexEntryFlag , MergeAnalysis , MergePreference ,
1608
+ OdbLookupFlags , PathspecFlags , ReferenceFormat , RepositoryInitMode ,
1609
+ RepositoryOpenFlags , RevparseMode , Sort , StashApplyFlags , StashFlags , Status ,
1610
+ SubmoduleStatus ,
1611
+ } ;
1612
+
1613
+ assert_eq ! (
1614
+ AttrCheckFlags :: FILE_THEN_INDEX ,
1615
+ AttrCheckFlags :: FILE_THEN_INDEX
1616
+ ) ;
1617
+ assert_eq ! (
1618
+ CheckoutNotificationType :: CONFLICT ,
1619
+ CheckoutNotificationType :: CONFLICT
1620
+ ) ;
1621
+ assert_eq ! (
1622
+ CredentialType :: USER_PASS_PLAINTEXT ,
1623
+ CredentialType :: USER_PASS_PLAINTEXT
1624
+ ) ;
1625
+ assert_eq ! ( DiffFlags :: BINARY , DiffFlags :: BINARY ) ;
1626
+ assert_eq ! (
1627
+ DiffStatsFormat :: INCLUDE_SUMMARY ,
1628
+ DiffStatsFormat :: INCLUDE_SUMMARY
1629
+ ) ;
1630
+ assert_eq ! (
1631
+ IndexAddOption :: CHECK_PATHSPEC ,
1632
+ IndexAddOption :: CHECK_PATHSPEC
1633
+ ) ;
1634
+ assert_eq ! (
1635
+ IndexEntryExtendedFlag :: INTENT_TO_ADD ,
1636
+ IndexEntryExtendedFlag :: INTENT_TO_ADD
1637
+ ) ;
1638
+ assert_eq ! ( IndexEntryFlag :: EXTENDED , IndexEntryFlag :: EXTENDED ) ;
1639
+ assert_eq ! (
1640
+ MergeAnalysis :: ANALYSIS_FASTFORWARD ,
1641
+ MergeAnalysis :: ANALYSIS_FASTFORWARD
1642
+ ) ;
1643
+ assert_eq ! (
1644
+ MergePreference :: FASTFORWARD_ONLY ,
1645
+ MergePreference :: FASTFORWARD_ONLY
1646
+ ) ;
1647
+ assert_eq ! ( OdbLookupFlags :: NO_REFRESH , OdbLookupFlags :: NO_REFRESH ) ;
1648
+ assert_eq ! ( PathspecFlags :: FAILURES_ONLY , PathspecFlags :: FAILURES_ONLY ) ;
1649
+ assert_eq ! (
1650
+ ReferenceFormat :: ALLOW_ONELEVEL ,
1651
+ ReferenceFormat :: ALLOW_ONELEVEL
1652
+ ) ;
1653
+ assert_eq ! (
1654
+ RepositoryInitMode :: SHARED_ALL ,
1655
+ RepositoryInitMode :: SHARED_ALL
1656
+ ) ;
1657
+ assert_eq ! ( RepositoryOpenFlags :: CROSS_FS , RepositoryOpenFlags :: CROSS_FS ) ;
1658
+ assert_eq ! ( RevparseMode :: RANGE , RevparseMode :: RANGE ) ;
1659
+ assert_eq ! ( Sort :: REVERSE , Sort :: REVERSE ) ;
1660
+ assert_eq ! (
1661
+ StashApplyFlags :: REINSTATE_INDEX ,
1662
+ StashApplyFlags :: REINSTATE_INDEX
1663
+ ) ;
1664
+ assert_eq ! ( StashFlags :: INCLUDE_IGNORED , StashFlags :: INCLUDE_IGNORED ) ;
1665
+ assert_eq ! ( Status :: WT_MODIFIED , Status :: WT_MODIFIED ) ;
1666
+ assert_eq ! ( SubmoduleStatus :: WD_ADDED , SubmoduleStatus :: WD_ADDED ) ;
1667
+ }
1581
1668
}
0 commit comments