Skip to content

Commit a2e05da

Browse files
authored
Merge pull request #1096 from kjughx/backcompat-traits
Maintain backwards compatibility for bitflags types
2 parents 8471723 + 4639d78 commit a2e05da

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/lib.rs

+22-22
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ pub enum FileFavor {
419419

420420
bitflags! {
421421
/// Orderings that may be specified for Revwalk iteration.
422-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
422+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
423423
pub struct Sort: u32 {
424424
/// Sort the repository contents in no particular ordering.
425425
///
@@ -454,7 +454,7 @@ impl Sort {
454454

455455
bitflags! {
456456
/// Types of credentials that can be requested by a credential callback.
457-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
457+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
458458
pub struct CredentialType: u32 {
459459
#[allow(missing_docs)]
460460
const USER_PASS_PLAINTEXT = raw::GIT_CREDTYPE_USERPASS_PLAINTEXT as u32;
@@ -491,7 +491,7 @@ impl Default for CredentialType {
491491

492492
bitflags! {
493493
/// Flags for the `flags` field of an IndexEntry.
494-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
494+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
495495
pub struct IndexEntryFlag: u16 {
496496
/// Set when the `extended_flags` field is valid.
497497
const EXTENDED = raw::GIT_INDEX_ENTRY_EXTENDED as u16;
@@ -507,7 +507,7 @@ impl IndexEntryFlag {
507507

508508
bitflags! {
509509
/// Flags for the `extended_flags` field of an IndexEntry.
510-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
510+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
511511
pub struct IndexEntryExtendedFlag: u16 {
512512
/// An "intent to add" entry from "git add -N"
513513
const INTENT_TO_ADD = raw::GIT_INDEX_ENTRY_INTENT_TO_ADD as u16;
@@ -527,7 +527,7 @@ impl IndexEntryExtendedFlag {
527527

528528
bitflags! {
529529
/// Flags for APIs that add files matching pathspec
530-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
530+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
531531
pub struct IndexAddOption: u32 {
532532
#[allow(missing_docs)]
533533
const DEFAULT = raw::GIT_INDEX_ADD_DEFAULT as u32;
@@ -559,7 +559,7 @@ impl Default for IndexAddOption {
559559

560560
bitflags! {
561561
/// Flags for `Repository::open_ext`
562-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
562+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
563563
pub struct RepositoryOpenFlags: u32 {
564564
/// Only open the specified path; don't walk upward searching.
565565
const NO_SEARCH = raw::GIT_REPOSITORY_OPEN_NO_SEARCH as u32;
@@ -584,7 +584,7 @@ impl RepositoryOpenFlags {
584584

585585
bitflags! {
586586
/// Flags for the return value of `Repository::revparse`
587-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
587+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
588588
pub struct RevparseMode: u32 {
589589
/// The spec targeted a single object
590590
const SINGLE = raw::GIT_REVPARSE_SINGLE as u32;
@@ -603,7 +603,7 @@ impl RevparseMode {
603603

604604
bitflags! {
605605
/// The results of `merge_analysis` indicating the merge opportunities.
606-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
606+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
607607
pub struct MergeAnalysis: u32 {
608608
/// No merge is possible.
609609
const ANALYSIS_NONE = raw::GIT_MERGE_ANALYSIS_NONE as u32;
@@ -634,7 +634,7 @@ impl MergeAnalysis {
634634

635635
bitflags! {
636636
/// The user's stated preference for merges.
637-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
637+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
638638
pub struct MergePreference: u32 {
639639
/// No configuration was found that suggests a preferred behavior for
640640
/// merge.
@@ -656,7 +656,7 @@ impl MergePreference {
656656

657657
bitflags! {
658658
/// Flags controlling the behavior of ODB lookup operations
659-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
659+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
660660
pub struct OdbLookupFlags: u32 {
661661
/// Don't call `git_odb_refresh` if the lookup fails. Useful when doing
662662
/// a batch of lookup operations for objects that may legitimately not
@@ -668,7 +668,7 @@ bitflags! {
668668

669669
bitflags! {
670670
/// How to handle reference updates.
671-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
671+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
672672
pub struct RemoteUpdateFlags: u32 {
673673
/// Write the fetch results to FETCH_HEAD.
674674
const UPDATE_FETCHHEAD = raw::GIT_REMOTE_UPDATE_FETCHHEAD as u32;
@@ -1023,7 +1023,7 @@ bitflags! {
10231023
/// represents the status of file in the index relative to the HEAD, and the
10241024
/// `STATUS_WT_*` set of flags represent the status of the file in the
10251025
/// working directory relative to the index.
1026-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
1026+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
10271027
pub struct Status: u32 {
10281028
#[allow(missing_docs)]
10291029
const CURRENT = raw::GIT_STATUS_CURRENT as u32;
@@ -1074,7 +1074,7 @@ impl Status {
10741074

10751075
bitflags! {
10761076
/// Mode options for RepositoryInitOptions
1077-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
1077+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
10781078
pub struct RepositoryInitMode: u32 {
10791079
/// Use permissions configured by umask - the default
10801080
const SHARED_UMASK = raw::GIT_REPOSITORY_INIT_SHARED_UMASK as u32;
@@ -1207,7 +1207,7 @@ bitflags! {
12071207
/// Lastly, the following will only be returned for ignore "NONE".
12081208
///
12091209
/// * WD_UNTRACKED - workdir contains untracked files
1210-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
1210+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
12111211
pub struct SubmoduleStatus: u32 {
12121212
#[allow(missing_docs)]
12131213
const IN_HEAD = raw::GIT_SUBMODULE_STATUS_IN_HEAD as u32;
@@ -1304,7 +1304,7 @@ pub enum SubmoduleUpdate {
13041304

13051305
bitflags! {
13061306
/// ...
1307-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
1307+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
13081308
pub struct PathspecFlags: u32 {
13091309
/// Use the default pathspec matching configuration.
13101310
const DEFAULT = raw::GIT_PATHSPEC_DEFAULT as u32;
@@ -1350,7 +1350,7 @@ impl Default for PathspecFlags {
13501350

13511351
bitflags! {
13521352
/// Types of notifications emitted from checkouts.
1353-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
1353+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
13541354
pub struct CheckoutNotificationType: u32 {
13551355
/// Notification about a conflict.
13561356
const CONFLICT = raw::GIT_CHECKOUT_NOTIFY_CONFLICT as u32;
@@ -1392,7 +1392,7 @@ pub enum DiffFormat {
13921392

13931393
bitflags! {
13941394
/// Formatting options for diff stats
1395-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
1395+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
13961396
pub struct DiffStatsFormat: raw::git_diff_stats_format_t {
13971397
/// Don't generate any stats
13981398
const NONE = raw::GIT_DIFF_STATS_NONE;
@@ -1463,7 +1463,7 @@ pub enum StashApplyProgress {
14631463

14641464
bitflags! {
14651465
#[allow(missing_docs)]
1466-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
1466+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
14671467
pub struct StashApplyFlags: u32 {
14681468
#[allow(missing_docs)]
14691469
const DEFAULT = raw::GIT_STASH_APPLY_DEFAULT as u32;
@@ -1486,7 +1486,7 @@ impl Default for StashApplyFlags {
14861486

14871487
bitflags! {
14881488
#[allow(missing_docs)]
1489-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
1489+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
14901490
pub struct StashFlags: u32 {
14911491
#[allow(missing_docs)]
14921492
const DEFAULT = raw::GIT_STASH_DEFAULT as u32;
@@ -1519,7 +1519,7 @@ impl Default for StashFlags {
15191519

15201520
bitflags! {
15211521
#[allow(missing_docs)]
1522-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
1522+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
15231523
pub struct AttrCheckFlags: u32 {
15241524
/// Check the working directory, then the index.
15251525
const FILE_THEN_INDEX = raw::GIT_ATTR_CHECK_FILE_THEN_INDEX as u32;
@@ -1540,7 +1540,7 @@ impl Default for AttrCheckFlags {
15401540

15411541
bitflags! {
15421542
#[allow(missing_docs)]
1543-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
1543+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
15441544
pub struct DiffFlags: u32 {
15451545
/// File(s) treated as binary data.
15461546
const BINARY = raw::GIT_DIFF_FLAG_BINARY as u32;
@@ -1562,7 +1562,7 @@ impl DiffFlags {
15621562

15631563
bitflags! {
15641564
/// Options for [`Reference::normalize_name`].
1565-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
1565+
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
15661566
pub struct ReferenceFormat: u32 {
15671567
/// No particular normalization.
15681568
const NORMAL = raw::GIT_REFERENCE_FORMAT_NORMAL as u32;

0 commit comments

Comments
 (0)