1 #include "clar_libgit2.h"
2 #include "status_helpers.h"
5 const char *path
, unsigned int status_flags
, void *payload
)
7 status_entry_counts
*counts
= payload
;
10 cb_status__print(path
, status_flags
, NULL
);
12 if (counts
->entry_count
>= counts
->expected_entry_count
) {
13 counts
->wrong_status_flags_count
++;
17 if (strcmp(path
, counts
->expected_paths
[counts
->entry_count
])) {
18 counts
->wrong_sorted_path
++;
22 if (status_flags
!= counts
->expected_statuses
[counts
->entry_count
])
23 counts
->wrong_status_flags_count
++;
26 counts
->entry_count
++;
30 int cb_status__count(const char *p
, unsigned int s
, void *payload
)
32 volatile int *count
= (int *)payload
;
42 int cb_status__single(const char *p
, unsigned int s
, void *payload
)
44 status_entry_single
*data
= (status_entry_single
*)payload
;
47 fprintf(stderr
, "%02d: %s (%04x)\n", data
->count
, p
, s
);
56 const char *path
, unsigned int status_flags
, void *payload
)
58 char istatus
= ' ', wstatus
= ' ';
59 int icount
= 0, wcount
= 0;
61 if (status_flags
& GIT_STATUS_INDEX_NEW
) {
62 istatus
= 'A'; icount
++;
64 if (status_flags
& GIT_STATUS_INDEX_MODIFIED
) {
65 istatus
= 'M'; icount
++;
67 if (status_flags
& GIT_STATUS_INDEX_DELETED
) {
68 istatus
= 'D'; icount
++;
70 if (status_flags
& GIT_STATUS_INDEX_RENAMED
) {
71 istatus
= 'R'; icount
++;
73 if (status_flags
& GIT_STATUS_INDEX_TYPECHANGE
) {
74 istatus
= 'T'; icount
++;
77 if (status_flags
& GIT_STATUS_WT_NEW
) {
78 wstatus
= 'A'; wcount
++;
80 if (status_flags
& GIT_STATUS_WT_MODIFIED
) {
81 wstatus
= 'M'; wcount
++;
83 if (status_flags
& GIT_STATUS_WT_DELETED
) {
84 wstatus
= 'D'; wcount
++;
86 if (status_flags
& GIT_STATUS_WT_TYPECHANGE
) {
87 wstatus
= 'T'; wcount
++;
89 if (status_flags
& GIT_STATUS_IGNORED
) {
90 wstatus
= 'I'; wcount
++;
93 fprintf(stderr
, "%c%c %s (%d/%d%s)\n",
94 istatus
, wstatus
, path
, icount
, wcount
,
95 (icount
> 1 || wcount
> 1) ? " INVALID COMBO" : "");
98 *((int *)payload
) += 1;