Merge branch 'rs/cleanup-strbuf-users'
Code clean-up. * rs/cleanup-strbuf-users: graph: use strbuf_addchars() to add spaces use strbuf_addstr() for adding strings to strbufs path: use strbuf_add_real_path()
This commit is contained in:
commit
e46ebc2754
@ -353,7 +353,7 @@ static char *build_format(struct ref_filter *filter, int maxwidth, const char *r
|
|||||||
strbuf_addf(&obname, "%%(objectname:short=%d)", filter->abbrev);
|
strbuf_addf(&obname, "%%(objectname:short=%d)", filter->abbrev);
|
||||||
|
|
||||||
strbuf_addf(&local, "%%(align:%d,left)%%(refname:lstrip=2)%%(end)", maxwidth);
|
strbuf_addf(&local, "%%(align:%d,left)%%(refname:lstrip=2)%%(end)", maxwidth);
|
||||||
strbuf_addf(&local, "%s", branch_get_color(BRANCH_COLOR_RESET));
|
strbuf_addstr(&local, branch_get_color(BRANCH_COLOR_RESET));
|
||||||
strbuf_addf(&local, " %s ", obname.buf);
|
strbuf_addf(&local, " %s ", obname.buf);
|
||||||
|
|
||||||
if (filter->verbose > 1)
|
if (filter->verbose > 1)
|
||||||
|
10
graph.c
10
graph.c
@ -696,12 +696,8 @@ static void graph_pad_horizontally(struct git_graph *graph, struct strbuf *sb,
|
|||||||
* This way, fields printed to the right of the graph will remain
|
* This way, fields printed to the right of the graph will remain
|
||||||
* aligned for the entire commit.
|
* aligned for the entire commit.
|
||||||
*/
|
*/
|
||||||
int extra;
|
if (chars_written < graph->width)
|
||||||
if (chars_written >= graph->width)
|
strbuf_addchars(sb, ' ', graph->width - chars_written);
|
||||||
return;
|
|
||||||
|
|
||||||
extra = graph->width - chars_written;
|
|
||||||
strbuf_addf(sb, "%*s", (int) extra, "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void graph_output_padding_line(struct git_graph *graph,
|
static void graph_output_padding_line(struct git_graph *graph,
|
||||||
@ -787,7 +783,7 @@ static void graph_output_pre_commit_line(struct git_graph *graph,
|
|||||||
if (col->commit == graph->commit) {
|
if (col->commit == graph->commit) {
|
||||||
seen_this = 1;
|
seen_this = 1;
|
||||||
strbuf_write_column(sb, col, '|');
|
strbuf_write_column(sb, col, '|');
|
||||||
strbuf_addf(sb, "%*s", graph->expansion_row, "");
|
strbuf_addchars(sb, ' ', graph->expansion_row);
|
||||||
chars_written += 1 + graph->expansion_row;
|
chars_written += 1 + graph->expansion_row;
|
||||||
} else if (seen_this && (graph->expansion_row == 0)) {
|
} else if (seen_this && (graph->expansion_row == 0)) {
|
||||||
/*
|
/*
|
||||||
|
2
path.c
2
path.c
@ -718,7 +718,7 @@ char *expand_user_path(const char *path, int real_home)
|
|||||||
if (!home)
|
if (!home)
|
||||||
goto return_null;
|
goto return_null;
|
||||||
if (real_home)
|
if (real_home)
|
||||||
strbuf_addstr(&user_path, real_path(home));
|
strbuf_add_real_path(&user_path, home);
|
||||||
else
|
else
|
||||||
strbuf_addstr(&user_path, home);
|
strbuf_addstr(&user_path, home);
|
||||||
#ifdef GIT_WINDOWS_NATIVE
|
#ifdef GIT_WINDOWS_NATIVE
|
||||||
|
@ -1233,8 +1233,8 @@ static int write_with_updates(struct packed_ref_store *refs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ok != ITER_DONE) {
|
if (ok != ITER_DONE) {
|
||||||
strbuf_addf(err, "unable to write packed-refs file: "
|
strbuf_addstr(err, "unable to write packed-refs file: "
|
||||||
"error iterating over old contents");
|
"error iterating over old contents");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ int sequencer_remove_state(struct replay_opts *opts)
|
|||||||
free(opts->xopts[i]);
|
free(opts->xopts[i]);
|
||||||
free(opts->xopts);
|
free(opts->xopts);
|
||||||
|
|
||||||
strbuf_addf(&dir, "%s", get_dir(opts));
|
strbuf_addstr(&dir, get_dir(opts));
|
||||||
remove_dir_recursively(&dir, 0);
|
remove_dir_recursively(&dir, 0);
|
||||||
strbuf_release(&dir);
|
strbuf_release(&dir);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user