Skip to content

Commit 159597f

Browse files
committed
Merge branch 'ab/die-with-bug'
Code clean-up. * ab/die-with-bug: object.c: use BUG(...) no die("BUG: ...") in lookup_object_by_type() pathspec: use BUG(...) not die("BUG:%s:%d....", <file>, <line>) strbuf.h: use BUG(...) not die("BUG: ...") pack-objects: use BUG(...) not die("BUG: ...")
2 parents b174a3c + eafd6e7 commit 159597f

File tree

5 files changed

+5
-7
lines changed

5 files changed

+5
-7
lines changed

builtin/pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3397,7 +3397,7 @@ static void read_object_list_from_stdin(void)
33973397
if (feof(stdin))
33983398
break;
33993399
if (!ferror(stdin))
3400-
die("BUG: fgets returned NULL, not EOF, not error!");
3400+
BUG("fgets returned NULL, not EOF, not error!");
34013401
if (errno != EINTR)
34023402
die_errno("fgets");
34033403
clearerr(stdin);

object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ struct object *lookup_object_by_type(struct repository *r,
199199
case OBJ_BLOB:
200200
return (struct object *)lookup_blob(r, oid);
201201
default:
202-
die("BUG: unknown object type %d", type);
202+
BUG("unknown object type %d", type);
203203
}
204204
}
205205

pathspec.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ struct pathspec {
5858
#define GUARD_PATHSPEC(ps, mask) \
5959
do { \
6060
if ((ps)->magic & ~(mask)) \
61-
die("BUG:%s:%d: unsupported magic %x", \
62-
__FILE__, __LINE__, (ps)->magic & ~(mask)); \
61+
BUG("unsupported magic %x", (ps)->magic & ~(mask)); \
6362
} while (0)
6463

6564
/* parse_pathspec flags */

strbuf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void strbuf_grow(struct strbuf *sb, size_t amount);
160160
static inline void strbuf_setlen(struct strbuf *sb, size_t len)
161161
{
162162
if (len > (sb->alloc ? sb->alloc - 1 : 0))
163-
die("BUG: strbuf_setlen() beyond buffer");
163+
BUG("strbuf_setlen() beyond buffer");
164164
sb->len = len;
165165
if (sb->buf != strbuf_slopbuf)
166166
sb->buf[len] = '\0';

tree-diff.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,7 @@ static void try_to_follow_renames(const struct object_id *old_oid,
603603
* about dry-run mode and returns wildcard info.
604604
*/
605605
if (opt->pathspec.has_wildcard)
606-
die("BUG:%s:%d: wildcards are not supported",
607-
__FILE__, __LINE__);
606+
BUG("wildcards are not supported");
608607
#endif
609608

610609
/* Remove the file creation entry from the diff queue, and remember it */

0 commit comments

Comments
 (0)