Skip to content

Commit

Permalink
index.h: Add IDXENTRY flags needed for index operations
Browse files Browse the repository at this point in the history
Add several IDXENTRY flags that need to be checked in
order to properly implement update-index --refresh.
  • Loading branch information
Jakob Pfender authored and vmg committed Apr 8, 2011
1 parent 5924b28 commit 26f2c89
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions include/git2/index.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,46 @@ GIT_BEGIN_DECL
#define GIT_IDXENTRY_VALID (0x8000)
#define GIT_IDXENTRY_STAGESHIFT 12

/*
* Flags are divided into two parts: in-memory flags and
* on-disk ones. Flags in GIT_IDXENTRY_EXTENDED_FLAGS
* will get saved on-disk.
*
* In-memory only flags:
*/
#define GIT_IDXENTRY_UPDATE (1 << 16)
#define GIT_IDXENTRY_REMOVE (1 << 17)
#define GIT_IDXENTRY_UPTODATE (1 << 18)
#define GIT_IDXENTRY_ADDED (1 << 19)

#define GIT_IDXENTRY_HASHED (1 << 20)
#define GIT_IDXENTRY_UNHASHED (1 << 21)
#define GIT_IDXENTRY_WT_REMOVE (1 << 22) /* remove in work directory */
#define GIT_IDXENTRY_CONFLICTED (1 << 23)

#define GIT_IDXENTRY_UNPACKED (1 << 24)
#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 25)

/*
* Extended on-disk flags:
*/
#define GIT_IDXENTRY_INTENT_TO_ADD (1 << 29)
#define GIT_IDXENTRY_SKIP_WORKTREE (1 << 30)
/* GIT_IDXENTRY_EXTENDED2 is for future extension */
#define GIT_IDXENTRY_EXTENDED2 (1 << 31)

#define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_IDXENTRY_INTENT_TO_ADD | GIT_IDXENTRY_SKIP_WORKTREE)

/*
* Safeguard to avoid saving wrong flags:
* - GIT_IDXENTRY_EXTENDED2 won't get saved until its semantic is known
* - Bits in 0x0000FFFF have been saved in flags already
* - Bits in 0x003F0000 are currently in-memory flags
*/
#if GIT_IDXENTRY_EXTENDED_FLAGS & 0x803FFFFF
#error "GIT_IDXENTRY_EXTENDED_FLAGS out of range"
#endif

/** Time used in a git index entry */
typedef struct {
git_time_t seconds;
Expand Down

0 comments on commit 26f2c89

Please sign in to comment.