@@ -1157,7 +1157,6 @@ static void show_push_unqualified_ref_name_error(const char *dst_value,
1157
1157
const char * matched_src_name )
1158
1158
{
1159
1159
struct object_id oid ;
1160
- enum object_type type ;
1161
1160
1162
1161
/*
1163
1162
* TRANSLATORS: "matches '%s'%" is the <dst> part of "git push
@@ -1182,31 +1181,37 @@ static void show_push_unqualified_ref_name_error(const char *dst_value,
1182
1181
BUG ("'%s' is not a valid object, "
1183
1182
"match_explicit_lhs() should catch this!" ,
1184
1183
matched_src_name );
1185
- type = oid_object_info (the_repository , & oid , NULL );
1186
- if (type == OBJ_COMMIT ) {
1184
+
1185
+ switch (oid_object_info (the_repository , & oid , NULL )) {
1186
+ case OBJ_COMMIT :
1187
1187
advise (_ ("The <src> part of the refspec is a commit object.\n"
1188
1188
"Did you mean to create a new branch by pushing to\n"
1189
1189
"'%s:refs/heads/%s'?" ),
1190
1190
matched_src_name , dst_value );
1191
- } else if (type == OBJ_TAG ) {
1191
+ break ;
1192
+ case OBJ_TAG :
1192
1193
advise (_ ("The <src> part of the refspec is a tag object.\n"
1193
1194
"Did you mean to create a new tag by pushing to\n"
1194
1195
"'%s:refs/tags/%s'?" ),
1195
1196
matched_src_name , dst_value );
1196
- } else if (type == OBJ_TREE ) {
1197
+ break ;
1198
+ case OBJ_TREE :
1197
1199
advise (_ ("The <src> part of the refspec is a tree object.\n"
1198
1200
"Did you mean to tag a new tree by pushing to\n"
1199
1201
"'%s:refs/tags/%s'?" ),
1200
1202
matched_src_name , dst_value );
1201
- } else if (type == OBJ_BLOB ) {
1203
+ break ;
1204
+ case OBJ_BLOB :
1202
1205
advise (_ ("The <src> part of the refspec is a blob object.\n"
1203
1206
"Did you mean to tag a new blob by pushing to\n"
1204
1207
"'%s:refs/tags/%s'?" ),
1205
1208
matched_src_name , dst_value );
1206
- } else {
1209
+ break ;
1210
+ default :
1207
1211
advise (_ ("The <src> part of the refspec ('%s') "
1208
1212
"is an object ID that doesn't exist.\n" ),
1209
1213
matched_src_name );
1214
+ break ;
1210
1215
}
1211
1216
}
1212
1217
0 commit comments