Skip to content

Commit 328455f

Browse files
committed
Merge branch 'maint'
* maint: diff.c: diff.renamelimit => diff.renameLimit in message wt-status: fix possible use of uninitialized variable fast-import: clarify "inline" logic in file_change_m run-command: always set failed_errno in start_command transport: drop "int cmp = cmp" hack drop some obsolete "x = x" compiler warning hacks fast-import: use pointer-to-pointer to keep list tail
2 parents 28ed8d7 + c9fc441 commit 328455f

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

builtin/cat-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
193193
unsigned char sha1[20];
194194
enum object_type type = 0;
195195
unsigned long size;
196-
void *contents = contents;
196+
void *contents;
197197

198198
if (!obj_name)
199199
return 1;

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4662,7 +4662,7 @@ int diff_result_code(struct diff_options *opt, int status)
46624662
{
46634663
int result = 0;
46644664

4665-
diff_warn_rename_limit("diff.renamelimit",
4665+
diff_warn_rename_limit("diff.renameLimit",
46664666
opt->needed_rename_limit,
46674667
opt->degraded_cc_to_c);
46684668
if (!DIFF_OPT_TST(opt, EXIT_WITH_STATUS) &&

fast-import.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,7 +2265,7 @@ static void file_change_m(struct branch *b)
22652265
const char *p = command_buf.buf + 2;
22662266
static struct strbuf uq = STRBUF_INIT;
22672267
const char *endp;
2268-
struct object_entry *oe = oe;
2268+
struct object_entry *oe;
22692269
unsigned char sha1[20];
22702270
uint16_t mode, inline_data = 0;
22712271

@@ -2292,6 +2292,7 @@ static void file_change_m(struct branch *b)
22922292
hashcpy(sha1, oe->idx.sha1);
22932293
} else if (!prefixcmp(p, "inline ")) {
22942294
inline_data = 1;
2295+
oe = NULL; /* not used with inline_data, but makes gcc happy */
22952296
p += strlen("inline"); /* advance to space */
22962297
} else {
22972298
if (get_sha1_hex(p, sha1))
@@ -2434,7 +2435,7 @@ static void note_change_n(struct branch *b, unsigned char *old_fanout)
24342435
{
24352436
const char *p = command_buf.buf + 2;
24362437
static struct strbuf uq = STRBUF_INIT;
2437-
struct object_entry *oe = oe;
2438+
struct object_entry *oe;
24382439
struct branch *s;
24392440
unsigned char sha1[20], commit_sha1[20];
24402441
char path[60];
@@ -2613,7 +2614,7 @@ static int parse_from(struct branch *b)
26132614

26142615
static struct hash_list *parse_merge(unsigned int *count)
26152616
{
2616-
struct hash_list *list = NULL, *n, *e = e;
2617+
struct hash_list *list = NULL, **tail = &list, *n;
26172618
const char *from;
26182619
struct branch *s;
26192620

@@ -2641,11 +2642,9 @@ static struct hash_list *parse_merge(unsigned int *count)
26412642
die("Invalid ref name or SHA1 expression: %s", from);
26422643

26432644
n->next = NULL;
2644-
if (list)
2645-
e->next = n;
2646-
else
2647-
list = n;
2648-
e = n;
2645+
*tail = n;
2646+
tail = &n->next;
2647+
26492648
(*count)++;
26502649
read_next_command();
26512650
}

run-command.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ int start_command(struct child_process *cmd)
273273
{
274274
int need_in, need_out, need_err;
275275
int fdin[2], fdout[2], fderr[2];
276-
int failed_errno = failed_errno;
276+
int failed_errno;
277277
char *str;
278278

279279
/*
@@ -341,6 +341,7 @@ int start_command(struct child_process *cmd)
341341
notify_pipe[0] = notify_pipe[1] = -1;
342342

343343
cmd->pid = fork();
344+
failed_errno = errno;
344345
if (!cmd->pid) {
345346
/*
346347
* Redirect the channel to write syscall error messages to
@@ -420,7 +421,7 @@ int start_command(struct child_process *cmd)
420421
}
421422
if (cmd->pid < 0)
422423
error("cannot fork() for %s: %s", cmd->argv[0],
423-
strerror(failed_errno = errno));
424+
strerror(errno));
424425
else if (cmd->clean_on_exit)
425426
mark_child_for_cleanup(cmd->pid);
426427

transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
106106
return;
107107

108108
for (;;) {
109-
int cmp = cmp, len;
109+
int cmp, len;
110110

111111
if (!fgets(buffer, sizeof(buffer), f)) {
112112
fclose(f);

wt-status.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static void wt_status_print_change_data(struct wt_status *s,
264264
{
265265
struct wt_status_change_data *d = it->util;
266266
const char *c = color(change_type, s);
267-
int status = status;
267+
int status;
268268
char *one_name;
269269
char *two_name;
270270
const char *one, *two;
@@ -292,6 +292,9 @@ static void wt_status_print_change_data(struct wt_status *s,
292292
}
293293
status = d->worktree_status;
294294
break;
295+
default:
296+
die("BUG: unhandled change_type %d in wt_status_print_change_data",
297+
change_type);
295298
}
296299

297300
one = quote_path(one_name, -1, &onebuf, s->prefix);

0 commit comments

Comments
 (0)