PageRenderTime 51ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/tig-1.0/refs.h

#
C Header | 41 lines | 23 code | 6 blank | 12 comment | 0 complexity | 55301ed979ded54d30e939adafbca334 MD5 | raw file
Possible License(s): GPL-2.0
  1. /* Copyright (c) 2006-2012 Jonas Fonseca <fonseca@diku.dk>
  2. *
  3. * This program is free software; you can redistribute it and/or
  4. * modify it under the terms of the GNU General Public License as
  5. * published by the Free Software Foundation; either version 2 of
  6. * the License, or (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef TIG_REFS_H
  14. #define TIG_REFS_H
  15. #include "tig.h"
  16. struct ref {
  17. char id[SIZEOF_REV]; /* Commit SHA1 ID */
  18. unsigned int head:1; /* Is it the current HEAD? */
  19. unsigned int tag:1; /* Is it a tag? */
  20. unsigned int ltag:1; /* If so, is the tag local? */
  21. unsigned int remote:1; /* Is it a remote ref? */
  22. unsigned int replace:1; /* Is it a replace ref? */
  23. unsigned int tracked:1; /* Is it the remote for the current HEAD? */
  24. char name[1]; /* Ref name; tag or head names are shortened. */
  25. };
  26. struct ref_list {
  27. char id[SIZEOF_REV]; /* Commit SHA1 ID */
  28. size_t size; /* Number of refs. */
  29. struct ref **refs; /* References for this ID. */
  30. };
  31. struct ref *get_ref_head();
  32. struct ref_list *get_ref_list(const char *id);
  33. void foreach_ref(bool (*visitor)(void *data, const struct ref *ref), void *data);
  34. int reload_refs(const char *git_dir, const char *remote_name, char *head, size_t headlen);
  35. #endif