зеркало из https://github.com/microsoft/git.git
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:
Коммит
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(&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);
|
||||
|
||||
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
|
||||
* aligned for the entire commit.
|
||||
*/
|
||||
int extra;
|
||||
if (chars_written >= graph->width)
|
||||
return;
|
||||
|
||||
extra = graph->width - chars_written;
|
||||
strbuf_addf(sb, "%*s", (int) extra, "");
|
||||
if (chars_written < graph->width)
|
||||
strbuf_addchars(sb, ' ', graph->width - chars_written);
|
||||
}
|
||||
|
||||
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) {
|
||||
seen_this = 1;
|
||||
strbuf_write_column(sb, col, '|');
|
||||
strbuf_addf(sb, "%*s", graph->expansion_row, "");
|
||||
strbuf_addchars(sb, ' ', graph->expansion_row);
|
||||
chars_written += 1 + graph->expansion_row;
|
||||
} 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)
|
||||
goto return_null;
|
||||
if (real_home)
|
||||
strbuf_addstr(&user_path, real_path(home));
|
||||
strbuf_add_real_path(&user_path, home);
|
||||
else
|
||||
strbuf_addstr(&user_path, home);
|
||||
#ifdef GIT_WINDOWS_NATIVE
|
||||
|
|
|
@ -1233,8 +1233,8 @@ static int write_with_updates(struct packed_ref_store *refs,
|
|||
}
|
||||
|
||||
if (ok != ITER_DONE) {
|
||||
strbuf_addf(err, "unable to write packed-refs file: "
|
||||
"error iterating over old contents");
|
||||
strbuf_addstr(err, "unable to write packed-refs file: "
|
||||
"error iterating over old contents");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ int sequencer_remove_state(struct replay_opts *opts)
|
|||
free(opts->xopts[i]);
|
||||
free(opts->xopts);
|
||||
|
||||
strbuf_addf(&dir, "%s", get_dir(opts));
|
||||
strbuf_addstr(&dir, get_dir(opts));
|
||||
remove_dir_recursively(&dir, 0);
|
||||
strbuf_release(&dir);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче