Commit a5a546b36c184890dee09bd2bd92836c60eec122

Jakob Pfender 2011-04-07T16:53:50

index.h: Correct values for extended flags As libgit2 separates an index entry's 32-bit flag into two 16-bit values flags and flags_extended, the values of flags_extended need to be adjusted.

diff --git a/include/git2/index.h b/include/git2/index.h
index 8a84f50..d69e58b 100644
--- a/include/git2/index.h
+++ b/include/git2/index.h
@@ -51,39 +51,29 @@ GIT_BEGIN_DECL
  *
  * 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_UPDATE            (1 << 0)
+#define GIT_IDXENTRY_REMOVE            (1 << 1)
+#define GIT_IDXENTRY_UPTODATE          (1 << 2)
+#define GIT_IDXENTRY_ADDED             (1 << 3)
 
-#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_HASHED            (1 << 4)
+#define GIT_IDXENTRY_UNHASHED          (1 << 5)
+#define GIT_IDXENTRY_WT_REMOVE         (1 << 6) /* remove in work directory */
+#define GIT_IDXENTRY_CONFLICTED        (1 << 7)
 
-#define GIT_IDXENTRY_UNPACKED          (1 << 24)
-#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 25)
+#define GIT_IDXENTRY_UNPACKED          (1 << 8)
+#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 9)
 
 /*
  * Extended on-disk flags:
  */
-#define GIT_IDXENTRY_INTENT_TO_ADD     (1 << 29)
-#define GIT_IDXENTRY_SKIP_WORKTREE     (1 << 30)
+#define GIT_IDXENTRY_INTENT_TO_ADD     (1 << 13)
+#define GIT_IDXENTRY_SKIP_WORKTREE     (1 << 14)
 /* GIT_IDXENTRY_EXTENDED2 is for future extension */
-#define GIT_IDXENTRY_EXTENDED2         (1 << 31)
+#define GIT_IDXENTRY_EXTENDED2         (1 << 15)
 
 #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;