mirror of https://github.com/git/git.git
Merge branch 'nd/the-index'
Various codepaths in the core-ish part learn to work on an arbitrary in-core index structure, not necessarily the default instance "the_index". * nd/the-index: (23 commits) revision.c: reduce implicit dependency the_repository revision.c: remove implicit dependency on the_index ws.c: remove implicit dependency on the_index tree-diff.c: remove implicit dependency on the_index submodule.c: remove implicit dependency on the_index line-range.c: remove implicit dependency on the_index userdiff.c: remove implicit dependency on the_index rerere.c: remove implicit dependency on the_index sha1-file.c: remove implicit dependency on the_index patch-ids.c: remove implicit dependency on the_index merge.c: remove implicit dependency on the_index merge-blobs.c: remove implicit dependency on the_index ll-merge.c: remove implicit dependency on the_index diff-lib.c: remove implicit dependency on the_index read-cache.c: remove implicit dependency on the_index diff.c: remove implicit dependency on the_index grep.c: remove implicit dependency on the_index diff.c: remove the_index dependency in textconv() functions blame.c: rename "repo" argument to "r" combine-diff.c: remove implicit dependency on the_index ...
This commit is contained in:
commit
11877b9ebe
|
@ -18,8 +18,8 @@ Calling sequence
|
|||
----------------
|
||||
|
||||
* Prepare `struct diff_options` to record the set of diff options, and
|
||||
then call `diff_setup()` to initialize this structure. This sets up
|
||||
the vanilla default.
|
||||
then call `repo_diff_setup()` to initialize this structure. This
|
||||
sets up the vanilla default.
|
||||
|
||||
* Fill in the options structure to specify desired output format, rename
|
||||
detection, etc. `diff_opt_parse()` can be used to parse options given
|
||||
|
|
|
@ -15,9 +15,9 @@ revision list.
|
|||
Functions
|
||||
---------
|
||||
|
||||
`init_revisions`::
|
||||
`repo_init_revisions`::
|
||||
|
||||
Initialize a rev_info structure with default values. The second
|
||||
Initialize a rev_info structure with default values. The third
|
||||
parameter may be NULL or can be prefix path, and then the `.prefix`
|
||||
variable will be set to it. This is typically the first function you
|
||||
want to call when you want to deal with a revision list. After calling
|
||||
|
|
19
apply.c
19
apply.c
|
@ -2131,10 +2131,12 @@ static int parse_chunk(struct apply_state *state, char *buffer, unsigned long si
|
|||
|
||||
if (!use_patch(state, patch))
|
||||
patch->ws_rule = 0;
|
||||
else if (patch->new_name)
|
||||
patch->ws_rule = whitespace_rule(state->repo->index,
|
||||
patch->new_name);
|
||||
else
|
||||
patch->ws_rule = whitespace_rule(patch->new_name
|
||||
? patch->new_name
|
||||
: patch->old_name);
|
||||
patch->ws_rule = whitespace_rule(state->repo->index,
|
||||
patch->old_name);
|
||||
|
||||
patchsize = parse_single_patch(state,
|
||||
buffer + offset + hdrsize,
|
||||
|
@ -3467,7 +3469,8 @@ static int load_preimage(struct apply_state *state,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int three_way_merge(struct image *image,
|
||||
static int three_way_merge(struct apply_state *state,
|
||||
struct image *image,
|
||||
char *path,
|
||||
const struct object_id *base,
|
||||
const struct object_id *ours,
|
||||
|
@ -3483,7 +3486,9 @@ static int three_way_merge(struct image *image,
|
|||
status = ll_merge(&result, path,
|
||||
&base_file, "base",
|
||||
&our_file, "ours",
|
||||
&their_file, "theirs", NULL);
|
||||
&their_file, "theirs",
|
||||
state->repo->index,
|
||||
NULL);
|
||||
free(base_file.ptr);
|
||||
free(our_file.ptr);
|
||||
free(their_file.ptr);
|
||||
|
@ -3595,7 +3600,7 @@ static int try_threeway(struct apply_state *state,
|
|||
clear_image(&tmp_image);
|
||||
|
||||
/* in-core three-way merge between post and our using pre as base */
|
||||
status = three_way_merge(image, patch->new_name,
|
||||
status = three_way_merge(state, image, patch->new_name,
|
||||
&pre_oid, &our_oid, &post_oid);
|
||||
if (status < 0) {
|
||||
if (state->apply_verbosity > verbosity_silent)
|
||||
|
@ -4627,7 +4632,7 @@ static int write_out_results(struct apply_state *state, struct patch *list)
|
|||
}
|
||||
string_list_clear(&cpath, 0);
|
||||
|
||||
rerere(0);
|
||||
repo_rerere(state->repo, 0);
|
||||
}
|
||||
|
||||
return errs;
|
||||
|
|
|
@ -264,9 +264,10 @@ static int has_only_ascii(const char *s)
|
|||
}
|
||||
}
|
||||
|
||||
static int entry_is_binary(const char *path, const void *buffer, size_t size)
|
||||
static int entry_is_binary(struct index_state *istate, const char *path,
|
||||
const void *buffer, size_t size)
|
||||
{
|
||||
struct userdiff_driver *driver = userdiff_find_by_path(path);
|
||||
struct userdiff_driver *driver = userdiff_find_by_path(istate, path);
|
||||
if (!driver)
|
||||
driver = userdiff_find_by_name("default");
|
||||
if (driver->binary != -1)
|
||||
|
@ -352,7 +353,8 @@ static int write_zip_entry(struct archiver_args *args,
|
|||
return error(_("cannot read %s"),
|
||||
oid_to_hex(oid));
|
||||
crc = crc32(crc, buffer, size);
|
||||
is_binary = entry_is_binary(path_without_prefix,
|
||||
is_binary = entry_is_binary(args->repo->index,
|
||||
path_without_prefix,
|
||||
buffer, size);
|
||||
out = buffer;
|
||||
}
|
||||
|
@ -428,7 +430,8 @@ static int write_zip_entry(struct archiver_args *args,
|
|||
break;
|
||||
crc = crc32(crc, buf, readlen);
|
||||
if (is_binary == -1)
|
||||
is_binary = entry_is_binary(path_without_prefix,
|
||||
is_binary = entry_is_binary(args->repo->index,
|
||||
path_without_prefix,
|
||||
buf, readlen);
|
||||
write_or_die(1, buf, readlen);
|
||||
}
|
||||
|
@ -460,7 +463,8 @@ static int write_zip_entry(struct archiver_args *args,
|
|||
break;
|
||||
crc = crc32(crc, buf, readlen);
|
||||
if (is_binary == -1)
|
||||
is_binary = entry_is_binary(path_without_prefix,
|
||||
is_binary = entry_is_binary(args->repo->index,
|
||||
path_without_prefix,
|
||||
buf, readlen);
|
||||
|
||||
zstream.next_in = buf;
|
||||
|
|
|
@ -392,7 +392,7 @@ static void parse_treeish_arg(const char **argv,
|
|||
if (get_oid(name, &oid))
|
||||
die("Not a valid object name");
|
||||
|
||||
commit = lookup_commit_reference_gently(the_repository, &oid, 1);
|
||||
commit = lookup_commit_reference_gently(ar_args->repo, &oid, 1);
|
||||
if (commit) {
|
||||
commit_sha1 = commit->object.oid.hash;
|
||||
archive_time = commit->date;
|
||||
|
|
4
bisect.c
4
bisect.c
|
@ -633,7 +633,7 @@ static void bisect_rev_setup(struct rev_info *revs, const char *prefix,
|
|||
struct argv_array rev_argv = ARGV_ARRAY_INIT;
|
||||
int i;
|
||||
|
||||
init_revisions(revs, prefix);
|
||||
repo_init_revisions(the_repository, revs, prefix);
|
||||
revs->abbrev = 0;
|
||||
revs->commit_format = CMIT_FMT_UNSPECIFIED;
|
||||
|
||||
|
@ -890,7 +890,7 @@ static void show_diff_tree(const char *prefix, struct commit *commit)
|
|||
struct rev_info opt;
|
||||
|
||||
/* diff-tree init */
|
||||
init_revisions(&opt, prefix);
|
||||
repo_init_revisions(the_repository, &opt, prefix);
|
||||
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
|
||||
opt.abbrev = 0;
|
||||
opt.diff = 1;
|
||||
|
|
63
blame.c
63
blame.c
|
@ -90,7 +90,7 @@ static struct blame_origin *get_origin(struct commit *commit, const char *path)
|
|||
|
||||
|
||||
|
||||
static void verify_working_tree_path(struct repository *repo,
|
||||
static void verify_working_tree_path(struct repository *r,
|
||||
struct commit *work_tree, const char *path)
|
||||
{
|
||||
struct commit_list *parents;
|
||||
|
@ -102,15 +102,15 @@ static void verify_working_tree_path(struct repository *repo,
|
|||
unsigned mode;
|
||||
|
||||
if (!get_tree_entry(commit_oid, path, &blob_oid, &mode) &&
|
||||
oid_object_info(repo, &blob_oid, NULL) == OBJ_BLOB)
|
||||
oid_object_info(r, &blob_oid, NULL) == OBJ_BLOB)
|
||||
return;
|
||||
}
|
||||
|
||||
pos = index_name_pos(repo->index, path, strlen(path));
|
||||
pos = index_name_pos(r->index, path, strlen(path));
|
||||
if (pos >= 0)
|
||||
; /* path is in the index */
|
||||
else if (-1 - pos < repo->index->cache_nr &&
|
||||
!strcmp(repo->index->cache[-1 - pos]->name, path))
|
||||
else if (-1 - pos < r->index->cache_nr &&
|
||||
!strcmp(r->index->cache[-1 - pos]->name, path))
|
||||
; /* path is in the index, unmerged */
|
||||
else
|
||||
die("no such path '%s' in HEAD", path);
|
||||
|
@ -166,7 +166,7 @@ static void set_commit_buffer_from_strbuf(struct commit *c, struct strbuf *sb)
|
|||
* Prepare a dummy commit that represents the work tree (or staged) item.
|
||||
* Note that annotating work tree item never works in the reverse.
|
||||
*/
|
||||
static struct commit *fake_working_tree_commit(struct repository *repo,
|
||||
static struct commit *fake_working_tree_commit(struct repository *r,
|
||||
struct diff_options *opt,
|
||||
const char *path,
|
||||
const char *contents_from)
|
||||
|
@ -183,7 +183,7 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
|
|||
unsigned mode;
|
||||
struct strbuf msg = STRBUF_INIT;
|
||||
|
||||
read_index(repo->index);
|
||||
read_index(r->index);
|
||||
time(&now);
|
||||
commit = alloc_commit_node(the_repository);
|
||||
commit->object.parsed = 1;
|
||||
|
@ -195,7 +195,7 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
|
|||
|
||||
parent_tail = append_parent(parent_tail, &head_oid);
|
||||
append_merge_parents(parent_tail);
|
||||
verify_working_tree_path(repo, commit, path);
|
||||
verify_working_tree_path(r, commit, path);
|
||||
|
||||
origin = make_origin(commit, path);
|
||||
|
||||
|
@ -234,7 +234,7 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
|
|||
switch (st.st_mode & S_IFMT) {
|
||||
case S_IFREG:
|
||||
if (opt->flags.allow_textconv &&
|
||||
textconv_object(read_from, mode, &null_oid, 0, &buf_ptr, &buf_len))
|
||||
textconv_object(r, read_from, mode, &null_oid, 0, &buf_ptr, &buf_len))
|
||||
strbuf_attach(&buf, buf_ptr, buf_len, buf_len + 1);
|
||||
else if (strbuf_read_file(&buf, read_from, st.st_size) != st.st_size)
|
||||
die_errno("cannot open or read '%s'", read_from);
|
||||
|
@ -253,7 +253,7 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
|
|||
if (strbuf_read(&buf, 0, 0) < 0)
|
||||
die_errno("failed to read from stdin");
|
||||
}
|
||||
convert_to_git(repo->index, path, buf.buf, buf.len, &buf, 0);
|
||||
convert_to_git(r->index, path, buf.buf, buf.len, &buf, 0);
|
||||
origin->file.ptr = buf.buf;
|
||||
origin->file.size = buf.len;
|
||||
pretend_object_file(buf.buf, buf.len, OBJ_BLOB, &origin->blob_oid);
|
||||
|
@ -264,28 +264,28 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
|
|||
* bits; we are not going to write this index out -- we just
|
||||
* want to run "diff-index --cached".
|
||||
*/
|
||||
discard_index(repo->index);
|
||||
read_index(repo->index);
|
||||
discard_index(r->index);
|
||||
read_index(r->index);
|
||||
|
||||
len = strlen(path);
|
||||
if (!mode) {
|
||||
int pos = index_name_pos(repo->index, path, len);
|
||||
int pos = index_name_pos(r->index, path, len);
|
||||
if (0 <= pos)
|
||||
mode = repo->index->cache[pos]->ce_mode;
|
||||
mode = r->index->cache[pos]->ce_mode;
|
||||
else
|
||||
/* Let's not bother reading from HEAD tree */
|
||||
mode = S_IFREG | 0644;
|
||||
}
|
||||
ce = make_empty_cache_entry(repo->index, len);
|
||||
ce = make_empty_cache_entry(r->index, len);
|
||||
oidcpy(&ce->oid, &origin->blob_oid);
|
||||
memcpy(ce->name, path, len);
|
||||
ce->ce_flags = create_ce_flags(0);
|
||||
ce->ce_namelen = len;
|
||||
ce->ce_mode = create_ce_mode(mode);
|
||||
add_index_entry(repo->index, ce,
|
||||
add_index_entry(r->index, ce,
|
||||
ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE);
|
||||
|
||||
cache_tree_invalidate_path(repo->index, path);
|
||||
cache_tree_invalidate_path(r->index, path);
|
||||
|
||||
return commit;
|
||||
}
|
||||
|
@ -318,7 +318,8 @@ static void fill_origin_blob(struct diff_options *opt,
|
|||
|
||||
(*num_read_blob)++;
|
||||
if (opt->flags.allow_textconv &&
|
||||
textconv_object(o->path, o->mode, &o->blob_oid, 1, &file->ptr, &file_size))
|
||||
textconv_object(opt->repo, o->path, o->mode,
|
||||
&o->blob_oid, 1, &file->ptr, &file_size))
|
||||
;
|
||||
else
|
||||
file->ptr = read_object_file(&o->blob_oid, &type,
|
||||
|
@ -520,14 +521,14 @@ static void queue_blames(struct blame_scoreboard *sb, struct blame_origin *porig
|
|||
*
|
||||
* This also fills origin->mode for corresponding tree path.
|
||||
*/
|
||||
static int fill_blob_sha1_and_mode(struct repository *repo,
|
||||
static int fill_blob_sha1_and_mode(struct repository *r,
|
||||
struct blame_origin *origin)
|
||||
{
|
||||
if (!is_null_oid(&origin->blob_oid))
|
||||
return 0;
|
||||
if (get_tree_entry(&origin->commit->object.oid, origin->path, &origin->blob_oid, &origin->mode))
|
||||
goto error_out;
|
||||
if (oid_object_info(repo, &origin->blob_oid, NULL) != OBJ_BLOB)
|
||||
if (oid_object_info(r, &origin->blob_oid, NULL) != OBJ_BLOB)
|
||||
goto error_out;
|
||||
return 0;
|
||||
error_out:
|
||||
|
@ -540,8 +541,9 @@ static int fill_blob_sha1_and_mode(struct repository *repo,
|
|||
* We have an origin -- check if the same path exists in the
|
||||
* parent and return an origin structure to represent it.
|
||||
*/
|
||||
static struct blame_origin *find_origin(struct commit *parent,
|
||||
struct blame_origin *origin)
|
||||
static struct blame_origin *find_origin(struct repository *r,
|
||||
struct commit *parent,
|
||||
struct blame_origin *origin)
|
||||
{
|
||||
struct blame_origin *porigin;
|
||||
struct diff_options diff_opts;
|
||||
|
@ -561,7 +563,7 @@ static struct blame_origin *find_origin(struct commit *parent,
|
|||
* and origin first. Most of the time they are the
|
||||
* same and diff-tree is fairly efficient about this.
|
||||
*/
|
||||
diff_setup(&diff_opts);
|
||||
repo_diff_setup(r, &diff_opts);
|
||||
diff_opts.flags.recursive = 1;
|
||||
diff_opts.detect_rename = 0;
|
||||
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||
|
@ -628,14 +630,15 @@ static struct blame_origin *find_origin(struct commit *parent,
|
|||
* We have an origin -- find the path that corresponds to it in its
|
||||
* parent and return an origin structure to represent it.
|
||||
*/
|
||||
static struct blame_origin *find_rename(struct commit *parent,
|
||||
struct blame_origin *origin)
|
||||
static struct blame_origin *find_rename(struct repository *r,
|
||||
struct commit *parent,
|
||||
struct blame_origin *origin)
|
||||
{
|
||||
struct blame_origin *porigin = NULL;
|
||||
struct diff_options diff_opts;
|
||||
int i;
|
||||
|
||||
diff_setup(&diff_opts);
|
||||
repo_diff_setup(r, &diff_opts);
|
||||
diff_opts.flags.recursive = 1;
|
||||
diff_opts.detect_rename = DIFF_DETECT_RENAME;
|
||||
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||
|
@ -1259,7 +1262,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
|
|||
if (!unblamed)
|
||||
return; /* nothing remains for this target */
|
||||
|
||||
diff_setup(&diff_opts);
|
||||
repo_diff_setup(sb->repo, &diff_opts);
|
||||
diff_opts.flags.recursive = 1;
|
||||
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||
|
||||
|
@ -1441,7 +1444,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
|
|||
* common cases, then we look for renames in the second pass.
|
||||
*/
|
||||
for (pass = 0; pass < 2 - sb->no_whole_file_rename; pass++) {
|
||||
struct blame_origin *(*find)(struct commit *, struct blame_origin *);
|
||||
struct blame_origin *(*find)(struct repository *, struct commit *, struct blame_origin *);
|
||||
find = pass ? find_rename : find_origin;
|
||||
|
||||
for (i = 0, sg = first_scapegoat(revs, commit, sb->reverse);
|
||||
|
@ -1454,7 +1457,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
|
|||
continue;
|
||||
if (parse_commit(p))
|
||||
continue;
|
||||
porigin = find(p, origin);
|
||||
porigin = find(sb->repo, p, origin);
|
||||
if (!porigin)
|
||||
continue;
|
||||
if (oideq(&porigin->blob_oid, &origin->blob_oid)) {
|
||||
|
@ -1857,7 +1860,7 @@ void setup_scoreboard(struct blame_scoreboard *sb,
|
|||
die(_("no such path %s in %s"), path, final_commit_name);
|
||||
|
||||
if (sb->revs->diffopt.flags.allow_textconv &&
|
||||
textconv_object(path, o->mode, &o->blob_oid, 1, (char **) &sb->final_buf,
|
||||
textconv_object(sb->repo, path, o->mode, &o->blob_oid, 1, (char **) &sb->final_buf,
|
||||
&sb->final_buf_size))
|
||||
;
|
||||
else
|
||||
|
|
|
@ -110,7 +110,7 @@ int add_files_to_cache(const char *prefix,
|
|||
memset(&data, 0, sizeof(data));
|
||||
data.flags = flags;
|
||||
|
||||
init_revisions(&rev, prefix);
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
setup_revisions(0, NULL, &rev, NULL);
|
||||
if (pathspec)
|
||||
copy_pathspec(&rev.prune_data, pathspec);
|
||||
|
@ -232,7 +232,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
|
|||
if (read_cache() < 0)
|
||||
die(_("Could not read the index"));
|
||||
|
||||
init_revisions(&rev, prefix);
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
rev.diffopt.context = 7;
|
||||
|
||||
argc = setup_revisions(argc, argv, &rev, NULL);
|
||||
|
|
10
builtin/am.c
10
builtin/am.c
|
@ -1376,7 +1376,7 @@ static void write_commit_patch(const struct am_state *state, struct commit *comm
|
|||
FILE *fp;
|
||||
|
||||
fp = xfopen(am_path(state, "patch"), "w");
|
||||
init_revisions(&rev_info, NULL);
|
||||
repo_init_revisions(the_repository, &rev_info, NULL);
|
||||
rev_info.diff = 1;
|
||||
rev_info.abbrev = 0;
|
||||
rev_info.disable_stdin = 1;
|
||||
|
@ -1411,7 +1411,7 @@ static void write_index_patch(const struct am_state *state)
|
|||
the_repository->hash_algo->empty_tree);
|
||||
|
||||
fp = xfopen(am_path(state, "patch"), "w");
|
||||
init_revisions(&rev_info, NULL);
|
||||
repo_init_revisions(the_repository, &rev_info, NULL);
|
||||
rev_info.diff = 1;
|
||||
rev_info.disable_stdin = 1;
|
||||
rev_info.no_commit_id = 1;
|
||||
|
@ -1569,7 +1569,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
|
|||
struct rev_info rev_info;
|
||||
const char *diff_filter_str = "--diff-filter=AM";
|
||||
|
||||
init_revisions(&rev_info, NULL);
|
||||
repo_init_revisions(the_repository, &rev_info, NULL);
|
||||
rev_info.diffopt.output_format = DIFF_FORMAT_NAME_STATUS;
|
||||
diff_opt_parse(&rev_info.diffopt, &diff_filter_str, 1, rev_info.prefix);
|
||||
add_pending_oid(&rev_info, "HEAD", &our_tree, 0);
|
||||
|
@ -1608,7 +1608,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
|
|||
o.verbosity = 0;
|
||||
|
||||
if (merge_recursive_generic(&o, &our_tree, &their_tree, 1, bases, &result)) {
|
||||
rerere(state->allow_rerere_autoupdate);
|
||||
repo_rerere(the_repository, state->allow_rerere_autoupdate);
|
||||
free(their_tree_name);
|
||||
return error(_("Failed to merge in the changes."));
|
||||
}
|
||||
|
@ -1903,7 +1903,7 @@ static void am_resolve(struct am_state *state)
|
|||
goto next;
|
||||
}
|
||||
|
||||
rerere(0);
|
||||
repo_rerere(the_repository, 0);
|
||||
|
||||
do_commit(state);
|
||||
|
||||
|
|
|
@ -830,7 +830,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
|
|||
|
||||
setup_default_color_by_age();
|
||||
git_config(git_blame_config, &output_option);
|
||||
init_revisions(&revs, NULL);
|
||||
repo_init_revisions(the_repository, &revs, NULL);
|
||||
revs.date_mode = blame_date_mode;
|
||||
revs.diffopt.flags.allow_textconv = 1;
|
||||
revs.diffopt.flags.follow_renames = 1;
|
||||
|
@ -1001,7 +1001,7 @@ parse_done:
|
|||
long bottom, top;
|
||||
if (parse_range_arg(range_list.items[range_i].string,
|
||||
nth_line_cb, &sb, lno, anchor,
|
||||
&bottom, &top, sb.path))
|
||||
&bottom, &top, sb.path, &the_index))
|
||||
usage(blame_usage);
|
||||
if ((!lno && (top || bottom)) || lno < bottom)
|
||||
die(Q_("file %s has only %lu line",
|
||||
|
|
|
@ -113,7 +113,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
|
|||
die("git cat-file --textconv %s: <object> must be <sha1:path>",
|
||||
obj_name);
|
||||
|
||||
if (textconv_object(path, obj_context.mode, &oid, 1, &buf, &size))
|
||||
if (textconv_object(the_repository, path, obj_context.mode,
|
||||
&oid, 1, &buf, &size))
|
||||
break;
|
||||
/* else fallthrough */
|
||||
|
||||
|
@ -305,7 +306,8 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
|
|||
oid_to_hex(oid), data->rest);
|
||||
} else if (opt->cmdmode == 'c') {
|
||||
enum object_type type;
|
||||
if (!textconv_object(data->rest, 0100644, oid,
|
||||
if (!textconv_object(the_repository,
|
||||
data->rest, 0100644, oid,
|
||||
1, &contents, &size))
|
||||
contents = read_object_file(oid,
|
||||
&type,
|
||||
|
|
|
@ -214,7 +214,8 @@ static int checkout_merged(int pos, const struct checkout *state)
|
|||
* merge.renormalize set, too
|
||||
*/
|
||||
status = ll_merge(&result_buf, path, &ancestor, "base",
|
||||
&ours, "ours", &theirs, "theirs", NULL);
|
||||
&ours, "ours", &theirs, "theirs",
|
||||
state->istate, NULL);
|
||||
free(ancestor.ptr);
|
||||
free(ours.ptr);
|
||||
free(theirs.ptr);
|
||||
|
@ -397,7 +398,7 @@ static void show_local_changes(struct object *head,
|
|||
{
|
||||
struct rev_info rev;
|
||||
/* I think we want full paths, even if we're in a subdirectory. */
|
||||
init_revisions(&rev, NULL);
|
||||
repo_init_revisions(the_repository, &rev, NULL);
|
||||
rev.diffopt.flags = opts->flags;
|
||||
rev.diffopt.output_format |= DIFF_FORMAT_NAME_STATUS;
|
||||
diff_setup_done(&rev.diffopt);
|
||||
|
@ -899,7 +900,7 @@ static void orphaned_commit_warning(struct commit *old_commit, struct commit *ne
|
|||
struct rev_info revs;
|
||||
struct object *object = &old_commit->object;
|
||||
|
||||
init_revisions(&revs, NULL);
|
||||
repo_init_revisions(the_repository, &revs, NULL);
|
||||
setup_revisions(0, NULL, &revs, NULL);
|
||||
|
||||
object->flags &= ~UNINTERESTING;
|
||||
|
|
|
@ -983,7 +983,7 @@ static const char *find_author_by_nickname(const char *name)
|
|||
const char *av[20];
|
||||
int ac = 0;
|
||||
|
||||
init_revisions(&revs, NULL);
|
||||
repo_init_revisions(the_repository, &revs, NULL);
|
||||
strbuf_addf(&buf, "--author=%s", name);
|
||||
av[++ac] = "--all";
|
||||
av[++ac] = "-i";
|
||||
|
@ -1657,7 +1657,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
|
|||
if (git_env_bool(GIT_TEST_COMMIT_GRAPH, 0))
|
||||
write_commit_graph_reachable(get_object_directory(), 0, 0);
|
||||
|
||||
rerere(0);
|
||||
repo_rerere(the_repository, 0);
|
||||
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
|
||||
run_commit_hook(use_editor, get_index_file(), "post-commit", NULL);
|
||||
if (amend && !no_post_rewrite) {
|
||||
|
|
|
@ -488,7 +488,7 @@ static void describe_blob(struct object_id oid, struct strbuf *dst)
|
|||
"--objects", "--in-commit-order", "--reverse", "HEAD",
|
||||
NULL);
|
||||
|
||||
init_revisions(&revs, NULL);
|
||||
repo_init_revisions(the_repository, &revs, NULL);
|
||||
if (setup_revisions(args.argc, args.argv, &revs, NULL) > 1)
|
||||
BUG("setup_revisions could not handle all args?");
|
||||
|
||||
|
@ -636,7 +636,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
|
|||
if (0 <= fd)
|
||||
update_index_if_able(&the_index, &index_lock);
|
||||
|
||||
init_revisions(&revs, prefix);
|
||||
repo_init_revisions(the_repository, &revs, prefix);
|
||||
argv_array_pushv(&args, diff_index_args);
|
||||
if (setup_revisions(args.argc, args.argv, &revs, NULL) != 1)
|
||||
BUG("malformed internal diff-index command line");
|
||||
|
|
|
@ -25,7 +25,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
|
|||
usage(diff_files_usage);
|
||||
|
||||
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
|
||||
init_revisions(&rev, prefix);
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
rev.abbrev = 0;
|
||||
precompose_argv(argc, argv);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
|
|||
usage(diff_cache_usage);
|
||||
|
||||
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
|
||||
init_revisions(&rev, prefix);
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
rev.abbrev = 0;
|
||||
precompose_argv(argc, argv);
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
|
|||
usage(diff_tree_usage);
|
||||
|
||||
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
|
||||
init_revisions(opt, prefix);
|
||||
repo_init_revisions(the_repository, opt, prefix);
|
||||
if (read_cache() < 0)
|
||||
die(_("index file corrupt"));
|
||||
opt->abbrev = 0;
|
||||
|
|
|
@ -318,7 +318,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
|||
git_config(git_diff_ui_config, NULL);
|
||||
precompose_argv(argc, argv);
|
||||
|
||||
init_revisions(&rev, prefix);
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
|
||||
if (no_index && argc != i + 2) {
|
||||
if (no_index == DIFF_NO_INDEX_IMPLICIT) {
|
||||
|
@ -339,7 +339,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
|||
}
|
||||
if (no_index)
|
||||
/* If this is a no-index diff, just run it and exit there. */
|
||||
diff_no_index(&rev, argc, argv);
|
||||
diff_no_index(the_repository, &rev, argc, argv);
|
||||
|
||||
/* Otherwise, we are doing the usual "git" diff */
|
||||
rev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index;
|
||||
|
|
|
@ -112,7 +112,7 @@ static int use_wt_file(const char *workdir, const char *name,
|
|||
int fd = open(buf.buf, O_RDONLY);
|
||||
|
||||
if (fd >= 0 &&
|
||||
!index_fd(&wt_oid, fd, &st, OBJ_BLOB, name, 0)) {
|
||||
!index_fd(&the_index, &wt_oid, fd, &st, OBJ_BLOB, name, 0)) {
|
||||
if (is_null_oid(oid)) {
|
||||
oidcpy(oid, &wt_oid);
|
||||
use = 1;
|
||||
|
|
|
@ -1033,7 +1033,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
|
|||
/* we handle encodings */
|
||||
git_config(git_default_config, NULL);
|
||||
|
||||
init_revisions(&revs, prefix);
|
||||
repo_init_revisions(the_repository, &revs, prefix);
|
||||
init_revision_sources(&revision_sources);
|
||||
revs.topo_order = 1;
|
||||
revs.sources = &revision_sources;
|
||||
|
|
|
@ -643,7 +643,7 @@ int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
|
|||
struct rev_info rev;
|
||||
|
||||
head = lookup_commit_or_die(&head_oid, "HEAD");
|
||||
init_revisions(&rev, NULL);
|
||||
repo_init_revisions(the_repository, &rev, NULL);
|
||||
rev.commit_format = CMIT_FMT_ONELINE;
|
||||
rev.ignore_merges = 1;
|
||||
rev.limited = 1;
|
||||
|
|
|
@ -103,7 +103,8 @@ static void add_work(struct grep_opt *opt, const struct grep_source *gs)
|
|||
|
||||
todo[todo_end].source = *gs;
|
||||
if (opt->binary != GREP_BINARY_TEXT)
|
||||
grep_source_load_driver(&todo[todo_end].source);
|
||||
grep_source_load_driver(&todo[todo_end].source,
|
||||
opt->repo->index);
|
||||
todo[todo_end].done = 0;
|
||||
strbuf_reset(&todo[todo_end].out);
|
||||
todo_end = (todo_end + 1) % ARRAY_SIZE(todo);
|
||||
|
@ -904,9 +905,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
|
|||
OPT_END()
|
||||
};
|
||||
|
||||
init_grep_defaults();
|
||||
init_grep_defaults(the_repository);
|
||||
git_config(grep_cmd_config, NULL);
|
||||
grep_init(&opt, prefix);
|
||||
grep_init(&opt, the_repository, prefix);
|
||||
|
||||
/*
|
||||
* If there is no -- then the paths must exist in the working
|
||||
|
|
|
@ -40,7 +40,7 @@ static void hash_fd(int fd, const char *type, const char *path, unsigned flags,
|
|||
if (fstat(fd, &st) < 0 ||
|
||||
(literally
|
||||
? hash_literally(&oid, fd, type, flags)
|
||||
: index_fd(&oid, fd, &st, type_from_string(type), path, flags)))
|
||||
: index_fd(&the_index, &oid, fd, &st, type_from_string(type), path, flags)))
|
||||
die((flags & HASH_WRITE_OBJECT)
|
||||
? "Unable to add %s to database"
|
||||
: "Unable to hash %s", path);
|
||||
|
|
|
@ -118,7 +118,7 @@ static int log_line_range_callback(const struct option *option, const char *arg,
|
|||
|
||||
static void init_log_defaults(void)
|
||||
{
|
||||
init_grep_defaults();
|
||||
init_grep_defaults(the_repository);
|
||||
init_diff_ui_defaults();
|
||||
|
||||
decoration_style = auto_decoration_style();
|
||||
|
@ -470,7 +470,7 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
|
|||
init_log_defaults();
|
||||
git_config(git_log_config, NULL);
|
||||
|
||||
init_revisions(&rev, prefix);
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
rev.diff = 1;
|
||||
rev.simplify_history = 0;
|
||||
memset(&opt, 0, sizeof(opt));
|
||||
|
@ -510,7 +510,8 @@ static int show_blob_object(const struct object_id *oid, struct rev_info *rev, c
|
|||
&oidc, &obj_context))
|
||||
die(_("Not a valid object name %s"), obj_name);
|
||||
if (!obj_context.path ||
|
||||
!textconv_object(obj_context.path, obj_context.mode, &oidc, 1, &buf, &size)) {
|
||||
!textconv_object(the_repository, obj_context.path,
|
||||
obj_context.mode, &oidc, 1, &buf, &size)) {
|
||||
free(obj_context.path);
|
||||
return stream_blob_to_fd(1, oid, NULL, 0);
|
||||
}
|
||||
|
@ -587,7 +588,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
|
|||
git_config(git_log_config, NULL);
|
||||
|
||||
memset(&match_all, 0, sizeof(match_all));
|
||||
init_revisions(&rev, prefix);
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
rev.diff = 1;
|
||||
rev.always_show_header = 1;
|
||||
rev.no_walk = REVISION_WALK_NO_WALK_SORTED;
|
||||
|
@ -667,7 +668,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
|
|||
init_log_defaults();
|
||||
git_config(git_log_config, NULL);
|
||||
|
||||
init_revisions(&rev, prefix);
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
init_reflog_walk(&rev.reflog_info);
|
||||
rev.verbose_header = 1;
|
||||
memset(&opt, 0, sizeof(opt));
|
||||
|
@ -706,7 +707,7 @@ int cmd_log(int argc, const char **argv, const char *prefix)
|
|||
init_log_defaults();
|
||||
git_config(git_log_config, NULL);
|
||||
|
||||
init_revisions(&rev, prefix);
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
rev.always_show_header = 1;
|
||||
memset(&opt, 0, sizeof(opt));
|
||||
opt.def = "HEAD";
|
||||
|
@ -916,10 +917,10 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
|
|||
if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING))
|
||||
die(_("Not a range."));
|
||||
|
||||
init_patch_ids(ids);
|
||||
init_patch_ids(the_repository, ids);
|
||||
|
||||
/* given a range a..b get all patch ids for b..a */
|
||||
init_revisions(&check_rev, rev->prefix);
|
||||
repo_init_revisions(the_repository, &check_rev, rev->prefix);
|
||||
check_rev.max_parents = 1;
|
||||
o1->flags ^= UNINTERESTING;
|
||||
o2->flags ^= UNINTERESTING;
|
||||
|
@ -1377,13 +1378,13 @@ static void prepare_bases(struct base_tree_info *bases,
|
|||
return;
|
||||
|
||||
init_commit_base(&commit_base);
|
||||
diff_setup(&diffopt);
|
||||
repo_diff_setup(the_repository, &diffopt);
|
||||
diffopt.flags.recursive = 1;
|
||||
diff_setup_done(&diffopt);
|
||||
|
||||
oidcpy(&bases->base_commit, &base->object.oid);
|
||||
|
||||
init_revisions(&revs, NULL);
|
||||
repo_init_revisions(the_repository, &revs, NULL);
|
||||
revs.max_parents = 1;
|
||||
revs.topo_order = 1;
|
||||
for (i = 0; i < total; i++) {
|
||||
|
@ -1588,7 +1589,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
|||
extra_cc.strdup_strings = 1;
|
||||
init_log_defaults();
|
||||
git_config(git_format_config, NULL);
|
||||
init_revisions(&rev, prefix);
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
rev.commit_format = CMIT_FMT_EMAIL;
|
||||
rev.expand_tabs_in_log_default = 0;
|
||||
rev.verbose_header = 1;
|
||||
|
@ -2038,7 +2039,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
|
|||
}
|
||||
}
|
||||
|
||||
init_revisions(&revs, prefix);
|
||||
repo_init_revisions(the_repository, &revs, prefix);
|
||||
revs.max_parents = 1;
|
||||
|
||||
if (add_pending_commit(head, &revs, 0))
|
||||
|
|
|
@ -76,7 +76,7 @@ static void *result(struct merge_list *entry, unsigned long *size)
|
|||
their = NULL;
|
||||
if (entry)
|
||||
their = entry->blob;
|
||||
return merge_blobs(path, base, our, their, size);
|
||||
return merge_blobs(&the_index, path, base, our, their, size);
|
||||
}
|
||||
|
||||
static void *origin(struct merge_list *entry, unsigned long *size)
|
||||
|
|
|
@ -390,7 +390,7 @@ static void squash_message(struct commit *commit, struct commit_list *remotehead
|
|||
|
||||
printf(_("Squash commit -- not updating HEAD\n"));
|
||||
|
||||
init_revisions(&rev, NULL);
|
||||
repo_init_revisions(the_repository, &rev, NULL);
|
||||
rev.ignore_merges = 1;
|
||||
rev.commit_format = CMIT_FMT_MEDIUM;
|
||||
|
||||
|
@ -453,7 +453,7 @@ static void finish(struct commit *head_commit,
|
|||
}
|
||||
if (new_head && show_diffstat) {
|
||||
struct diff_options opts;
|
||||
diff_setup(&opts);
|
||||
repo_diff_setup(the_repository, &opts);
|
||||
opts.stat_width = -1; /* use full terminal width */
|
||||
opts.stat_graph_width = -1; /* respect statGraphWidth config */
|
||||
opts.output_format |=
|
||||
|
@ -729,8 +729,9 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
|
|||
die(_("unable to write %s"), get_index_file());
|
||||
return clean ? 0 : 1;
|
||||
} else {
|
||||
return try_merge_command(strategy, xopts_nr, xopts,
|
||||
common, head_arg, remoteheads);
|
||||
return try_merge_command(the_repository,
|
||||
strategy, xopts_nr, xopts,
|
||||
common, head_arg, remoteheads);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -899,7 +900,7 @@ static int suggest_conflicts(void)
|
|||
fputs(msgbuf.buf, fp);
|
||||
strbuf_release(&msgbuf);
|
||||
fclose(fp);
|
||||
rerere(allow_rerere_auto);
|
||||
repo_rerere(the_repository, allow_rerere_auto);
|
||||
printf(_("Automatic merge failed; "
|
||||
"fix conflicts and then commit the result.\n"));
|
||||
return 1;
|
||||
|
@ -911,7 +912,7 @@ static int evaluate_result(void)
|
|||
struct rev_info rev;
|
||||
|
||||
/* Check how many files differ. */
|
||||
init_revisions(&rev, "");
|
||||
repo_init_revisions(the_repository, &rev, "");
|
||||
setup_revisions(0, NULL, &rev, NULL);
|
||||
rev.diffopt.output_format |=
|
||||
DIFF_FORMAT_CALLBACK;
|
||||
|
@ -1471,7 +1472,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (checkout_fast_forward(&head_commit->object.oid,
|
||||
if (checkout_fast_forward(the_repository,
|
||||
&head_commit->object.oid,
|
||||
&commit->object.oid,
|
||||
overwrite_ignore)) {
|
||||
ret = 1;
|
||||
|
|
|
@ -3106,7 +3106,7 @@ static void get_object_list(int ac, const char **av)
|
|||
char line[1000];
|
||||
int flags = 0;
|
||||
|
||||
init_revisions(&revs, NULL);
|
||||
repo_init_revisions(the_repository, &revs, NULL);
|
||||
save_commit_buffer = 0;
|
||||
setup_revisions(ac, av, &revs, NULL);
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
|
|||
save_commit_buffer = 0;
|
||||
read_replace_refs = 0;
|
||||
ref_paranoia = 1;
|
||||
init_revisions(&revs, prefix);
|
||||
repo_init_revisions(the_repository, &revs, prefix);
|
||||
|
||||
argc = parse_options(argc, argv, prefix, options, prune_usage, 0);
|
||||
|
||||
|
|
|
@ -563,7 +563,9 @@ static int pull_into_void(const struct object_id *merge_head,
|
|||
* index/worktree changes that the user already made on the unborn
|
||||
* branch.
|
||||
*/
|
||||
if (checkout_fast_forward(the_hash_algo->empty_tree, merge_head, 0))
|
||||
if (checkout_fast_forward(the_repository,
|
||||
the_hash_algo->empty_tree,
|
||||
merge_head, 0))
|
||||
return 1;
|
||||
|
||||
if (update_ref("initial pull", "HEAD", merge_head, curr_head, 0, UPDATE_REFS_DIE_ON_ERR))
|
||||
|
@ -916,7 +918,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
|
|||
"fast-forwarding your working tree from\n"
|
||||
"commit %s."), oid_to_hex(&orig_head));
|
||||
|
||||
if (checkout_fast_forward(&orig_head, &curr_head, 0))
|
||||
if (checkout_fast_forward(the_repository, &orig_head,
|
||||
&curr_head, 0))
|
||||
die(_("Cannot fast-forward your working tree.\n"
|
||||
"After making sure that you saved anything precious from\n"
|
||||
"$ git diff %s\n"
|
||||
|
@ -942,7 +945,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
|
|||
int ret = 0;
|
||||
if ((recurse_submodules == RECURSE_SUBMODULES_ON ||
|
||||
recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND) &&
|
||||
submodule_touches_in_range(&rebase_fork_point, &curr_head))
|
||||
submodule_touches_in_range(&the_index, &rebase_fork_point, &curr_head))
|
||||
die(_("cannot rebase with locally recorded submodule modifications"));
|
||||
if (!autostash) {
|
||||
struct commit_list *list = NULL;
|
||||
|
|
|
@ -28,7 +28,7 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix)
|
|||
|
||||
git_config(git_diff_ui_config, NULL);
|
||||
|
||||
diff_setup(&diffopt);
|
||||
repo_diff_setup(the_repository, &diffopt);
|
||||
|
||||
argc = parse_options(argc, argv, NULL, options,
|
||||
builtin_range_diff_usage, PARSE_OPT_KEEP_UNKNOWN |
|
||||
|
|
|
@ -567,7 +567,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
|
|||
* from reflog if the repository was pruned with older git.
|
||||
*/
|
||||
if (cb.cmd.stalefix) {
|
||||
init_revisions(&cb.cmd.revs, prefix);
|
||||
repo_init_revisions(the_repository, &cb.cmd.revs, prefix);
|
||||
if (flags & EXPIRE_REFLOGS_VERBOSE)
|
||||
printf("Marking reachable objects...");
|
||||
mark_reachable_objects(&cb.cmd.revs, 0, 0, NULL);
|
||||
|
|
|
@ -295,7 +295,7 @@ static int import_object(struct object_id *oid, enum object_type type,
|
|||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
if (index_fd(oid, fd, &st, type, NULL, flags) < 0)
|
||||
if (index_fd(&the_index, oid, fd, &st, type, NULL, flags) < 0)
|
||||
return error(_("unable to write object to database"));
|
||||
/* index_fd close()s fd for us */
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
|
|||
flags = RERERE_NOAUTOUPDATE;
|
||||
|
||||
if (argc < 1)
|
||||
return rerere(flags);
|
||||
return repo_rerere(the_repository, flags);
|
||||
|
||||
if (!strcmp(argv[0], "forget")) {
|
||||
struct pathspec pathspec;
|
||||
|
@ -78,7 +78,7 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
|
|||
warning(_("'git rerere forget' without paths is deprecated"));
|
||||
parse_pathspec(&pathspec, 0, PATHSPEC_PREFER_CWD,
|
||||
prefix, argv + 1);
|
||||
return rerere_forget(&pathspec);
|
||||
return rerere_forget(the_repository, &pathspec);
|
||||
}
|
||||
|
||||
if (!strcmp(argv[0], "clear")) {
|
||||
|
@ -91,7 +91,7 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
|
|||
for (i = 0; i < merge_rr.nr; i++)
|
||||
printf("%s\n", merge_rr.items[i].string);
|
||||
} else if (!strcmp(argv[0], "remaining")) {
|
||||
rerere_remaining(&merge_rr);
|
||||
rerere_remaining(the_repository, &merge_rr);
|
||||
for (i = 0; i < merge_rr.nr; i++) {
|
||||
if (merge_rr.items[i].util != RERERE_RESOLVED)
|
||||
printf("%s\n", merge_rr.items[i].string);
|
||||
|
|
|
@ -159,6 +159,7 @@ static int read_from_tree(const struct pathspec *pathspec,
|
|||
opt.format_callback = update_index_from_diff;
|
||||
opt.format_callback_data = &intent_to_add;
|
||||
opt.flags.override_submodule_config = 1;
|
||||
opt.repo = the_repository;
|
||||
|
||||
if (do_diff_cache(tree_oid, &opt))
|
||||
return 1;
|
||||
|
|
|
@ -370,7 +370,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
|||
usage(rev_list_usage);
|
||||
|
||||
git_config(git_default_config, NULL);
|
||||
init_revisions(&revs, prefix);
|
||||
repo_init_revisions(the_repository, &revs, prefix);
|
||||
revs.abbrev = DEFAULT_ABBREV;
|
||||
revs.commit_format = CMIT_FMT_UNSPECIFIED;
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
|
|||
} else {
|
||||
struct setup_revision_opt s_r_opt;
|
||||
opts->revs = xmalloc(sizeof(*opts->revs));
|
||||
init_revisions(opts->revs, NULL);
|
||||
repo_init_revisions(the_repository, opts->revs, NULL);
|
||||
opts->revs->no_walk = REVISION_WALK_NO_WALK_UNSORTED;
|
||||
if (argc < 2)
|
||||
usage_with_options(usage_str, options);
|
||||
|
|
|
@ -278,7 +278,7 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
|
|||
|
||||
git_config(git_default_config, NULL);
|
||||
shortlog_init(&log);
|
||||
init_revisions(&rev, prefix);
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
parse_options_start(&ctx, argc, argv, prefix, options,
|
||||
PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_ARGV0);
|
||||
|
||||
|
|
|
@ -792,7 +792,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
|
|||
path, NULL);
|
||||
|
||||
git_config(git_diff_basic_config, NULL);
|
||||
init_revisions(&rev, prefix);
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
rev.abbrev = 0;
|
||||
diff_files_args.argc = setup_revisions(diff_files_args.argc,
|
||||
diff_files_args.argv,
|
||||
|
|
|
@ -282,7 +282,7 @@ static int add_one_path(const struct cache_entry *old, const char *path, int len
|
|||
fill_stat_cache_info(ce, st);
|
||||
ce->ce_mode = ce_mode_from_stat(old, st->st_mode);
|
||||
|
||||
if (index_path(&ce->oid, path, st,
|
||||
if (index_path(&the_index, &ce->oid, path, st,
|
||||
info_only ? 0 : HASH_WRITE_OBJECT)) {
|
||||
discard_cache_entry(ce);
|
||||
return -1;
|
||||
|
|
4
bundle.c
4
bundle.c
|
@ -140,7 +140,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
|
|||
int i, ret = 0, req_nr;
|
||||
const char *message = _("Repository lacks these prerequisite commits:");
|
||||
|
||||
init_revisions(&revs, NULL);
|
||||
repo_init_revisions(the_repository, &revs, NULL);
|
||||
for (i = 0; i < p->nr; i++) {
|
||||
struct ref_list_entry *e = p->list + i;
|
||||
struct object *o = parse_object(the_repository, &e->oid);
|
||||
|
@ -441,7 +441,7 @@ int create_bundle(struct bundle_header *header, const char *path,
|
|||
|
||||
/* init revs to list objects for pack-objects later */
|
||||
save_commit_buffer = 0;
|
||||
init_revisions(&revs, NULL);
|
||||
repo_init_revisions(the_repository, &revs, NULL);
|
||||
|
||||
/* write prerequisites */
|
||||
if (compute_and_write_prerequisites(bundle_fd, &revs, argc, argv))
|
||||
|