die("bug"): report bugs consistently
The vast majority of error messages in Git's source code which report a bug use the convention to prefix the message with "BUG:". As part of cleaning up merge-recursive to stop die()ing except in case of detected bugs, let's just make the remainder of the bug reports consistent with the de facto rule. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Jul 26, 2016 at 18:05 UTC
ef1177d18e35c030c37aa533002a11d98361e6b9
9 files changed
+21
-21
builtin/ls-files.c
+2
-1
@@ -118,7 +118,8 @@ static void show_killed_files(struct dir_struct *dir)
118
*/
119
pos = cache_name_pos(ent->name, ent->len);
120
if (0 <= pos)
121
- die("bug in show-killed-files");
121
+ die("BUG: killed-file %.*s not found",
122
+ ent->len, ent->name);
123
pos = -pos - 1;
124
while (pos < active_nr &&
125
ce_stage(active_cache[pos]))
builtin/update-index.c
+1
-1
@@ -1146,7 +1146,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
1146
report(_("Untracked cache enabled for '%s'"), get_git_work_tree());
1147
break;
1148
default:
1149
- die("Bug: bad untracked_cache value: %d", untracked_cache);
1149
+ die("BUG: bad untracked_cache value: %d", untracked_cache);
1150
}
1151
1152
if (active_cache_changed) {
grep.c
+4
-4
@@ -693,10 +693,10 @@ static struct grep_expr *prep_header_patterns(struct grep_opt *opt)
693
694
for (p = opt->header_list; p; p = p->next) {
695
if (p->token != GREP_PATTERN_HEAD)
696
- die("bug: a non-header pattern in grep header list.");
696
+ die("BUG: a non-header pattern in grep header list.");
697
if (p->field < GREP_HEADER_FIELD_MIN ||
698
GREP_HEADER_FIELD_MAX <= p->field)
699
- die("bug: unknown header field %d", p->field);
699
+ die("BUG: unknown header field %d", p->field);
700
compile_regexp(p, opt);
701
}
702
@@ -709,7 +709,7 @@ static struct grep_expr *prep_header_patterns(struct grep_opt *opt)
709
710
h = compile_pattern_atom(&pp);
711
if (!h || pp != p->next)
712
- die("bug: malformed header expr");
712
+ die("BUG: malformed header expr");
713
if (!header_group[p->field]) {
714
header_group[p->field] = h;
715
continue;
@@ -1514,7 +1514,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
1514
case GREP_BINARY_TEXT:
1515
break;
1516
default:
1517
- die("bug: unknown binary handling mode");
1517
+ die("BUG: unknown binary handling mode");
1518
}
1519
}
1520
imap-send.c
+1
-1
@@ -511,7 +511,7 @@ static int nfsnprintf(char *buf, int blen, const char *fmt, ...)
511
512
va_start(va, fmt);
513
if (blen <= 0 || (unsigned)(ret = vsnprintf(buf, blen, fmt, va)) >= (unsigned)blen)
514
- die("Fatal: buffer too small. Please report a bug.");
514
+ die("BUG: buffer too small. Please report a bug.");
515
va_end(va);
516
return ret;
517
}
merge-recursive.c
+7
-8
@@ -268,7 +268,7 @@ struct tree *write_tree_from_memory(struct merge_options *o)
268
fprintf(stderr, "BUG: %d %.*s\n", ce_stage(ce),
269
(int)ce_namelen(ce), ce->name);
270
}
271
- die("Bug in merge-recursive.c");
271
+ die("BUG: unmerged index entries in merge-recursive.c");
272
}
273
274
if (!active_cache_tree)
@@ -966,9 +966,8 @@ static struct merge_file_info merge_file_1(struct merge_options *o,
966
967
if (!oid_eq(&a->oid, &b->oid))
968
result.clean = 0;
969
- } else {
970
- die(_("unsupported object type in the tree"));
971
- }
969
+ } else
970
+ die(_("BUG: unsupported object type in the tree"));
971
}
972
973
return result;
@@ -1354,7 +1353,7 @@ static int process_renames(struct merge_options *o,
1353
const char *ren2_dst = ren2->pair->two->path;
1354
enum rename_type rename_type;
1355
if (strcmp(ren1_src, ren2_src) != 0)
1357
- die("ren1_src != ren2_src");
1356
+ die("BUG: ren1_src != ren2_src");
1357
ren2->dst_entry->processed = 1;
1358
ren2->processed = 1;
1359
if (strcmp(ren1_dst, ren2_dst) != 0) {
@@ -1388,7 +1387,7 @@ static int process_renames(struct merge_options *o,
1387
ren2 = lookup->util;
1388
ren2_dst = ren2->pair->two->path;
1389
if (strcmp(ren1_dst, ren2_dst) != 0)
1391
- die("ren1_dst != ren2_dst");
1390
+ die("BUG: ren1_dst != ren2_dst");
1391
1392
clean_merge = 0;
1393
ren2->processed = 1;
@@ -1812,7 +1811,7 @@ static int process_entry(struct merge_options *o,
1811
*/
1812
remove_file(o, 1, path, !a_mode);
1813
} else
1815
- die(_("Fatal merge failure, shouldn't happen."));
1814
+ die(_("BUG: fatal merge failure, shouldn't happen."));
1815
1816
return clean_merge;
1817
}
@@ -1870,7 +1869,7 @@ int merge_trees(struct merge_options *o,
1869
for (i = 0; i < entries->nr; i++) {
1870
struct stage_data *e = entries->items[i].util;
1871
if (!e->processed)
1873
- die(_("Unprocessed path??? %s"),
1872
+ die(_("BUG: unprocessed path??? %s"),
1873
entries->items[i].string);
1874
}
1875
sha1_file.c
+2
-2
@@ -795,7 +795,7 @@ void close_all_packs(void)
795
796
for (p = packed_git; p; p = p->next)
797
if (p->do_not_close)
798
- die("BUG! Want to close pack marked 'do-not-close'");
798
+ die("BUG: want to close pack marked 'do-not-close'");
799
else
800
close_pack(p);
801
}
@@ -2330,7 +2330,7 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
2330
case OBJ_OFS_DELTA:
2331
case OBJ_REF_DELTA:
2332
if (data)
2333
- die("BUG in unpack_entry: left loop at a valid delta");
2333
+ die("BUG: unpack_entry: left loop at a valid delta");
2334
break;
2335
case OBJ_COMMIT:
2336
case OBJ_TREE:
trailer.c
+1
-1
@@ -562,7 +562,7 @@ static int git_trailer_config(const char *conf_key, const char *value, void *cb)
562
warning(_("unknown value '%s' for key '%s'"), value, conf_key);
563
break;
564
default:
565
- die("internal bug in trailer.c");
565
+ die("BUG: trailer.c: unhandled type %d", type);
566
}
567
return 0;
568
}
transport.c
+1
-1
@@ -566,7 +566,7 @@ void transport_take_over(struct transport *transport,
566
struct git_transport_data *data;
567
568
if (!transport->smart_options)
569
- die("Bug detected: Taking over transport requires non-NULL "
569
+ die("BUG: taking over transport requires non-NULL "
570
"smart_options field.");
571
572
data = xcalloc(1, sizeof(*data));
wt-status.c
+2
-2
@@ -263,7 +263,7 @@ static const char *wt_status_unmerged_status_string(int stagemask)
263
case 7:
264
return _("both modified:");
265
default:
266
- die("bug: unhandled unmerged status %x", stagemask);
266
+ die("BUG: unhandled unmerged status %x", stagemask);
267
}
268
}
269
@@ -388,7 +388,7 @@ static void wt_status_print_change_data(struct wt_status *s,
388
status_printf(s, color(WT_STATUS_HEADER, s), "\t");
389
what = wt_status_diff_status_string(status);
390
if (!what)
391
- die("bug: unhandled diff status %c", status);
391
+ die("BUG: unhandled diff status %c", status);
392
len = label_width - utf8_strwidth(what);
393
assert(len >= 0);
394
if (status == DIFF_STATUS_COPIED || status == DIFF_STATUS_RENAMED)