Skip to content

Commit 311bf13

Browse files
committed
Merge branch 'ab/rev-info-init'
Progress on being able to initialize a rev_info struct with a macro. * ab/rev-info-init: revisions API: extend the nascent REV_INFO_INIT macro
2 parents d0c3853 + 916ebb3 commit 311bf13

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

revision.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,30 +1865,15 @@ void repo_init_revisions(struct repository *r,
18651865
struct rev_info *revs,
18661866
const char *prefix)
18671867
{
1868-
memset(revs, 0, sizeof(*revs));
1868+
struct rev_info blank = REV_INFO_INIT;
1869+
memcpy(revs, &blank, sizeof(*revs));
18691870

18701871
revs->repo = r;
1871-
revs->abbrev = DEFAULT_ABBREV;
1872-
revs->simplify_history = 1;
18731872
revs->pruning.repo = r;
1874-
revs->pruning.flags.recursive = 1;
1875-
revs->pruning.flags.quick = 1;
18761873
revs->pruning.add_remove = file_add_remove;
18771874
revs->pruning.change = file_change;
18781875
revs->pruning.change_fn_data = revs;
1879-
revs->sort_order = REV_SORT_IN_GRAPH_ORDER;
1880-
revs->dense = 1;
18811876
revs->prefix = prefix;
1882-
revs->max_age = -1;
1883-
revs->max_age_as_filter = -1;
1884-
revs->min_age = -1;
1885-
revs->skip_count = -1;
1886-
revs->max_count = -1;
1887-
revs->max_parents = -1;
1888-
revs->expand_tabs_in_log = -1;
1889-
1890-
revs->commit_format = CMIT_FMT_DEFAULT;
1891-
revs->expand_tabs_in_log_default = 8;
18921877

18931878
grep_init(&revs->grep_filter, revs->repo);
18941879
revs->grep_filter.status_only = 1;

revision.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,23 @@ struct rev_info {
357357
* called before release_revisions() the "struct rev_info" can be left
358358
* uninitialized.
359359
*/
360-
#define REV_INFO_INIT { 0 }
360+
#define REV_INFO_INIT { \
361+
.abbrev = DEFAULT_ABBREV, \
362+
.simplify_history = 1, \
363+
.pruning.flags.recursive = 1, \
364+
.pruning.flags.quick = 1, \
365+
.sort_order = REV_SORT_IN_GRAPH_ORDER, \
366+
.dense = 1, \
367+
.max_age = -1, \
368+
.max_age_as_filter = -1, \
369+
.min_age = -1, \
370+
.skip_count = -1, \
371+
.max_count = -1, \
372+
.max_parents = -1, \
373+
.expand_tabs_in_log = -1, \
374+
.commit_format = CMIT_FMT_DEFAULT, \
375+
.expand_tabs_in_log_default = 8, \
376+
}
361377

362378
/**
363379
* Initialize a rev_info structure with default values. The third parameter may

0 commit comments

Comments
 (0)