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
++;
14 else if (strcmp(path
, counts
->expected_paths
[counts
->entry_count
]))
15 counts
->wrong_sorted_path
++;
16 else if (status_flags
!= counts
->expected_statuses
[counts
->entry_count
])
17 counts
->wrong_status_flags_count
++;
19 counts
->entry_count
++;
23 int cb_status__count(const char *p
, unsigned int s
, void *payload
)
25 volatile int *count
= (int *)payload
;
35 int cb_status__single(const char *p
, unsigned int s
, void *payload
)
37 status_entry_single
*data
= (status_entry_single
*)payload
;
40 fprintf(stderr
, "%02d: %s (%04x)\n", data
->count
, p
, s
);
49 const char *path
, unsigned int status_flags
, void *payload
)
51 char istatus
= ' ', wstatus
= ' ';
52 int icount
= 0, wcount
= 0;
54 if (status_flags
& GIT_STATUS_INDEX_NEW
) {
55 istatus
= 'A'; icount
++;
57 if (status_flags
& GIT_STATUS_INDEX_MODIFIED
) {
58 istatus
= 'M'; icount
++;
60 if (status_flags
& GIT_STATUS_INDEX_DELETED
) {
61 istatus
= 'D'; icount
++;
63 if (status_flags
& GIT_STATUS_INDEX_RENAMED
) {
64 istatus
= 'R'; icount
++;
66 if (status_flags
& GIT_STATUS_INDEX_TYPECHANGE
) {
67 istatus
= 'T'; icount
++;
70 if (status_flags
& GIT_STATUS_WT_NEW
) {
71 wstatus
= 'A'; wcount
++;
73 if (status_flags
& GIT_STATUS_WT_MODIFIED
) {
74 wstatus
= 'M'; wcount
++;
76 if (status_flags
& GIT_STATUS_WT_DELETED
) {
77 wstatus
= 'D'; wcount
++;
79 if (status_flags
& GIT_STATUS_WT_TYPECHANGE
) {
80 wstatus
= 'T'; wcount
++;
82 if (status_flags
& GIT_STATUS_IGNORED
) {
83 wstatus
= 'I'; wcount
++;
85 if (status_flags
& GIT_STATUS_WT_UNREADABLE
) {
86 wstatus
= 'X'; wcount
++;
89 fprintf(stderr
, "%c%c %s (%d/%d%s)\n",
90 istatus
, wstatus
, path
, icount
, wcount
,
91 (icount
> 1 || wcount
> 1) ? " INVALID COMBO" : "");
94 *((int *)payload
) += 1;