remote.c: turn some error() or die() to BUG()
The first error, "internal error", is clearly a BUG(). The second two are meant to catch calls with invalid parameters and should never happen outside the test suite. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Nov 10, 2018 at 06:16 UTC
92ca868068a9559bf1c02f2e7b9dd443fdb4f39f
1 file changed
+3
-3
remote.c
+3
-3
@@ -620,7 +620,7 @@ static void handle_duplicate(struct ref *ref1, struct ref *ref2)
620
* FETCH_HEAD_IGNORE entries always appear at
621
* the end of the list.
622
*/
623
- die(_("Internal error"));
623
+ BUG("Internal error");
624
}
625
}
626
free(ref2->peer_ref);
@@ -707,7 +707,7 @@ static void query_refspecs_multiple(struct refspec *rs,
707
int find_src = !query->src;
708
709
if (find_src && !query->dst)
710
- error("query_refspecs_multiple: need either src or dst");
710
+ BUG("query_refspecs_multiple: need either src or dst");
711
712
for (i = 0; i < rs->nr; i++) {
713
struct refspec_item *refspec = &rs->items[i];
@@ -735,7 +735,7 @@ int query_refspecs(struct refspec *rs, struct refspec_item *query)
735
char **result = find_src ? &query->src : &query->dst;
736
737
if (find_src && !query->dst)
738
- return error("query_refspecs: need either src or dst");
738
+ BUG("query_refspecs: need either src or dst");
739
740
for (i = 0; i < rs->nr; i++) {
741
struct refspec_item *refspec = &rs->items[i];