Skip to content
/ git Public
forked from git/git

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
gitster committed Mar 21, 2013
2 parents 28ed8d7 + c9fc441 commit 328455f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion builtin/cat-file.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
unsigned char sha1[20]; unsigned char sha1[20];
enum object_type type = 0; enum object_type type = 0;
unsigned long size; unsigned long size;
void *contents = contents; void *contents;


if (!obj_name) if (!obj_name)
return 1; return 1;
Expand Down
2 changes: 1 addition & 1 deletion diff.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4662,7 +4662,7 @@ int diff_result_code(struct diff_options *opt, int status)
{ {
int result = 0; int result = 0;


diff_warn_rename_limit("diff.renamelimit", diff_warn_rename_limit("diff.renameLimit",
opt->needed_rename_limit, opt->needed_rename_limit,
opt->degraded_cc_to_c); opt->degraded_cc_to_c);
if (!DIFF_OPT_TST(opt, EXIT_WITH_STATUS) && if (!DIFF_OPT_TST(opt, EXIT_WITH_STATUS) &&
Expand Down
15 changes: 7 additions & 8 deletions fast-import.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2265,7 +2265,7 @@ static void file_change_m(struct branch *b)
const char *p = command_buf.buf + 2; const char *p = command_buf.buf + 2;
static struct strbuf uq = STRBUF_INIT; static struct strbuf uq = STRBUF_INIT;
const char *endp; const char *endp;
struct object_entry *oe = oe; struct object_entry *oe;
unsigned char sha1[20]; unsigned char sha1[20];
uint16_t mode, inline_data = 0; uint16_t mode, inline_data = 0;


Expand All @@ -2292,6 +2292,7 @@ static void file_change_m(struct branch *b)
hashcpy(sha1, oe->idx.sha1); hashcpy(sha1, oe->idx.sha1);
} else if (!prefixcmp(p, "inline ")) { } else if (!prefixcmp(p, "inline ")) {
inline_data = 1; inline_data = 1;
oe = NULL; /* not used with inline_data, but makes gcc happy */
p += strlen("inline"); /* advance to space */ p += strlen("inline"); /* advance to space */
} else { } else {
if (get_sha1_hex(p, sha1)) if (get_sha1_hex(p, sha1))
Expand Down Expand Up @@ -2434,7 +2435,7 @@ static void note_change_n(struct branch *b, unsigned char *old_fanout)
{ {
const char *p = command_buf.buf + 2; const char *p = command_buf.buf + 2;
static struct strbuf uq = STRBUF_INIT; static struct strbuf uq = STRBUF_INIT;
struct object_entry *oe = oe; struct object_entry *oe;
struct branch *s; struct branch *s;
unsigned char sha1[20], commit_sha1[20]; unsigned char sha1[20], commit_sha1[20];
char path[60]; char path[60];
Expand Down Expand Up @@ -2613,7 +2614,7 @@ static int parse_from(struct branch *b)


static struct hash_list *parse_merge(unsigned int *count) static struct hash_list *parse_merge(unsigned int *count)
{ {
struct hash_list *list = NULL, *n, *e = e; struct hash_list *list = NULL, **tail = &list, *n;
const char *from; const char *from;
struct branch *s; struct branch *s;


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


n->next = NULL; n->next = NULL;
if (list) *tail = n;
e->next = n; tail = &n->next;
else
list = n;
e = n;
(*count)++; (*count)++;
read_next_command(); read_next_command();
} }
Expand Down
5 changes: 3 additions & 2 deletions run-command.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ int start_command(struct child_process *cmd)
{ {
int need_in, need_out, need_err; int need_in, need_out, need_err;
int fdin[2], fdout[2], fderr[2]; int fdin[2], fdout[2], fderr[2];
int failed_errno = failed_errno; int failed_errno;
char *str; char *str;


/* /*
Expand Down Expand Up @@ -341,6 +341,7 @@ int start_command(struct child_process *cmd)
notify_pipe[0] = notify_pipe[1] = -1; notify_pipe[0] = notify_pipe[1] = -1;


cmd->pid = fork(); cmd->pid = fork();
failed_errno = errno;
if (!cmd->pid) { if (!cmd->pid) {
/* /*
* Redirect the channel to write syscall error messages to * Redirect the channel to write syscall error messages to
Expand Down Expand Up @@ -420,7 +421,7 @@ int start_command(struct child_process *cmd)
} }
if (cmd->pid < 0) if (cmd->pid < 0)
error("cannot fork() for %s: %s", cmd->argv[0], error("cannot fork() for %s: %s", cmd->argv[0],
strerror(failed_errno = errno)); strerror(errno));
else if (cmd->clean_on_exit) else if (cmd->clean_on_exit)
mark_child_for_cleanup(cmd->pid); mark_child_for_cleanup(cmd->pid);


Expand Down
2 changes: 1 addition & 1 deletion transport.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
return; return;


for (;;) { for (;;) {
int cmp = cmp, len; int cmp, len;


if (!fgets(buffer, sizeof(buffer), f)) { if (!fgets(buffer, sizeof(buffer), f)) {
fclose(f); fclose(f);
Expand Down
5 changes: 4 additions & 1 deletion wt-status.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ static void wt_status_print_change_data(struct wt_status *s,
{ {
struct wt_status_change_data *d = it->util; struct wt_status_change_data *d = it->util;
const char *c = color(change_type, s); const char *c = color(change_type, s);
int status = status; int status;
char *one_name; char *one_name;
char *two_name; char *two_name;
const char *one, *two; const char *one, *two;
Expand Down Expand Up @@ -292,6 +292,9 @@ static void wt_status_print_change_data(struct wt_status *s,
} }
status = d->worktree_status; status = d->worktree_status;
break; break;
default:
die("BUG: unhandled change_type %d in wt_status_print_change_data",
change_type);
} }


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

0 comments on commit 328455f

Please sign in to comment.