{"thread":{"id":"27185","subject":"[PATCH v2] wt-status.c: Increase code readability.","startedAt":"2011-04-26T11:26:38Z","lastAt":"2011-04-26T17:13:20Z","messageCount":2,"participants":["Henrik Hautakoski","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"166370","messageId":"1303817198-23347-1-git-send-email-henrik@fiktivkod.org","threadId":"27185","inReplyTo":null,"subject":"[PATCH v2] wt-status.c: Increase code readability.","fromName":"Henrik Hautakoski","fromEmail":"henrik@fiktivkod.org","sentAt":"2011-04-26T11:26:38Z","receivedAt":"2011-04-26T11:26:38Z","isPatch":true,"sender":{"key":"henrik@fiktivkod.org","avatar":"https://gravatar.com/avatar/d3cf481b598eb5a1163ac71224be2a8dc8409f25b23a018432d3bfff6b4bcb27?d=mp&s=160"},"body":"Some if/else statements has braces on only some branches. Be consistent and make\nall branches have braces.\n\nSigned-off-by: Henrik Hautakoski <henrik@fiktivkod.org>\n---\n wt-status.c |   26 ++++++++++++++------------\n 1 files changed, 14 insertions(+), 12 deletions(-)\n\ndiff --git a/wt-status.c b/wt-status.c\nindex 9f4e0ba..722987b 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -448,9 +448,9 @@ static void wt_status_collect_changes_initial(struct wt_status *s)\n \t\tif (ce_stage(ce)) {\n \t\t\td->index_status = DIFF_STATUS_UNMERGED;\n \t\t\td->stagemask |= (1 << (ce_stage(ce) - 1));\n-\t\t}\n-\t\telse\n+\t\t} else {\n \t\t\td->index_status = DIFF_STATUS_ADDED;\n+\t\t}\n \t}\n \tfree_pathspec(&pathspec);\n }\n@@ -745,35 +745,37 @@ void wt_status_print(struct wt_status *s)\n \t\twt_status_print_other(s, &s->untracked, _(\"Untracked\"), \"add\");\n \t\tif (s->show_ignored_files)\n \t\t\twt_status_print_other(s, &s->ignored, _(\"Ignored\"), \"add -f\");\n-\t} else if (s->commitable)\n+\t} else if (s->commitable) {\n \t\tstatus_printf_ln(s, GIT_COLOR_NORMAL, _(\"Untracked files not listed%s\"),\n \t\t\tadvice_status_hints\n \t\t\t? _(\" (use -u option to show untracked files)\") : \"\");\n+\t}\n \n \tif (s->verbose)\n \t\twt_status_print_verbose(s);\n \tif (!s->commitable) {\n-\t\tif (s->amend)\n+\t\tif (s->amend) {\n \t\t\tstatus_printf_ln(s, GIT_COLOR_NORMAL, _(\"No changes\"));\n-\t\telse if (s->nowarn)\n+\t\t} else if (s->nowarn) {\n \t\t\t; /* nothing */\n-\t\telse if (s->workdir_dirty)\n+\t\t} else if (s->workdir_dirty) {\n \t\t\tprintf(_(\"no changes added to commit%s\\n\"),\n \t\t\t\tadvice_status_hints\n \t\t\t\t? _(\" (use \\\"git add\\\" and/or \\\"git commit -a\\\")\") : \"\");\n-\t\telse if (s->untracked.nr)\n+\t\t} else if (s->untracked.nr) {\n \t\t\tprintf(_(\"nothing added to commit but untracked files present%s\\n\"),\n \t\t\t\tadvice_status_hints\n \t\t\t\t? _(\" (use \\\"git add\\\" to track)\") : \"\");\n-\t\telse if (s->is_initial)\n+\t\t} else if (s->is_initial) {\n \t\t\tprintf(_(\"nothing to commit%s\\n\"), advice_status_hints\n \t\t\t\t? _(\" (create/copy files and use \\\"git add\\\" to track)\") : \"\");\n-\t\telse if (!s->show_untracked_files)\n+\t\t} else if (!s->show_untracked_files) {\n \t\t\tprintf(_(\"nothing to commit%s\\n\"), advice_status_hints\n \t\t\t\t? _(\" (use -u to show untracked files)\") : \"\");\n-\t\telse\n+\t\t} else {\n \t\t\tprintf(_(\"nothing to commit%s\\n\"), advice_status_hints\n \t\t\t\t? _(\" (working directory clean)\") : \"\");\n+\t\t}\n \t}\n }\n \n@@ -878,9 +880,9 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)\n \t\treturn;\n \tbranch_name = s->branch;\n \n-\tif (!prefixcmp(branch_name, \"refs/heads/\"))\n+\tif (!prefixcmp(branch_name, \"refs/heads/\")) {\n \t\tbranch_name += 11;\n-\telse if (!strcmp(branch_name, \"HEAD\")) {\n+\t} else if (!strcmp(branch_name, \"HEAD\")) {\n \t\tbranch_name = _(\"HEAD (no branch)\");\n \t\tbranch_color_local = color(WT_STATUS_NOBRANCH, s);\n \t}\n-- \n1.7.3.4\n"},{"id":"166395","messageId":"7vei4pey1b.fsf@alter.siamese.dyndns.org","threadId":"27185","inReplyTo":"1303817198-23347-1-git-send-email-henrik@fiktivkod.org","subject":"Re: [PATCH v2] wt-status.c: Increase code readability.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-26T17:13:20Z","receivedAt":"2011-04-26T17:13:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Henrik Hautakoski <henrik@fiktivkod.org> writes:\n\n> Some if/else statements has braces on only some branches. Be consistent and make\n> all branches have braces.\n>\n> Signed-off-by: Henrik Hautakoski <henrik@fiktivkod.org>\n\nWhile I agree that this patch makes things consistent, and consistency may\nbe good, but \"readable\" is more subjective.\n\nPerhaps retitle it to \"Subject: wt-status.c: style fixes\"?  That would be\nmore consistent (no pun intended) with the body of the message.\n\nPlease hold onto this patch, and make it the first one in the series of\nwhatever you are planning to do to wt-status.c that you mentioned.\n"}]}