You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tree_entry_mode.go 876B

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package git
  4. import "strconv"
  5. // EntryMode the type of the object in the git tree
  6. type EntryMode int
  7. // There are only a few file modes in Git. They look like unix file modes, but they can only be
  8. // one of these.
  9. const (
  10. // EntryModeBlob
  11. EntryModeBlob EntryMode = 0o100644
  12. // EntryModeExec
  13. EntryModeExec EntryMode = 0o100755
  14. // EntryModeSymlink
  15. EntryModeSymlink EntryMode = 0o120000
  16. // EntryModeCommit
  17. EntryModeCommit EntryMode = 0o160000
  18. // EntryModeTree
  19. EntryModeTree EntryMode = 0o040000
  20. )
  21. // String converts an EntryMode to a string
  22. func (e EntryMode) String() string {
  23. return strconv.FormatInt(int64(e), 8)
  24. }
  25. // ToEntryMode converts a string to an EntryMode
  26. func ToEntryMode(value string) EntryMode {
  27. v, _ := strconv.ParseInt(value, 8, 32)
  28. return EntryMode(v)
  29. }