From f71a8476c29393c2b7921824b4ecfce7d1100a90 Mon Sep 17 00:00:00 2001 From: Karthik Nayak Date: Tue, 8 Oct 2024 11:16:20 +0200 Subject: [PATCH 1/6] clang-format: don't enforce the column limit The current value for the column limit is set to 80. While this is as expected, we often prefer readability over this strict limit. This means it is common to find code which extends over 80 characters. So let's change the column limit to be 0 instead. This ensures that the formatter doesn't complain about code strictly not following the column limit. Signed-off-by: Karthik Nayak --- .clang-format | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 41969eca4b7..fced8599b5f 100644 --- a/.clang-format +++ b/.clang-format @@ -12,7 +12,10 @@ UseTab: Always TabWidth: 8 IndentWidth: 8 ContinuationIndentWidth: 8 -ColumnLimit: 80 + +# While we recommend keeping column limit to 80, we don't want to +# enforce it as we prefer readability. +ColumnLimit: 0 # C Language specifics Language: Cpp -- GitLab From 6174a74d8f04adceea94cb8c0050777f0ebb8bf8 Mon Sep 17 00:00:00 2001 From: Karthik Nayak Date: Tue, 8 Oct 2024 11:19:52 +0200 Subject: [PATCH 2/6] clang-format: don't align expressions after linebreaks We enforce alignment of expressions after linebreaks. Which means for code such as return a || b; it will expect: return a || b; we instead want 'b' to be indent with tabs, which is already done by the 'ContinuationIndentWidth' variable. So let's explicitly set 'AlignOperands' to false. Signed-off-by: Karthik Nayak --- .clang-format | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.clang-format b/.clang-format index fced8599b5f..7ed8994aeaa 100644 --- a/.clang-format +++ b/.clang-format @@ -42,10 +42,9 @@ AlignConsecutiveDeclarations: false # int cccccccc; AlignEscapedNewlines: Left -# Align operands of binary and ternary expressions -# int aaa = bbbbbbbbbbb + -# cccccc; -AlignOperands: true +# Don't enforce alignment after linebreaks and instead +# rely on the ContinuationIndentWidth value. +AlignOperands: false # Don't align trailing comments # int a; // Comment a -- GitLab From 5c8920ce069b587fa0eabc276a139e2d595a4087 Mon Sep 17 00:00:00 2001 From: Karthik Nayak Date: Mon, 23 Sep 2024 13:21:37 -0700 Subject: [PATCH 3/6] clone: skip updating env while writing config to disk In git-clone(1), when parsing the config provided via the '-c' or '--config' option, we set the config to the environment before writing to $GIT_DIR/config. This ensures that the environment is up to date with the config provided before we do further action. However this is unnecessary, since in the very next step we re-read the config from disk to update the environment by calling `git_config(...)` which also sets the appropriate variables of 'builtin/clone.c' as needed. So let's skip this step altogether. --- builtin/clone.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/builtin/clone.c b/builtin/clone.c index e77339c8472..e2b1460c8c6 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -856,18 +856,9 @@ static int write_one_config(const char *key, const char *value, const struct config_context *ctx, void *data) { - /* - * give git_clone_config a chance to write config values back to the - * environment, since git_config_set_multivar_gently only deals with - * config-file writes - */ - int apply_failed = git_clone_config(key, value, ctx, data); - if (apply_failed) - return apply_failed; - - return git_config_set_multivar_gently(key, - value ? value : "true", - CONFIG_REGEX_NONE, 0); + return git_default_config(key, value, ctx, data) || + git_config_set_multivar_gently(key, value ? value : "true", + CONFIG_REGEX_NONE, 0); } static void write_config(struct string_list *config) -- GitLab From 7465d951a475b20eb26479aadc5cb2e122c83c70 Mon Sep 17 00:00:00 2001 From: Karthik Nayak Date: Mon, 23 Sep 2024 13:33:03 -0700 Subject: [PATCH 4/6] setup: allow setting initial config in `init_db` Using the '-c' or '--config' flag in 'git-clone(1)' allows us to set config for the newly cloned repository. The new config is applied post the initial setup of the repository done by calling 'init_db()'. Let's add the functionality of adding user config to 'init_db()' itself. This would ensure that the user config is applied during the default file setup phase of the repository and right after the initial config file is created. There is a slight change in behavior here, earlier, the config was applied in 'git-clone(1)' much later and this meant that user config was only taken into consideration much later. Now, the user config is applied during the default config creation. This currently doesn't cause any breakage, but worth noting. This is required for the following commit, wherein we would introduce reflog entries for symrefs. Since 'HEAD' is a default ref which is created during the repos creation, we would create a reflog for 'HEAD'. With the current flow, if the user sets the 'core.logAllRefUpdates' config to false, we'd still create a reflog for 'HEAD', since user config is applied much later. This means that we'd always create reflog entries for 'HEAD' as once there is a reflog, we always create reflog entries irrelevant of the config. But by setting user config to be set much earlier in the flow, this ensures that if 'core.logAllRefUpdates' is set to false a reflog entry for 'HEAD' is never created in the first place. --- builtin/clone.c | 28 +--------------------------- builtin/init-db.c | 2 +- setup.c | 21 +++++++++++++++++++-- setup.h | 4 ++-- 4 files changed, 23 insertions(+), 32 deletions(-) diff --git a/builtin/clone.c b/builtin/clone.c index e2b1460c8c6..775cdf3b532 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -852,26 +852,6 @@ static int git_clone_config(const char *k, const char *v, return git_default_config(k, v, ctx, cb); } -static int write_one_config(const char *key, const char *value, - const struct config_context *ctx, - void *data) -{ - return git_default_config(key, value, ctx, data) || - git_config_set_multivar_gently(key, value ? value : "true", - CONFIG_REGEX_NONE, 0); -} - -static void write_config(struct string_list *config) -{ - int i; - - for (i = 0; i < config->nr; i++) { - if (git_config_parse_parameter(config->items[i].string, - write_one_config, NULL) < 0) - die(_("unable to write parameters to config file")); - } -} - static void write_refspec_config(const char *src_ref_prefix, const struct ref *our_head_points_at, const struct ref *remote_head_points_at, @@ -1158,7 +1138,7 @@ int cmd_clone(int argc, * their on-disk data structures. */ init_db(git_dir, real_git_dir, option_template, GIT_HASH_UNKNOWN, - ref_storage_format, NULL, + ref_storage_format, NULL, &option_config, do_not_override_repo_unix_permissions, INIT_DB_QUIET | INIT_DB_SKIP_REFDB); if (real_git_dir) { @@ -1210,12 +1190,6 @@ int cmd_clone(int argc, strbuf_addf(&buf, "%s/refs", git_dir); safe_create_dir(buf.buf, 1); - /* - * additional config can be injected with -c, make sure it's included - * after init_db, which clears the entire config environment. - */ - write_config(&option_config); - /* * re-read config after init_db and write_config to pick up any config * injected by --template and --config, respectively. diff --git a/builtin/init-db.c b/builtin/init-db.c index 7e00d57d654..05020328bca 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -251,6 +251,6 @@ int cmd_init_db(int argc, flags |= INIT_DB_EXIST_OK; return init_db(git_dir, real_git_dir, template_dir, hash_algo, - ref_storage_format, initial_branch, + ref_storage_format, initial_branch, NULL, init_shared_repository, flags); } diff --git a/setup.c b/setup.c index 94e79b2e487..827d04b58ee 100644 --- a/setup.c +++ b/setup.c @@ -2288,9 +2288,19 @@ void create_reference_database(enum ref_storage_format ref_storage_format, free(to_free); } +static int write_one_config(const char *key, const char *value, + const struct config_context *ctx, + void *data) +{ + return git_default_config(key, value, ctx, data) || + git_config_set_multivar_gently(key, value ? value : "true", + CONFIG_REGEX_NONE, 0); +} + static int create_default_files(const char *template_path, const char *original_git_dir, const struct repository_format *fmt, + const struct string_list *config, int init_shared_repository) { struct stat st1; @@ -2379,6 +2389,13 @@ static int create_default_files(const char *template_path, probe_utf8_pathname_composition(); } + if (config) { + for (int i = 0; i < config->nr; i++) + if (git_config_parse_parameter(config->items[i].string, + write_one_config, NULL) < 0) + die(_("unable to write parameters to config file")); + } + strbuf_release(&buf); return reinit; } @@ -2522,7 +2539,7 @@ static void repository_format_configure(struct repository_format *repo_fmt, int init_db(const char *git_dir, const char *real_git_dir, const char *template_dir, int hash, enum ref_storage_format ref_storage_format, - const char *initial_branch, + const char *initial_branch, const struct string_list *config, int init_shared_repository, unsigned int flags) { int reinit; @@ -2569,7 +2586,7 @@ int init_db(const char *git_dir, const char *real_git_dir, safe_create_dir(git_dir, 0); reinit = create_default_files(template_dir, original_git_dir, - &repo_fmt, init_shared_repository); + &repo_fmt, config, init_shared_repository); if (!(flags & INIT_DB_SKIP_REFDB)) create_reference_database(repo_fmt.ref_storage_format, diff --git a/setup.h b/setup.h index e496ab3e4de..9a3d8c263c9 100644 --- a/setup.h +++ b/setup.h @@ -197,8 +197,8 @@ const char *get_template_dir(const char *option_template); int init_db(const char *git_dir, const char *real_git_dir, const char *template_dir, int hash_algo, enum ref_storage_format ref_storage_format, - const char *initial_branch, int init_shared_repository, - unsigned int flags); + const char *initial_branch, const struct string_list *config, + int init_shared_repository, unsigned int flags); void initialize_repository_version(int hash_algo, enum ref_storage_format ref_storage_format, int reinit); -- GitLab From e4d09ad67e69ebd88786ae35766b040deea8cb85 Mon Sep 17 00:00:00 2001 From: Karthik Nayak Date: Tue, 8 Oct 2024 12:21:48 +0200 Subject: [PATCH 5/6] init: add option to set config The git-init(1) command doesn't have an option to set the config of the repository. Similar to the git-clone(1) command, let's add a `--config` flag to the `init` command. --- Documentation/git-init.txt | 10 ++++++++++ builtin/init-db.c | 20 +++++++++++++------- t/t0001-init.sh | 12 ++++++++++++ t/t0613-reftable-write-options.sh | 14 +++++++------- 4 files changed, 42 insertions(+), 14 deletions(-) diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt index daff93bd164..9d8ff518362 100644 --- a/Documentation/git-init.txt +++ b/Documentation/git-init.txt @@ -14,6 +14,7 @@ SYNOPSIS [++--ref-format=++____] [`-b` __ | ++--initial-branch=++____] [++--shared++[++=++____]] [__] + [`-c` ____++=++____ | `--config` ____++=++____] DESCRIPTION @@ -140,6 +141,15 @@ into it. If you provide a __, the command is run inside it. If this directory does not exist, it will be created. +`-c` ____++=++____:: +`--config` ____++=++____:: + +Set a configuration variable in the newly-created repository; The __ +is in the same format as expected by linkgit:git-config[1] (e.g., `core.eol=true`). +If multiple values are given for the same key, each value will be written +to the config file. This makes it safe, for example, to add additional +fetch refspecs to the origin remote. + TEMPLATE DIRECTORY ------------------ diff --git a/builtin/init-db.c b/builtin/init-db.c index 05020328bca..c148fe3d704 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -60,7 +60,8 @@ static const char *const init_db_usage[] = { " [--separate-git-dir ] [--object-format=]\n" " [--ref-format=]\n" " [-b | --initial-branch=]\n" - " [--shared[=]] []"), + " [--shared[=]] []\n" + " [-c = | --config =]"), NULL }; @@ -86,15 +87,16 @@ int cmd_init_db(int argc, int hash_algo = GIT_HASH_UNKNOWN; enum ref_storage_format ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN; int init_shared_repository = -1; + static struct string_list option_config = STRING_LIST_INIT_NODUP; const struct option init_db_options[] = { OPT_STRING(0, "template", &template_dir, N_("template-directory"), - N_("directory from which templates will be used")), + N_("directory from which templates will be used")), OPT_SET_INT(0, "bare", &is_bare_repository_cfg, - N_("create a bare repository"), 1), + N_("create a bare repository"), 1), { OPTION_CALLBACK, 0, "shared", &init_shared_repository, - N_("permissions"), - N_("specify that the git repository is to be shared amongst several users"), - PARSE_OPT_OPTARG | PARSE_OPT_NONEG, shared_callback, 0}, + N_("permissions"), + N_("specify that the git repository is to be shared amongst several users"), + PARSE_OPT_OPTARG | PARSE_OPT_NONEG, shared_callback, 0 }, OPT_BIT('q', "quiet", &flags, N_("be quiet"), INIT_DB_QUIET), OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"), N_("separate git dir from working tree")), @@ -104,6 +106,8 @@ int cmd_init_db(int argc, N_("specify the hash algorithm to use")), OPT_STRING(0, "ref-format", &ref_format, N_("format"), N_("specify the reference format to use")), + OPT_STRING_LIST('c', "config", &option_config, N_("key=value"), + N_("set config inside the new repository")), OPT_END() }; @@ -251,6 +255,8 @@ int cmd_init_db(int argc, flags |= INIT_DB_EXIST_OK; return init_db(git_dir, real_git_dir, template_dir, hash_algo, - ref_storage_format, initial_branch, NULL, + ref_storage_format, initial_branch, &option_config, init_shared_repository, flags); + + string_list_clear(&option_config, 0); } diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 0178aa62a41..272af50337d 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -882,4 +882,16 @@ test_expect_success 're-init reads matching includeIf.onbranch' ' test_cmp expect err ' +test_expect_success '--config' ' + test_when_finished "rm -rf repo" && + git init --config user.name=testuser --config user.email=foo@example.com repo && + cd repo && + git config get user.name >actual && + echo testuser >expect && + test_cmp expect actual && + git config get user.email >actual && + echo foo@example.com >expect && + test_cmp expect actual +' + test_done diff --git a/t/t0613-reftable-write-options.sh b/t/t0613-reftable-write-options.sh index b1c6c97524f..7a4386ed979 100755 --- a/t/t0613-reftable-write-options.sh +++ b/t/t0613-reftable-write-options.sh @@ -33,7 +33,7 @@ test_expect_success 'default write options' ' - length: 129 restarts: 2 log: - - length: 262 + - length: 347 restarts: 2 EOF test-tool dump-reftable -b .git/reftable/*.ref >actual && @@ -84,15 +84,15 @@ test_expect_success 'many refs results in multiple blocks' ' - length: 1136 restarts: 3 log: - - length: 4041 + - length: 4032 restarts: 4 - - length: 4015 + - length: 4014 restarts: 3 - length: 4014 restarts: 3 - - length: 4012 + - length: 4011 restarts: 3 - - length: 3289 + - length: 3384 restarts: 3 EOF test-tool dump-reftable -b .git/reftable/*.ref >actual && @@ -193,8 +193,8 @@ test_expect_success 'restart interval at every single record' ' - length: 566 restarts: 13 log: - - length: 1393 - restarts: 12 + - length: 1490 + restarts: 13 EOF test-tool dump-reftable -b .git/reftable/*.ref >actual && test_cmp expect actual -- GitLab From 0d3bb85ee68cc84d7d6a1f04b880ace64a59a2b8 Mon Sep 17 00:00:00 2001 From: Karthik Nayak Date: Tue, 14 May 2024 22:47:42 +0200 Subject: [PATCH 6/6] refs: create reflog entry for dangling symref update A dangling symref is one where the target reference does not exist in the repository. Earlier it was only possible to create symrefs via the 'git-symbolic-ref(1)' command. We then added symref support to the transaction backend in refs and ported the 'git-symbolic-ref(1)' command to use the transaction backend. Since dangling symref updates never created a reflog entry, we carried over this functionality. As all other ref/symref updates create reflog entries, and as having a reflog entry allows us to track ref manipulation, it makes sense to also add reflog entry for dangling symref updates. Unfortunately, since reflog entries only support logging the old and new oid, we cannot log the symref target. So as a next best solution, we set the 'new_oid' value for dangling symrefs as the 'null_oid'. We add some tests to test this new behavior and also modify existing tests to accommodate this behavior. Signed-off-by: Karthik Nayak --- refs/files-backend.c | 7 +++-- refs/reftable-backend.c | 36 ++++++++++++-------------- t/t0612-reftable-jgit-compatibility.sh | 4 +-- t/t1400-update-ref.sh | 11 ++++++++ t/t1405-main-ref-store.sh | 4 +-- t/t1406-submodule-ref-store.sh | 4 +-- t/t1410-reflog.sh | 11 +++++--- t/t1450-fsck.sh | 3 +-- t/t5312-prune-corruption.sh | 5 ++-- 9 files changed, 47 insertions(+), 38 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 0824c0b8a94..1dc29094189 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2950,11 +2950,10 @@ static int parse_and_write_reflog(struct files_ref_store *refs, RESOLVE_REF_READING, &update->new_oid, NULL)) { /* - * TODO: currently we skip creating reflogs for dangling - * symref updates. It would be nice to capture this as - * zero oid updates however. + * For dangling symref updates, we create a reflog with + * null oid value. */ - return 0; + oidcpy(&update->new_oid, null_oid()); } } diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c index 3c96fbf66f9..c0a53c7bca6 100644 --- a/refs/reftable-backend.c +++ b/refs/reftable-backend.c @@ -1360,35 +1360,31 @@ static int write_transaction_table(struct reftable_writer *writer, void *cb_data (u->flags & REF_FORCE_CREATE_REFLOG || should_write_log(arg->refs, u->refname))) { struct reftable_log_record *log; - int create_reflog = 1; if (u->new_target) { if (!refs_resolve_ref_unsafe(&arg->refs->base, u->new_target, RESOLVE_REF_READING, &u->new_oid, NULL)) { /* - * TODO: currently we skip creating reflogs for dangling - * symref updates. It would be nice to capture this as - * zero oid updates however. + * For dangling symref updates, we create a reflog with + * null oid value. */ - create_reflog = 0; + oidcpy(&u->new_oid, null_oid()); } } - if (create_reflog) { - ALLOC_GROW(logs, logs_nr + 1, logs_alloc); - log = &logs[logs_nr++]; - memset(log, 0, sizeof(*log)); - - fill_reftable_log_record(log, &committer_ident); - log->update_index = ts; - log->refname = xstrdup(u->refname); - memcpy(log->value.update.new_hash, - u->new_oid.hash, GIT_MAX_RAWSZ); - memcpy(log->value.update.old_hash, - tx_update->current_oid.hash, GIT_MAX_RAWSZ); - log->value.update.message = - xstrndup(u->msg, arg->refs->write_options.block_size / 2); - } + ALLOC_GROW(logs, logs_nr + 1, logs_alloc); + log = &logs[logs_nr++]; + memset(log, 0, sizeof(*log)); + + fill_reftable_log_record(log, &committer_ident); + log->update_index = ts; + log->refname = xstrdup(u->refname); + memcpy(log->value.update.new_hash, + u->new_oid.hash, GIT_MAX_RAWSZ); + memcpy(log->value.update.old_hash, + tx_update->current_oid.hash, GIT_MAX_RAWSZ); + log->value.update.message = + xstrndup(u->msg, arg->refs->write_options.block_size / 2); } if (u->flags & REF_LOG_ONLY) diff --git a/t/t0612-reftable-jgit-compatibility.sh b/t/t0612-reftable-jgit-compatibility.sh index 84922153ab6..ffa6cef9992 100755 --- a/t/t0612-reftable-jgit-compatibility.sh +++ b/t/t0612-reftable-jgit-compatibility.sh @@ -54,7 +54,7 @@ test_same_reflog () { test_expect_success 'CGit repository can be read by JGit' ' test_when_finished "rm -rf repo" && - git init repo && + git init --config core.logAllRefUpdates=false repo && ( cd repo && test_commit A && @@ -91,7 +91,7 @@ test_expect_success 'JGit repository can be read by CGit' ' test_expect_success 'mixed writes from JGit and CGit' ' test_when_finished "rm -rf repo" && - git init repo && + git init --config core.logAllRefUpdates=false repo && ( cd repo && diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index eb1691860da..41a9f27706d 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -1865,6 +1865,17 @@ do git reflog exists refs/heads/symref ' + test_expect_success "stdin $type symref-create create dangling symref with reflog" ' + test_when_finished "git symbolic-ref -d refs/heads/dangling" && + format_command $type "symref-create refs/heads/dangling" "refs/heads/nonexistant" >stdin && + git update-ref --create-reflog --stdin $type --no-deref expect && + echo refs/heads/nonexistant >actual && + test_cmp expect actual && + test-tool ref-store main for-each-reflog-ent refs/heads/dangling >actual && + grep "$(git rev-parse $Z) $(git rev-parse $Z)" actual + ' + test_expect_success "stdin $type symref-update fails with too many arguments" ' format_command $type "symref-update refs/heads/symref" "$a" "ref" "$a" "$a" >stdin && test_must_fail git update-ref --stdin $type --no-deref err && diff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh index a6bcd62ab65..99a149bae4c 100755 --- a/t/t1405-main-ref-store.sh +++ b/t/t1405-main-ref-store.sh @@ -79,14 +79,14 @@ test_expect_success 'for_each_reflog()' ' test_expect_success 'for_each_reflog_ent()' ' $RUN for-each-reflog-ent HEAD >actual && - head -n1 actual | grep one && + head -n2 actual | grep one && tail -n1 actual | grep recreate-main ' test_expect_success 'for_each_reflog_ent_reverse()' ' $RUN for-each-reflog-ent-reverse HEAD >actual && head -n1 actual | grep recreate-main && - tail -n1 actual | grep one + tail -n2 actual | grep one ' test_expect_success 'reflog_exists(HEAD)' ' diff --git a/t/t1406-submodule-ref-store.sh b/t/t1406-submodule-ref-store.sh index c01f0f14a12..1f5793d3e13 100755 --- a/t/t1406-submodule-ref-store.sh +++ b/t/t1406-submodule-ref-store.sh @@ -74,14 +74,14 @@ test_expect_success 'for_each_reflog()' ' test_expect_success 'for_each_reflog_ent()' ' $RUN for-each-reflog-ent HEAD >actual && - head -n1 actual | grep first && + head -n2 actual | grep first && tail -n1 actual | grep main.to.new ' test_expect_success 'for_each_reflog_ent_reverse()' ' $RUN for-each-reflog-ent-reverse HEAD >actual && head -n1 actual | grep main.to.new && - tail -n1 actual | grep first + tail -n2 actual | grep first ' test_expect_success 'reflog_exists(HEAD)' ' diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index 246a3f46aba..9abaa22b719 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -381,9 +381,9 @@ test_expect_success 'continue walking past root commits' ' cd orphanage && cat >expect <<-\EOF && HEAD@{0} commit (initial): orphan2-1 - HEAD@{1} commit: orphan1-2 - HEAD@{2} commit (initial): orphan1-1 - HEAD@{3} commit (initial): initial + HEAD@{2} commit: orphan1-2 + HEAD@{3} commit (initial): orphan1-1 + HEAD@{5} commit (initial): initial EOF test_commit initial && git checkout --orphan orphan1 && @@ -449,8 +449,11 @@ test_expect_success 'list reflogs' ' git init repo && ( cd repo && + cat >expect <<-EOF && + HEAD + EOF git reflog list >actual && - test_must_be_empty actual && + test_cmp expect actual && test_commit A && cat >expect <<-EOF && diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 280cbf3e031..3db717e6643 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -774,10 +774,9 @@ test_expect_success 'fsck --connectivity-only with explicit head' ' test_expect_success 'fsck --name-objects' ' rm -rf name-objects && - git init name-objects && + git init --config core.logAllRefUpdates=false name-objects && ( cd name-objects && - git config core.logAllRefUpdates false && test_commit julius caesar.t && test_commit augustus44 && test_commit caesar && diff --git a/t/t5312-prune-corruption.sh b/t/t5312-prune-corruption.sh index d8d2e304687..1345eebbdef 100755 --- a/t/t5312-prune-corruption.sh +++ b/t/t5312-prune-corruption.sh @@ -17,8 +17,9 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh -test_expect_success 'disable reflogs' ' - git config core.logallrefupdates false && +test_expect_success 'setup repo and disable reflogs' ' + git init --config core.logallrefupdates=false repo && + cd repo && git reflog expire --expire=all --all ' -- GitLab