diff options
-rw-r--r-- | Documentation/config/transfer.txt | 2 | ||||
-rw-r--r-- | Documentation/git-cvsserver.txt | 2 | ||||
-rw-r--r-- | Documentation/git-fetch.txt | 4 | ||||
-rw-r--r-- | Documentation/git-pull.txt | 2 | ||||
-rw-r--r-- | Documentation/git-restore.txt | 2 | ||||
-rw-r--r-- | Documentation/glossary-content.txt | 2 | ||||
-rw-r--r-- | Documentation/technical/api-ref-iteration.txt | 2 | ||||
-rw-r--r-- | builtin/checkout.c | 2 | ||||
-rw-r--r-- | builtin/fetch.c | 15 | ||||
-rw-r--r-- | commit-graph.c | 14 | ||||
-rw-r--r-- | merge-recursive.c | 3 | ||||
-rw-r--r-- | refs/files-backend.c | 4 | ||||
-rw-r--r-- | t/helper/test-dir-iterator.c | 4 | ||||
-rwxr-xr-x | t/t5324-split-commit-graph.sh | 4 | ||||
-rwxr-xr-x | t/t6043-merge-rename-directories.sh | 111 |
15 files changed, 148 insertions, 25 deletions
diff --git a/Documentation/config/transfer.txt b/Documentation/config/transfer.txt index 4a5dfe2fc1..f5b6245270 100644 --- a/Documentation/config/transfer.txt +++ b/Documentation/config/transfer.txt @@ -17,7 +17,7 @@ linkgit:git-receive-pack[1]. On the fetch side, malformed objects will instead be left unreferenced in the repository. + Due to the non-quarantine nature of the `fetch.fsckObjects` -implementation it can not be relied upon to leave the object store +implementation it cannot be relied upon to leave the object store clean like `receive.fsckObjects` can. + As objects are unpacked they're written to the object store, so there diff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt index f98b7c6ed7..79e22b1f3a 100644 --- a/Documentation/git-cvsserver.txt +++ b/Documentation/git-cvsserver.txt @@ -232,7 +232,7 @@ write so it might not be enough to grant the users using 'git-cvsserver' write access to the database file without granting them write access to the directory, too. -The database can not be reliably regenerated in a +The database cannot be reliably regenerated in a consistent form after the branch it is tracking has changed. Example: For merged branches, 'git-cvsserver' only tracks one branch of development, and after a 'git merge' an diff --git a/Documentation/git-fetch.txt b/Documentation/git-fetch.txt index 266d63cf11..5b1909fdf4 100644 --- a/Documentation/git-fetch.txt +++ b/Documentation/git-fetch.txt @@ -262,7 +262,7 @@ This updates (or creates, as necessary) branches `pu` and `tmp` in the local repository by fetching from the branches (respectively) `pu` and `maint` from the remote repository. + -The `pu` branch will be updated even if it is does not fast-forward, +The `pu` branch will be updated even if it does not fast-forward, because it is prefixed with a plus sign; `tmp` will not be. * Peek at a remote's branch, without configuring the remote in your local @@ -285,7 +285,7 @@ BUGS ---- Using --recurse-submodules can only fetch new commits in already checked out submodules right now. When e.g. upstream added a new submodule in the -just fetched commits of the superproject the submodule itself can not be +just fetched commits of the superproject the submodule itself cannot be fetched, making it impossible to check out that submodule later without having to do a fetch again. This is expected to be fixed in a future Git version. diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt index a5e9501a0a..dfb901f8b8 100644 --- a/Documentation/git-pull.txt +++ b/Documentation/git-pull.txt @@ -249,7 +249,7 @@ BUGS ---- Using --recurse-submodules can only fetch new commits in already checked out submodules right now. When e.g. upstream added a new submodule in the -just fetched commits of the superproject the submodule itself can not be +just fetched commits of the superproject the submodule itself cannot be fetched, making it impossible to check out that submodule later without having to do a fetch again. This is expected to be fixed in a future Git version. diff --git a/Documentation/git-restore.txt b/Documentation/git-restore.txt index d90093f195..1ab2e40ea9 100644 --- a/Documentation/git-restore.txt +++ b/Documentation/git-restore.txt @@ -39,7 +39,7 @@ OPTIONS commit, branch or tag associated with it. + If not specified, the default restore source for the working tree is -the index, and the default restore source for the index index is +the index, and the default restore source for the index is `HEAD`. When both `--staged` and `--worktree` are specified, `--source` must also be specified. diff --git a/Documentation/glossary-content.txt b/Documentation/glossary-content.txt index 8d38ae6010..090c888335 100644 --- a/Documentation/glossary-content.txt +++ b/Documentation/glossary-content.txt @@ -255,7 +255,7 @@ This commit is referred to as a "merge commit", or sometimes just a [[def_object]]object:: The unit of storage in Git. It is uniquely identified by the <<def_SHA1,SHA-1>> of its contents. Consequently, an - object can not be changed. + object cannot be changed. [[def_object_database]]object database:: Stores a set of "objects", and an individual <<def_object,object>> is diff --git a/Documentation/technical/api-ref-iteration.txt b/Documentation/technical/api-ref-iteration.txt index 46c3d5c355..ad9d019ff9 100644 --- a/Documentation/technical/api-ref-iteration.txt +++ b/Documentation/technical/api-ref-iteration.txt @@ -54,7 +54,7 @@ this: do not do this you will get an error for each ref that it does not point to a valid object. -Note: As a side-effect of this you can not safely assume that all +Note: As a side-effect of this you cannot safely assume that all objects you lookup are available in superproject. All submodule objects will be available the same way as the superprojects objects. diff --git a/builtin/checkout.c b/builtin/checkout.c index 91f8509f85..6123f732a2 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1769,7 +1769,7 @@ int cmd_restore(int argc, const char **argv, const char *prefix) struct option *options; struct option restore_options[] = { OPT_STRING('s', "source", &opts.from_treeish, "<tree-ish>", - N_("where the checkout from")), + N_("which tree-ish to checkout from")), OPT_BOOL('S', "staged", &opts.checkout_index, N_("restore the index")), OPT_BOOL('W', "worktree", &opts.checkout_worktree, diff --git a/builtin/fetch.c b/builtin/fetch.c index 53ce99d2bb..717dd14e89 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -850,6 +850,15 @@ static int iterate_ref_map(void *cb_data, struct object_id *oid) return 0; } +static const char warn_show_forced_updates[] = +N_("Fetch normally indicates which branches had a forced update,\n" + "but that check has been disabled. To re-enable, use '--show-forced-updates'\n" + "flag or run 'git config fetch.showForcedUpdates true'."); +static const char warn_time_show_forced_updates[] = +N_("It took %.2f seconds to check forced updates. You can use\n" + "'--no-show-forced-updates' or run 'git config fetch.showForcedUpdates false'\n" + " to avoid this check.\n"); + static int store_updated_refs(const char *raw_url, const char *remote_name, int connectivity_checked, struct ref *ref_map) { @@ -1005,12 +1014,10 @@ static int store_updated_refs(const char *raw_url, const char *remote_name, if (advice_fetch_show_forced_updates) { if (!fetch_show_forced_updates) { - warning(_("Fetch normally indicates which branches had a forced update, but that check has been disabled.")); - warning(_("To re-enable, use '--show-forced-updates' flag or run 'git config fetch.showForcedUpdates true'.")); + warning(_(warn_show_forced_updates)); } else if (forced_updates_ms > FORCED_UPDATES_DELAY_WARNING_IN_MS) { - warning(_("It took %.2f seconds to check forced updates. You can use '--no-show-forced-updates'\n"), + warning(_(warn_time_show_forced_updates), forced_updates_ms / 1000.0); - warning(_("or run 'git config fetch.showForcedUpdates false' to avoid this check.\n")); } } diff --git a/commit-graph.c b/commit-graph.c index b3c4de79b6..fe954ab5f8 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -434,6 +434,7 @@ static struct commit_graph *load_commit_graph_chain(struct repository *r, const free(oids); fclose(fp); + strbuf_release(&line); return graph_chain; } @@ -1186,7 +1187,7 @@ static int fill_oids_from_packs(struct write_commit_graph_context *ctx, } stop_progress(&ctx->progress); - strbuf_reset(&progress_title); + strbuf_release(&progress_title); strbuf_release(&packname); return 0; @@ -1636,7 +1637,7 @@ static void sort_and_scan_merged_commits(struct write_commit_graph_context *ctx) num_parents++; if (num_parents > 2) - ctx->num_extra_edges += num_parents - 2; + ctx->num_extra_edges += num_parents - 1; } } @@ -1713,10 +1714,8 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx) strbuf_addstr(&path, "/info/commit-graphs"); dir = opendir(path.buf); - if (!dir) { - strbuf_release(&path); - return; - } + if (!dir) + goto out; strbuf_addch(&path, '/'); dirnamelen = path.len; @@ -1745,6 +1744,9 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx) if (!found) unlink(path.buf); } + +out: + strbuf_release(&path); } int write_commit_graph(const char *obj_dir, diff --git a/merge-recursive.c b/merge-recursive.c index 12300131fc..6b812d67e3 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -2863,7 +2863,8 @@ static int detect_and_process_renames(struct merge_options *opt, head_pairs = get_diffpairs(opt, common, head); merge_pairs = get_diffpairs(opt, common, merge); - if (opt->detect_directory_renames) { + if ((opt->detect_directory_renames == 2) || + (opt->detect_directory_renames == 1 && !opt->call_depth)) { dir_re_head = get_directory_renames(head_pairs); dir_re_merge = get_directory_renames(merge_pairs); diff --git a/refs/files-backend.c b/refs/files-backend.c index b1f8f53a09..d60767ab73 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2151,8 +2151,10 @@ static struct ref_iterator *reflog_iterator_begin(struct ref_store *ref_store, strbuf_addf(&sb, "%s/logs", gitdir); diter = dir_iterator_begin(sb.buf, 0); - if(!diter) + if (!diter) { + strbuf_release(&sb); return empty_ref_iterator_begin(); + } iter = xcalloc(1, sizeof(*iter)); ref_iterator = &iter->base; diff --git a/t/helper/test-dir-iterator.c b/t/helper/test-dir-iterator.c index c7c30664da..659b6bfa81 100644 --- a/t/helper/test-dir-iterator.c +++ b/t/helper/test-dir-iterator.c @@ -19,7 +19,6 @@ static const char *error_name(int error_number) */ int cmd__dir_iterator(int argc, const char **argv) { - struct strbuf path = STRBUF_INIT; struct dir_iterator *diter; unsigned int flags = 0; int iter_status; @@ -36,8 +35,7 @@ int cmd__dir_iterator(int argc, const char **argv) if (!*argv || argc != 1) die("dir-iterator needs exactly one non-option argument"); - strbuf_add(&path, *argv, strlen(*argv)); - diter = dir_iterator_begin(path.buf, flags); + diter = dir_iterator_begin(*argv, flags); if (!diter) { printf("dir_iterator_begin failure: %s\n", error_name(errno)); diff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh index 03f45a1ed9..99f4ef4c19 100755 --- a/t/t5324-split-commit-graph.sh +++ b/t/t5324-split-commit-graph.sh @@ -319,7 +319,9 @@ test_expect_success 'add octopus merge' ' git merge commits/3 commits/4 && git branch merge/octopus && git commit-graph write --reachable --split && - git commit-graph verify && + git commit-graph verify 2>err && + test_line_count = 3 err && + test_i18ngrep ! warning err && test_line_count = 3 $graphdir/commit-graph-chain ' diff --git a/t/t6043-merge-rename-directories.sh b/t/t6043-merge-rename-directories.sh index 50b7543483..c966147d5d 100755 --- a/t/t6043-merge-rename-directories.sh +++ b/t/t6043-merge-rename-directories.sh @@ -4403,4 +4403,115 @@ test_expect_success '13d-check(info): messages for rename/rename(1to1) via dual ) ' +# Testcase 13e, directory rename in virtual merge base +# +# This testcase has a slightly different setup than all the above cases, in +# order to include a recursive case: +# +# A C +# o - o +# / \ / \ +# O o X ? +# \ / \ / +# o o +# B D +# +# Commit O: a/{z,y} +# Commit A: b/{z,y} +# Commit B: a/{z,y,x} +# Commit C: b/{z,y,x} +# Commit D: b/{z,y}, a/x +# Expected: b/{z,y,x} (sort of; see below for why this might not be expected) +# +# NOTES: 'X' represents a virtual merge base. With the default of +# directory rename detection yielding conflicts, merging A and B +# results in a conflict complaining about whether 'x' should be +# under 'a/' or 'b/'. However, when creating the virtual merge +# base 'X', since virtual merge bases need to be written out as a +# tree, we cannot have a conflict, so some resolution has to be +# picked. +# +# In choosing the right resolution, it's worth noting here that +# commits C & D are merges of A & B that choose different +# locations for 'x' (i.e. they resolve the conflict differently), +# and so it would be nice when merging C & D if git could detect +# this difference of opinion and report a conflict. But the only +# way to do so that I can think of would be to have the virtual +# merge base place 'x' in some directory other than either 'a/' or +# 'b/', which seems a little weird -- especially since it'd result +# in a rename/rename(1to2) conflict with a source path that never +# existed in any version. +# +# So, for now, when directory rename detection is set to +# 'conflict' just avoid doing directory rename detection at all in +# the recursive case. This will not allow us to detect a conflict +# in the outer merge for this special kind of setup, but it at +# least avoids hitting a BUG(). +# +test_expect_success '13e-setup: directory rename detection in recursive case' ' + test_create_repo 13e && + ( + cd 13e && + + mkdir a && + echo z >a/z && + echo y >a/y && + git add a && + test_tick && + git commit -m "O" && + + git branch O && + git branch A && + git branch B && + + git checkout A && + git mv a/ b/ && + test_tick && + git commit -m "A" && + + git checkout B && + echo x >a/x && + git add a && + test_tick && + git commit -m "B" && + + git branch C A && + git branch D B && + + git checkout C && + test_must_fail git -c merge.directoryRenames=conflict merge B && + git add b/x && + test_tick && + git commit -m "C" && + + + git checkout D && + test_must_fail git -c merge.directoryRenames=conflict merge A && + git add b/x && + mkdir a && + git mv b/x a/x && + test_tick && + git commit -m "D" + ) +' + +test_expect_success '13e-check: directory rename detection in recursive case' ' + ( + cd 13e && + + git checkout --quiet D^0 && + + git -c merge.directoryRenames=conflict merge -s recursive C^0 >out 2>err && + + test_i18ngrep ! CONFLICT out && + test_i18ngrep ! BUG: err && + test_i18ngrep ! core.dumped err && + test_must_be_empty err && + + git ls-files >paths && + ! grep a/x paths && + grep b/x paths + ) +' + test_done |