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: ...")
This commit is contained in:
commit
159597f5a3
@ -3397,7 +3397,7 @@ static void read_object_list_from_stdin(void)
|
|||||||
if (feof(stdin))
|
if (feof(stdin))
|
||||||
break;
|
break;
|
||||||
if (!ferror(stdin))
|
if (!ferror(stdin))
|
||||||
die("BUG: fgets returned NULL, not EOF, not error!");
|
BUG("fgets returned NULL, not EOF, not error!");
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
die_errno("fgets");
|
die_errno("fgets");
|
||||||
clearerr(stdin);
|
clearerr(stdin);
|
||||||
|
2
object.c
2
object.c
@ -199,7 +199,7 @@ struct object *lookup_object_by_type(struct repository *r,
|
|||||||
case OBJ_BLOB:
|
case OBJ_BLOB:
|
||||||
return (struct object *)lookup_blob(r, oid);
|
return (struct object *)lookup_blob(r, oid);
|
||||||
default:
|
default:
|
||||||
die("BUG: unknown object type %d", type);
|
BUG("unknown object type %d", type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +58,7 @@ struct pathspec {
|
|||||||
#define GUARD_PATHSPEC(ps, mask) \
|
#define GUARD_PATHSPEC(ps, mask) \
|
||||||
do { \
|
do { \
|
||||||
if ((ps)->magic & ~(mask)) \
|
if ((ps)->magic & ~(mask)) \
|
||||||
die("BUG:%s:%d: unsupported magic %x", \
|
BUG("unsupported magic %x", (ps)->magic & ~(mask)); \
|
||||||
__FILE__, __LINE__, (ps)->magic & ~(mask)); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* parse_pathspec flags */
|
/* parse_pathspec flags */
|
||||||
|
2
strbuf.h
2
strbuf.h
@ -160,7 +160,7 @@ void strbuf_grow(struct strbuf *sb, size_t amount);
|
|||||||
static inline void strbuf_setlen(struct strbuf *sb, size_t len)
|
static inline void strbuf_setlen(struct strbuf *sb, size_t len)
|
||||||
{
|
{
|
||||||
if (len > (sb->alloc ? sb->alloc - 1 : 0))
|
if (len > (sb->alloc ? sb->alloc - 1 : 0))
|
||||||
die("BUG: strbuf_setlen() beyond buffer");
|
BUG("strbuf_setlen() beyond buffer");
|
||||||
sb->len = len;
|
sb->len = len;
|
||||||
if (sb->buf != strbuf_slopbuf)
|
if (sb->buf != strbuf_slopbuf)
|
||||||
sb->buf[len] = '\0';
|
sb->buf[len] = '\0';
|
||||||
|
@ -603,8 +603,7 @@ static void try_to_follow_renames(const struct object_id *old_oid,
|
|||||||
* about dry-run mode and returns wildcard info.
|
* about dry-run mode and returns wildcard info.
|
||||||
*/
|
*/
|
||||||
if (opt->pathspec.has_wildcard)
|
if (opt->pathspec.has_wildcard)
|
||||||
die("BUG:%s:%d: wildcards are not supported",
|
BUG("wildcards are not supported");
|
||||||
__FILE__, __LINE__);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Remove the file creation entry from the diff queue, and remember it */
|
/* Remove the file creation entry from the diff queue, and remember it */
|
||||||
|
Loading…
Reference in New Issue
Block a user