@@ -415,6 +415,7 @@ pub enum FileFavor {
415
415
416
416
bitflags ! {
417
417
/// Orderings that may be specified for Revwalk iteration.
418
+ #[ derive( 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( 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( 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( 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( 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( 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( 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( 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( 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( 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( 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( 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( 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( 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( 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( 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( 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( PartialEq ) ]
1456
1474
pub struct StashFlags : u32 {
1457
1475
#[ allow( missing_docs) ]
1458
1476
const DEFAULT = raw:: GIT_STASH_DEFAULT as u32 ;
@@ -1483,6 +1501,7 @@ impl Default for StashFlags {
1483
1501
1484
1502
bitflags ! {
1485
1503
#[ allow( missing_docs) ]
1504
+ #[ derive( PartialEq ) ]
1486
1505
pub struct AttrCheckFlags : u32 {
1487
1506
/// Check the working directory, then the index.
1488
1507
const FILE_THEN_INDEX = raw:: GIT_ATTR_CHECK_FILE_THEN_INDEX as u32 ;
@@ -1503,6 +1522,7 @@ impl Default for AttrCheckFlags {
1503
1522
1504
1523
bitflags ! {
1505
1524
#[ allow( missing_docs) ]
1525
+ #[ derive( PartialEq ) ]
1506
1526
pub struct DiffFlags : u32 {
1507
1527
/// File(s) treated as binary data.
1508
1528
const BINARY = raw:: GIT_DIFF_FLAG_BINARY as u32 ;
@@ -1524,6 +1544,7 @@ impl DiffFlags {
1524
1544
1525
1545
bitflags ! {
1526
1546
/// Options for [`Reference::normalize_name`].
1547
+ #[ derive( PartialEq ) ]
1527
1548
pub struct ReferenceFormat : u32 {
1528
1549
/// No particular normalization.
1529
1550
const NORMAL = raw:: GIT_REFERENCE_FORMAT_NORMAL as u32 ;
@@ -1576,4 +1597,37 @@ mod tests {
1576
1597
assert_eq ! ( u32 :: from( FileMode :: BlobGroupWritable ) , 0o100664 ) ;
1577
1598
assert_eq ! ( u32 :: from( FileMode :: BlobExecutable ) , 0o100755 ) ;
1578
1599
}
1600
+
1601
+ #[ test]
1602
+ fn bitflags_partial_eq ( ) {
1603
+ use super :: {
1604
+ AttrCheckFlags , CheckoutNotificationType , CredentialType , DiffFlags , DiffStatsFormat ,
1605
+ IndexAddOption , IndexEntryExtendedFlag , IndexEntryFlag , MergeAnalysis , MergePreference ,
1606
+ OdbLookupFlags , PathspecFlags , ReferenceFormat , RepositoryInitMode ,
1607
+ RepositoryOpenFlags , RevparseMode , Sort , StashApplyFlags , StashFlags , Status ,
1608
+ SubmoduleStatus ,
1609
+ } ;
1610
+
1611
+ assert ! ( AttrCheckFlags :: FILE_THEN_INDEX == AttrCheckFlags :: FILE_THEN_INDEX ) ;
1612
+ assert ! ( CheckoutNotificationType :: CONFLICT == CheckoutNotificationType :: CONFLICT ) ;
1613
+ assert ! ( CredentialType :: USER_PASS_PLAINTEXT == CredentialType :: USER_PASS_PLAINTEXT ) ;
1614
+ assert ! ( DiffFlags :: BINARY == DiffFlags :: BINARY ) ;
1615
+ assert ! ( DiffStatsFormat :: INCLUDE_SUMMARY == DiffStatsFormat :: INCLUDE_SUMMARY ) ;
1616
+ assert ! ( IndexAddOption :: CHECK_PATHSPEC == IndexAddOption :: CHECK_PATHSPEC ) ;
1617
+ assert ! ( IndexEntryExtendedFlag :: INTENT_TO_ADD == IndexEntryExtendedFlag :: INTENT_TO_ADD ) ;
1618
+ assert ! ( IndexEntryFlag :: EXTENDED == IndexEntryFlag :: EXTENDED ) ;
1619
+ assert ! ( MergeAnalysis :: ANALYSIS_FASTFORWARD == MergeAnalysis :: ANALYSIS_FASTFORWARD ) ;
1620
+ assert ! ( MergePreference :: FASTFORWARD_ONLY == MergePreference :: FASTFORWARD_ONLY ) ;
1621
+ assert ! ( OdbLookupFlags :: NO_REFRESH == OdbLookupFlags :: NO_REFRESH ) ;
1622
+ assert ! ( PathspecFlags :: FAILURES_ONLY == PathspecFlags :: FAILURES_ONLY ) ;
1623
+ assert ! ( ReferenceFormat :: ALLOW_ONELEVEL == ReferenceFormat :: ALLOW_ONELEVEL ) ;
1624
+ assert ! ( RepositoryInitMode :: SHARED_ALL == RepositoryInitMode :: SHARED_ALL ) ;
1625
+ assert ! ( RepositoryOpenFlags :: CROSS_FS == RepositoryOpenFlags :: CROSS_FS ) ;
1626
+ assert ! ( RevparseMode :: RANGE == RevparseMode :: RANGE ) ;
1627
+ assert ! ( Sort :: REVERSE == Sort :: REVERSE ) ;
1628
+ assert ! ( StashApplyFlags :: REINSTATE_INDEX == StashApplyFlags :: REINSTATE_INDEX ) ;
1629
+ assert ! ( StashFlags :: INCLUDE_IGNORED == StashFlags :: INCLUDE_IGNORED ) ;
1630
+ assert ! ( Status :: WT_MODIFIED == Status :: WT_MODIFIED ) ;
1631
+ assert ! ( SubmoduleStatus :: WD_ADDED == SubmoduleStatus :: WD_ADDED ) ;
1632
+ }
1579
1633
}
0 commit comments