Skip to content

Commit 4bd4e73

Browse files
peffgitster
authored andcommitted
refresh_index: rename format variables
When refreshing the index, for modified (or unmerged) files we will print "needs update" (or "needs merge") for plumbing, or line similar to the output from "diff --name-status" for porcelain. The variables holding which type of message to show are named after the plumbing messages. However, as we begin to differentiate more cases at the porcelain level (with the plumbing message staying the same), that naming scheme will become awkward. Instead, name the variables after which case we found (modified or unmerged), not what we will output. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d05e697 commit 4bd4e73

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

read-cache.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,11 +1105,11 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
11051105
int first = 1;
11061106
int in_porcelain = (flags & REFRESH_IN_PORCELAIN);
11071107
unsigned int options = really ? CE_MATCH_IGNORE_VALID : 0;
1108-
const char *needs_update_fmt;
1109-
const char *needs_merge_fmt;
1108+
const char *modified_fmt;
1109+
const char *unmerged_fmt;
11101110

1111-
needs_update_fmt = (in_porcelain ? "M\t%s\n" : "%s: needs update\n");
1112-
needs_merge_fmt = (in_porcelain ? "U\t%s\n" : "%s: needs merge\n");
1111+
modified_fmt = (in_porcelain ? "M\t%s\n" : "%s: needs update\n");
1112+
unmerged_fmt = (in_porcelain ? "U\t%s\n" : "%s: needs merge\n");
11131113
for (i = 0; i < istate->cache_nr; i++) {
11141114
struct cache_entry *ce, *new;
11151115
int cache_errno = 0;
@@ -1125,7 +1125,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
11251125
i--;
11261126
if (allow_unmerged)
11271127
continue;
1128-
show_file(needs_merge_fmt, ce->name, in_porcelain, &first, header_msg);
1128+
show_file(unmerged_fmt, ce->name, in_porcelain, &first, header_msg);
11291129
has_errors = 1;
11301130
continue;
11311131
}
@@ -1148,7 +1148,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
11481148
}
11491149
if (quiet)
11501150
continue;
1151-
show_file(needs_update_fmt, ce->name, in_porcelain, &first, header_msg);
1151+
show_file(modified_fmt, ce->name, in_porcelain, &first, header_msg);
11521152
has_errors = 1;
11531153
continue;
11541154
}

0 commit comments

Comments
 (0)