Git fork

hash: stop depending on `the_repository` in `null_oid()`

The `null_oid()` function returns the object ID that only consists of
zeroes. Naturally, this ID also depends on the hash algorithm used, as
the number of zeroes is different between SHA1 and SHA256. Consequently,
the function returns the hash-algorithm-specific null object ID.

This is currently done by depending on `the_hash_algo`, which implicitly
makes us depend on `the_repository`. Refactor the function to instead
pass in the hash algorithm for which we want to retrieve the null object
ID. Adapt callsites accordingly by passing in `the_repository`, thus
bubbling up the dependency on that global variable by one layer.

There are a couple of trivial exceptions for subsystems that already got
rid of `the_repository`. These subsystems instead use the repository
that is available via the calling context:

- "builtin/grep.c"
- "grep.c"
- "refs/debug.c"

There are also two non-trivial exceptions:

- "diff-no-index.c": Here we know that we may not have a repository
initialized at all, so we cannot rely on `the_repository`. Instead,
we adapt `diff_no_index()` to get a `struct git_hash_algo` as
parameter. The only caller is located in "builtin/diff.c", where we
know to call `repo_set_hash_algo()` in case we're running outside of
a Git repository. Consequently, it is fine to continue passing
`the_repository->hash_algo` even in this case.

- "builtin/ls-files.c": There is an in-flight patch series that drops
`USE_THE_REPOSITORY_VARIABLE` in this file, which causes a semantic
conflict because we use `null_oid()` in `show_submodule()`. The
value is passed to `repo_submodule_init()`, which may use the object
ID to resolve a tree-ish in the superproject from which we want to
read the submodule config. As such, the object ID should refer to an
object in the superproject, and consequently we need to use its hash
algorithm.

This means that we could in theory just not bother about this edge
case at all and just use `the_repository` in "diff-no-index.c". But
doing so would feel misdesigned.

Remove the `USE_THE_REPOSITORY_VARIABLE` preprocessor define in
"hash.c".

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
7d70b29c 8ca9fa60

+136 -136
+1 -1
archive.c
··· 312 struct object_id fake_oid; 313 int i; 314 315 - oidcpy(&fake_oid, null_oid()); 316 317 if (args->baselen > 0 && args->base[args->baselen - 1] == '/') { 318 size_t len = args->baselen;
··· 312 struct object_id fake_oid; 313 int i; 314 315 + oidcpy(&fake_oid, null_oid(the_hash_algo)); 316 317 if (args->baselen > 0 && args->base[args->baselen - 1] == '/') { 318 size_t len = args->baselen;
+1 -1
blame.c
··· 255 switch (st.st_mode & S_IFMT) { 256 case S_IFREG: 257 if (opt->flags.allow_textconv && 258 - textconv_object(r, read_from, mode, null_oid(), 0, &buf_ptr, &buf_len)) 259 strbuf_attach(&buf, buf_ptr, buf_len, buf_len + 1); 260 else if (strbuf_read_file(&buf, read_from, st.st_size) != st.st_size) 261 die_errno("cannot open or read '%s'", read_from);
··· 255 switch (st.st_mode & S_IFMT) { 256 case S_IFREG: 257 if (opt->flags.allow_textconv && 258 + textconv_object(r, read_from, mode, null_oid(the_hash_algo), 0, &buf_ptr, &buf_len)) 259 strbuf_attach(&buf, buf_ptr, buf_len, buf_len + 1); 260 else if (strbuf_read_file(&buf, read_from, st.st_size) != st.st_size) 261 die_errno("cannot open or read '%s'", read_from);
+1 -1
branch.c
··· 633 0, &err); 634 if (!transaction || 635 ref_transaction_update(transaction, ref.buf, 636 - &oid, forcing ? NULL : null_oid(), 637 NULL, NULL, flags, msg, &err) || 638 ref_transaction_commit(transaction, &err)) 639 die("%s", err.buf);
··· 633 0, &err); 634 if (!transaction || 635 ref_transaction_update(transaction, ref.buf, 636 + &oid, forcing ? NULL : null_oid(the_hash_algo), 637 NULL, NULL, flags, msg, &err) || 638 ref_transaction_commit(transaction, &err)) 639 die("%s", err.buf);
+3 -3
builtin/checkout.c
··· 130 int changed) 131 { 132 return run_hooks_l(the_repository, "post-checkout", 133 - oid_to_hex(old_commit ? &old_commit->object.oid : null_oid()), 134 - oid_to_hex(new_commit ? &new_commit->object.oid : null_oid()), 135 changed ? "1" : "0", NULL); 136 /* "new_commit" can be NULL when checking out from the index before 137 a commit exists. */ ··· 710 opts.src_index = the_repository->index; 711 opts.dst_index = the_repository->index; 712 init_checkout_metadata(&opts.meta, info->refname, 713 - info->commit ? &info->commit->object.oid : null_oid(), 714 NULL); 715 if (parse_tree(tree) < 0) 716 return 128;
··· 130 int changed) 131 { 132 return run_hooks_l(the_repository, "post-checkout", 133 + oid_to_hex(old_commit ? &old_commit->object.oid : null_oid(the_hash_algo)), 134 + oid_to_hex(new_commit ? &new_commit->object.oid : null_oid(the_hash_algo)), 135 changed ? "1" : "0", NULL); 136 /* "new_commit" can be NULL when checking out from the index before 137 a commit exists. */ ··· 710 opts.src_index = the_repository->index; 711 opts.dst_index = the_repository->index; 712 init_checkout_metadata(&opts.meta, info->refname, 713 + info->commit ? &info->commit->object.oid : null_oid(the_hash_algo), 714 NULL); 715 if (parse_tree(tree) < 0) 716 return 128;
+1 -1
builtin/clone.c
··· 690 if (write_locked_index(the_repository->index, &lock_file, COMMIT_LOCK)) 691 die(_("unable to write new index file")); 692 693 - err |= run_hooks_l(the_repository, "post-checkout", oid_to_hex(null_oid()), 694 oid_to_hex(&oid), "1", NULL); 695 696 if (!err && (option_recurse_submodules.nr > 0)) {
··· 690 if (write_locked_index(the_repository->index, &lock_file, COMMIT_LOCK)) 691 die(_("unable to write new index file")); 692 693 + err |= run_hooks_l(the_repository, "post-checkout", oid_to_hex(null_oid(the_hash_algo)), 694 oid_to_hex(&oid), "1", NULL); 695 696 if (!err && (option_recurse_submodules.nr > 0)) {
+1 -1
builtin/describe.c
··· 518 { 519 struct rev_info revs; 520 struct strvec args = STRVEC_INIT; 521 - struct process_commit_data pcd = { *null_oid(), oid, dst, &revs}; 522 523 strvec_pushl(&args, "internal: The first arg is not parsed", 524 "--objects", "--in-commit-order", "--reverse", "HEAD",
··· 518 { 519 struct rev_info revs; 520 struct strvec args = STRVEC_INIT; 521 + struct process_commit_data pcd = { *null_oid(the_hash_algo), oid, dst, &revs}; 522 523 strvec_pushl(&args, "internal: The first arg is not parsed", 524 "--objects", "--in-commit-order", "--reverse", "HEAD",
+3 -2
builtin/diff.c
··· 104 105 stuff_change(&revs->diffopt, 106 blob[0]->mode, canon_mode(st.st_mode), 107 - &blob[0]->item->oid, null_oid(), 108 1, 0, 109 blob[0]->path ? blob[0]->path : path, 110 path); ··· 498 499 /* If this is a no-index diff, just run it and exit there. */ 500 if (no_index) 501 - exit(diff_no_index(&rev, no_index == DIFF_NO_INDEX_IMPLICIT, 502 argc, argv)); 503 504
··· 104 105 stuff_change(&revs->diffopt, 106 blob[0]->mode, canon_mode(st.st_mode), 107 + &blob[0]->item->oid, null_oid(the_hash_algo), 108 1, 0, 109 blob[0]->path ? blob[0]->path : path, 110 path); ··· 498 499 /* If this is a no-index diff, just run it and exit there. */ 500 if (no_index) 501 + exit(diff_no_index(&rev, the_repository->hash_algo, 502 + no_index == DIFF_NO_INDEX_IMPLICIT, 503 argc, argv)); 504 505
+5 -5
builtin/fast-export.c
··· 869 p = rewrite_commit((struct commit *)tagged); 870 if (!p) { 871 printf("reset %s\nfrom %s\n\n", 872 - name, oid_to_hex(null_oid())); 873 free(buf); 874 return; 875 } ··· 883 884 if (tagged->type == OBJ_TAG) { 885 printf("reset %s\nfrom %s\n\n", 886 - name, oid_to_hex(null_oid())); 887 } 888 skip_prefix(name, "refs/tags/", &name); 889 printf("tag %s\n", name); ··· 1023 * it. 1024 */ 1025 printf("reset %s\nfrom %s\n\n", 1026 - name, oid_to_hex(null_oid())); 1027 continue; 1028 } 1029 ··· 1042 if (!reference_excluded_commits) { 1043 /* delete the ref */ 1044 printf("reset %s\nfrom %s\n\n", 1045 - name, oid_to_hex(null_oid())); 1046 continue; 1047 } 1048 /* set ref to commit using oid, not mark */ ··· 1153 continue; 1154 1155 printf("reset %s\nfrom %s\n\n", 1156 - refspec->dst, oid_to_hex(null_oid())); 1157 } 1158 } 1159
··· 869 p = rewrite_commit((struct commit *)tagged); 870 if (!p) { 871 printf("reset %s\nfrom %s\n\n", 872 + name, oid_to_hex(null_oid(the_hash_algo))); 873 free(buf); 874 return; 875 } ··· 883 884 if (tagged->type == OBJ_TAG) { 885 printf("reset %s\nfrom %s\n\n", 886 + name, oid_to_hex(null_oid(the_hash_algo))); 887 } 888 skip_prefix(name, "refs/tags/", &name); 889 printf("tag %s\n", name); ··· 1023 * it. 1024 */ 1025 printf("reset %s\nfrom %s\n\n", 1026 + name, oid_to_hex(null_oid(the_hash_algo))); 1027 continue; 1028 } 1029 ··· 1042 if (!reference_excluded_commits) { 1043 /* delete the ref */ 1044 printf("reset %s\nfrom %s\n\n", 1045 + name, oid_to_hex(null_oid(the_hash_algo))); 1046 continue; 1047 } 1048 /* set ref to commit using oid, not mark */ ··· 1153 continue; 1154 1155 printf("reset %s\nfrom %s\n\n", 1156 + refspec->dst, oid_to_hex(null_oid(the_hash_algo))); 1157 } 1158 } 1159
+1 -1
builtin/fsck.c
··· 625 void *contents = NULL; 626 int eaten; 627 struct object_info oi = OBJECT_INFO_INIT; 628 - struct object_id real_oid = *null_oid(); 629 int err = 0; 630 631 strbuf_reset(&cb_data->obj_type);
··· 625 void *contents = NULL; 626 int eaten; 627 struct object_info oi = OBJECT_INFO_INIT; 628 + struct object_id real_oid = *null_oid(the_hash_algo); 629 int err = 0; 630 631 strbuf_reset(&cb_data->obj_type);
+1 -1
builtin/grep.c
··· 453 return 0; 454 455 subrepo = xmalloc(sizeof(*subrepo)); 456 - if (repo_submodule_init(subrepo, superproject, path, null_oid())) { 457 free(subrepo); 458 return 0; 459 }
··· 453 return 0; 454 455 subrepo = xmalloc(sizeof(*subrepo)); 456 + if (repo_submodule_init(subrepo, superproject, path, null_oid(opt->repo->hash_algo))) { 457 free(subrepo); 458 return 0; 459 }
+2 -1
builtin/ls-files.c
··· 234 { 235 struct repository subrepo; 236 237 - if (repo_submodule_init(&subrepo, superproject, path, null_oid())) 238 return; 239 240 if (repo_read_index(&subrepo) < 0)
··· 234 { 235 struct repository subrepo; 236 237 + if (repo_submodule_init(&subrepo, superproject, path, 238 + null_oid(superproject->hash_algo))) 239 return; 240 241 if (repo_read_index(&subrepo) < 0)
+1 -1
builtin/rebase.c
··· 925 options->orig_head, &merge_bases) < 0) 926 exit(128); 927 if (!merge_bases || merge_bases->next) 928 - oidcpy(branch_base, null_oid()); 929 else 930 oidcpy(branch_base, &merge_bases->item->object.oid); 931
··· 925 options->orig_head, &merge_bases) < 0) 926 exit(128); 927 if (!merge_bases || merge_bases->next) 928 + oidcpy(branch_base, null_oid(the_hash_algo)); 929 else 930 oidcpy(branch_base, &merge_bases->item->object.oid); 931
+1 -1
builtin/receive-pack.c
··· 363 strvec_clear(&excludes_vector); 364 365 if (!sent_capabilities) 366 - show_ref("capabilities^{}", null_oid()); 367 368 advertise_shallow_grafts(1); 369
··· 363 strvec_clear(&excludes_vector); 364 365 if (!sent_capabilities) 366 + show_ref("capabilities^{}", null_oid(the_hash_algo)); 367 368 advertise_shallow_grafts(1); 369
+18 -18
builtin/submodule--helper.c
··· 78 int ret; 79 80 if (repo_submodule_init(&subrepo, the_repository, module_path, 81 - null_oid()) < 0) 82 return die_message(_("could not get a repository handle for submodule '%s'"), 83 module_path); 84 ret = repo_get_default_remote(&subrepo, default_remote); ··· 308 displaypath = get_submodule_displaypath(path, info->prefix, 309 info->super_prefix); 310 311 - sub = submodule_from_path(the_repository, null_oid(), path); 312 313 if (!sub) 314 die(_("No url found for submodule path '%s' in .gitmodules"), ··· 468 469 displaypath = get_submodule_displaypath(path, prefix, super_prefix); 470 471 - sub = submodule_from_path(the_repository, null_oid(), path); 472 473 if (!sub) 474 die(_("No url found for submodule path '%s' in .gitmodules"), ··· 645 if (validate_submodule_path(path) < 0) 646 exit(128); 647 648 - if (!submodule_from_path(the_repository, null_oid(), path)) 649 die(_("no submodule mapping found in .gitmodules for path '%s'"), 650 path); 651 652 displaypath = get_submodule_displaypath(path, prefix, super_prefix); 653 654 if ((CE_STAGEMASK & ce_flags) >> CE_STAGESHIFT) { 655 - print_status(flags, 'U', path, null_oid(), displaypath); 656 goto cleanup; 657 } 658 ··· 912 struct strbuf errmsg = STRBUF_INIT; 913 int total_commits = -1; 914 915 - if (!info->cached && oideq(&p->oid_dst, null_oid())) { 916 if (S_ISGITLINK(p->mod_dst)) { 917 struct ref_store *refs = repo_get_submodule_ref_store(the_repository, 918 p->sm_path); ··· 1051 1052 if (info->for_status && p->status != 'A' && 1053 (sub = submodule_from_path(the_repository, 1054 - null_oid(), p->sm_path))) { 1055 char *config_key = NULL; 1056 const char *value; 1057 int ignore_all = 0; ··· 1259 if (validate_submodule_path(path) < 0) 1260 exit(128); 1261 1262 - sub = submodule_from_path(the_repository, null_oid(), path); 1263 1264 if (sub && sub->url) { 1265 if (starts_with_dot_dot_slash(sub->url) || ··· 1404 if (validate_submodule_path(path) < 0) 1405 exit(128); 1406 1407 - sub = submodule_from_path(the_repository, null_oid(), path); 1408 1409 if (!sub || !sub->name) 1410 goto cleanup; ··· 1929 enum submodule_update_type update, 1930 struct submodule_update_strategy *out) 1931 { 1932 - const struct submodule *sub = submodule_from_path(r, null_oid(), path); 1933 char *key; 1934 const char *val; 1935 int ret; ··· 2089 goto cleanup; 2090 } 2091 2092 - sub = submodule_from_path(the_repository, null_oid(), ce->name); 2093 2094 if (!sub) { 2095 next_submodule_warn_missing(suc, out, displaypath); ··· 2485 char *key; 2486 *branch = NULL; 2487 2488 - sub = submodule_from_path(the_repository, null_oid(), path); 2489 if (!sub) 2490 return die_message(_("could not initialize submodule at path '%s'"), 2491 path); ··· 2531 const char *cw; 2532 struct repository subrepo; 2533 2534 - if (repo_submodule_init(&subrepo, the_repository, path, null_oid())) 2535 return die_message(_("could not get a repository handle for submodule '%s'"), 2536 path); 2537 ··· 2644 return ret; 2645 2646 if (update_data->just_cloned) 2647 - oidcpy(&update_data->suboid, null_oid()); 2648 else if (repo_resolve_gitlink_ref(the_repository, update_data->sm_path, 2649 "HEAD", &update_data->suboid)) 2650 return die_message(_("Unable to find current revision in submodule path '%s'"), ··· 2697 struct update_data next = *update_data; 2698 2699 next.prefix = NULL; 2700 - oidcpy(&next.oid, null_oid()); 2701 - oidcpy(&next.suboid, null_oid()); 2702 2703 cp.dir = update_data->sm_path; 2704 cp.git_cmd = 1; ··· 3057 if (argc != 2 || !(path = argv[0]) || !(newurl = argv[1])) 3058 usage_with_options(usage, options); 3059 3060 - sub = submodule_from_path(the_repository, null_oid(), path); 3061 3062 if (!sub) 3063 die(_("no submodule mapping found in .gitmodules for path '%s'"), ··· 3113 if (argc != 1 || !(path = argv[0])) 3114 usage_with_options(usage, options); 3115 3116 - sub = submodule_from_path(the_repository, null_oid(), path); 3117 3118 if (!sub) 3119 die(_("no submodule mapping found in .gitmodules for path '%s'"),
··· 78 int ret; 79 80 if (repo_submodule_init(&subrepo, the_repository, module_path, 81 + null_oid(the_hash_algo)) < 0) 82 return die_message(_("could not get a repository handle for submodule '%s'"), 83 module_path); 84 ret = repo_get_default_remote(&subrepo, default_remote); ··· 308 displaypath = get_submodule_displaypath(path, info->prefix, 309 info->super_prefix); 310 311 + sub = submodule_from_path(the_repository, null_oid(the_hash_algo), path); 312 313 if (!sub) 314 die(_("No url found for submodule path '%s' in .gitmodules"), ··· 468 469 displaypath = get_submodule_displaypath(path, prefix, super_prefix); 470 471 + sub = submodule_from_path(the_repository, null_oid(the_hash_algo), path); 472 473 if (!sub) 474 die(_("No url found for submodule path '%s' in .gitmodules"), ··· 645 if (validate_submodule_path(path) < 0) 646 exit(128); 647 648 + if (!submodule_from_path(the_repository, null_oid(the_hash_algo), path)) 649 die(_("no submodule mapping found in .gitmodules for path '%s'"), 650 path); 651 652 displaypath = get_submodule_displaypath(path, prefix, super_prefix); 653 654 if ((CE_STAGEMASK & ce_flags) >> CE_STAGESHIFT) { 655 + print_status(flags, 'U', path, null_oid(the_hash_algo), displaypath); 656 goto cleanup; 657 } 658 ··· 912 struct strbuf errmsg = STRBUF_INIT; 913 int total_commits = -1; 914 915 + if (!info->cached && oideq(&p->oid_dst, null_oid(the_hash_algo))) { 916 if (S_ISGITLINK(p->mod_dst)) { 917 struct ref_store *refs = repo_get_submodule_ref_store(the_repository, 918 p->sm_path); ··· 1051 1052 if (info->for_status && p->status != 'A' && 1053 (sub = submodule_from_path(the_repository, 1054 + null_oid(the_hash_algo), p->sm_path))) { 1055 char *config_key = NULL; 1056 const char *value; 1057 int ignore_all = 0; ··· 1259 if (validate_submodule_path(path) < 0) 1260 exit(128); 1261 1262 + sub = submodule_from_path(the_repository, null_oid(the_hash_algo), path); 1263 1264 if (sub && sub->url) { 1265 if (starts_with_dot_dot_slash(sub->url) || ··· 1404 if (validate_submodule_path(path) < 0) 1405 exit(128); 1406 1407 + sub = submodule_from_path(the_repository, null_oid(the_hash_algo), path); 1408 1409 if (!sub || !sub->name) 1410 goto cleanup; ··· 1929 enum submodule_update_type update, 1930 struct submodule_update_strategy *out) 1931 { 1932 + const struct submodule *sub = submodule_from_path(r, null_oid(the_hash_algo), path); 1933 char *key; 1934 const char *val; 1935 int ret; ··· 2089 goto cleanup; 2090 } 2091 2092 + sub = submodule_from_path(the_repository, null_oid(the_hash_algo), ce->name); 2093 2094 if (!sub) { 2095 next_submodule_warn_missing(suc, out, displaypath); ··· 2485 char *key; 2486 *branch = NULL; 2487 2488 + sub = submodule_from_path(the_repository, null_oid(the_hash_algo), path); 2489 if (!sub) 2490 return die_message(_("could not initialize submodule at path '%s'"), 2491 path); ··· 2531 const char *cw; 2532 struct repository subrepo; 2533 2534 + if (repo_submodule_init(&subrepo, the_repository, path, null_oid(the_hash_algo))) 2535 return die_message(_("could not get a repository handle for submodule '%s'"), 2536 path); 2537 ··· 2644 return ret; 2645 2646 if (update_data->just_cloned) 2647 + oidcpy(&update_data->suboid, null_oid(the_hash_algo)); 2648 else if (repo_resolve_gitlink_ref(the_repository, update_data->sm_path, 2649 "HEAD", &update_data->suboid)) 2650 return die_message(_("Unable to find current revision in submodule path '%s'"), ··· 2697 struct update_data next = *update_data; 2698 2699 next.prefix = NULL; 2700 + oidcpy(&next.oid, null_oid(the_hash_algo)); 2701 + oidcpy(&next.suboid, null_oid(the_hash_algo)); 2702 2703 cp.dir = update_data->sm_path; 2704 cp.git_cmd = 1; ··· 3057 if (argc != 2 || !(path = argv[0]) || !(newurl = argv[1])) 3058 usage_with_options(usage, options); 3059 3060 + sub = submodule_from_path(the_repository, null_oid(the_hash_algo), path); 3061 3062 if (!sub) 3063 die(_("no submodule mapping found in .gitmodules for path '%s'"), ··· 3113 if (argc != 1 || !(path = argv[0])) 3114 usage_with_options(usage, options); 3115 3116 + sub = submodule_from_path(the_repository, null_oid(the_hash_algo), path); 3117 3118 if (!sub) 3119 die(_("no submodule mapping found in .gitmodules for path '%s'"),
+1 -1
builtin/unpack-objects.c
··· 505 * has not been resolved yet. 506 */ 507 oidclr(&obj_list[nr].oid, the_repository->hash_algo); 508 - add_delta_to_list(nr, null_oid(), base_offset, 509 delta_data, delta_size); 510 return; 511 }
··· 505 * has not been resolved yet. 506 */ 507 oidclr(&obj_list[nr].oid, the_repository->hash_algo); 508 + add_delta_to_list(nr, null_oid(the_hash_algo), base_offset, 509 delta_data, delta_size); 510 return; 511 }
+1 -1
builtin/update-ref.c
··· 500 */ 501 old_target = parse_next_refname(&next); 502 if (!old_target) 503 - oidcpy(&old_oid, null_oid()); 504 505 if (*next != line_termination) 506 die("symref-verify %s: extra input: %s", refname, next);
··· 500 */ 501 old_target = parse_next_refname(&next); 502 if (!old_target) 503 + oidcpy(&old_oid, null_oid(the_hash_algo)); 504 505 if (*next != line_termination) 506 die("symref-verify %s: extra input: %s", refname, next);
+1 -1
builtin/worktree.c
··· 578 579 strvec_pushl(&opt.env, "GIT_DIR", "GIT_WORK_TREE", NULL); 580 strvec_pushl(&opt.args, 581 - oid_to_hex(null_oid()), 582 oid_to_hex(&commit->object.oid), 583 "1", 584 NULL);
··· 578 579 strvec_pushl(&opt.env, "GIT_DIR", "GIT_WORK_TREE", NULL); 580 strvec_pushl(&opt.args, 581 + oid_to_hex(null_oid(the_hash_algo)), 582 oid_to_hex(&commit->object.oid), 583 "1", 584 NULL);
+1 -1
combine-diff.c
··· 1066 &result_size, NULL, NULL); 1067 } else if (textconv) { 1068 struct diff_filespec *df = alloc_filespec(elem->path); 1069 - fill_filespec(df, null_oid(), 0, st.st_mode); 1070 result_size = fill_textconv(opt->repo, textconv, df, &result); 1071 free_filespec(df); 1072 } else if (0 <= (fd = open(elem->path, O_RDONLY))) {
··· 1066 &result_size, NULL, NULL); 1067 } else if (textconv) { 1068 struct diff_filespec *df = alloc_filespec(elem->path); 1069 + fill_filespec(df, null_oid(the_hash_algo), 0, st.st_mode); 1070 result_size = fill_textconv(opt->repo, textconv, df, &result); 1071 free_filespec(df); 1072 } else if (0 <= (fd = open(elem->path, O_RDONLY))) {
+5 -5
diff-lib.c
··· 172 * these from (stage - 2). 173 */ 174 dpath = combine_diff_path_new(ce->name, ce_namelen(ce), 175 - wt_mode, null_oid(), 2); 176 177 while (i < entries) { 178 struct cache_entry *nce = istate->cache[i]; ··· 257 ce_intent_to_add(ce)) { 258 newmode = ce_mode_from_stat(ce, st.st_mode); 259 diff_addremove(&revs->diffopt, '+', newmode, 260 - null_oid(), 0, ce->name, 0); 261 continue; 262 } 263 ··· 274 } 275 oldmode = ce->ce_mode; 276 old_oid = &ce->oid; 277 - new_oid = changed ? null_oid() : &ce->oid; 278 diff_change(&revs->diffopt, oldmode, newmode, 279 old_oid, new_oid, 280 !is_null_oid(old_oid), ··· 330 0, dirty_submodule); 331 if (changed) { 332 mode = ce_mode_from_stat(ce, st.st_mode); 333 - oid = null_oid(); 334 } 335 } 336 ··· 402 403 p = combine_diff_path_new(new_entry->name, 404 ce_namelen(new_entry), 405 - mode, null_oid(), 2); 406 p->parent[0].status = DIFF_STATUS_MODIFIED; 407 p->parent[0].mode = new_entry->ce_mode; 408 oidcpy(&p->parent[0].oid, &new_entry->oid);
··· 172 * these from (stage - 2). 173 */ 174 dpath = combine_diff_path_new(ce->name, ce_namelen(ce), 175 + wt_mode, null_oid(the_hash_algo), 2); 176 177 while (i < entries) { 178 struct cache_entry *nce = istate->cache[i]; ··· 257 ce_intent_to_add(ce)) { 258 newmode = ce_mode_from_stat(ce, st.st_mode); 259 diff_addremove(&revs->diffopt, '+', newmode, 260 + null_oid(the_hash_algo), 0, ce->name, 0); 261 continue; 262 } 263 ··· 274 } 275 oldmode = ce->ce_mode; 276 old_oid = &ce->oid; 277 + new_oid = changed ? null_oid(the_hash_algo) : &ce->oid; 278 diff_change(&revs->diffopt, oldmode, newmode, 279 old_oid, new_oid, 280 !is_null_oid(old_oid), ··· 330 0, dirty_submodule); 331 if (changed) { 332 mode = ce_mode_from_stat(ce, st.st_mode); 333 + oid = null_oid(the_hash_algo); 334 } 335 } 336 ··· 402 403 p = combine_diff_path_new(new_entry->name, 404 ce_namelen(new_entry), 405 + mode, null_oid(the_hash_algo), 2); 406 p->parent[0].status = DIFF_STATUS_MODIFIED; 407 p->parent[0].mode = new_entry->ce_mode; 408 oidcpy(&p->parent[0].oid, &new_entry->oid);
+14 -14
diff-no-index.c
··· 113 populate_common(s, &buf); 114 } 115 116 - static struct diff_filespec *noindex_filespec(const char *name, int mode, 117 enum special special) 118 { 119 struct diff_filespec *s; ··· 121 if (!name) 122 name = "/dev/null"; 123 s = alloc_filespec(name); 124 - fill_filespec(s, null_oid(), 0, mode); 125 if (special == SPECIAL_STDIN) 126 populate_from_stdin(s); 127 else if (special == SPECIAL_PIPE) ··· 129 return s; 130 } 131 132 - static int queue_diff(struct diff_options *o, 133 const char *name1, const char *name2, int recursing) 134 { 135 int mode1 = 0, mode2 = 0; ··· 145 146 if (S_ISDIR(mode1)) { 147 /* 2 is file that is created */ 148 - d1 = noindex_filespec(NULL, 0, SPECIAL_NONE); 149 - d2 = noindex_filespec(name2, mode2, special2); 150 name2 = NULL; 151 mode2 = 0; 152 } else { 153 /* 1 is file that is deleted */ 154 - d1 = noindex_filespec(name1, mode1, special1); 155 - d2 = noindex_filespec(NULL, 0, SPECIAL_NONE); 156 name1 = NULL; 157 mode1 = 0; 158 } ··· 217 n2 = buffer2.buf; 218 } 219 220 - ret = queue_diff(o, n1, n2, 1); 221 } 222 string_list_clear(&p1, 0); 223 string_list_clear(&p2, 0); ··· 234 SWAP(special1, special2); 235 } 236 237 - d1 = noindex_filespec(name1, mode1, special1); 238 - d2 = noindex_filespec(name2, mode2, special2); 239 diff_queue(&diff_queued_diff, d1, d2); 240 return 0; 241 } ··· 297 NULL 298 }; 299 300 - int diff_no_index(struct rev_info *revs, 301 - int implicit_no_index, 302 - int argc, const char **argv) 303 { 304 int i, no_index; 305 int ret = 1; ··· 354 setup_diff_pager(&revs->diffopt); 355 revs->diffopt.flags.exit_with_status = 1; 356 357 - if (queue_diff(&revs->diffopt, paths[0], paths[1], 0)) 358 goto out; 359 diff_set_mnemonic_prefix(&revs->diffopt, "1/", "2/"); 360 diffcore_std(&revs->diffopt);
··· 113 populate_common(s, &buf); 114 } 115 116 + static struct diff_filespec *noindex_filespec(const struct git_hash_algo *algop, 117 + const char *name, int mode, 118 enum special special) 119 { 120 struct diff_filespec *s; ··· 122 if (!name) 123 name = "/dev/null"; 124 s = alloc_filespec(name); 125 + fill_filespec(s, null_oid(algop), 0, mode); 126 if (special == SPECIAL_STDIN) 127 populate_from_stdin(s); 128 else if (special == SPECIAL_PIPE) ··· 130 return s; 131 } 132 133 + static int queue_diff(struct diff_options *o, const struct git_hash_algo *algop, 134 const char *name1, const char *name2, int recursing) 135 { 136 int mode1 = 0, mode2 = 0; ··· 146 147 if (S_ISDIR(mode1)) { 148 /* 2 is file that is created */ 149 + d1 = noindex_filespec(algop, NULL, 0, SPECIAL_NONE); 150 + d2 = noindex_filespec(algop, name2, mode2, special2); 151 name2 = NULL; 152 mode2 = 0; 153 } else { 154 /* 1 is file that is deleted */ 155 + d1 = noindex_filespec(algop, name1, mode1, special1); 156 + d2 = noindex_filespec(algop, NULL, 0, SPECIAL_NONE); 157 name1 = NULL; 158 mode1 = 0; 159 } ··· 218 n2 = buffer2.buf; 219 } 220 221 + ret = queue_diff(o, algop, n1, n2, 1); 222 } 223 string_list_clear(&p1, 0); 224 string_list_clear(&p2, 0); ··· 235 SWAP(special1, special2); 236 } 237 238 + d1 = noindex_filespec(algop, name1, mode1, special1); 239 + d2 = noindex_filespec(algop, name2, mode2, special2); 240 diff_queue(&diff_queued_diff, d1, d2); 241 return 0; 242 } ··· 298 NULL 299 }; 300 301 + int diff_no_index(struct rev_info *revs, const struct git_hash_algo *algop, 302 + int implicit_no_index, int argc, const char **argv) 303 { 304 int i, no_index; 305 int ret = 1; ··· 354 setup_diff_pager(&revs->diffopt); 355 revs->diffopt.flags.exit_with_status = 1; 356 357 + if (queue_diff(&revs->diffopt, algop, paths[0], paths[1], 0)) 358 goto out; 359 diff_set_mnemonic_prefix(&revs->diffopt, "1/", "2/"); 360 diffcore_std(&revs->diffopt);
+4 -4
diff.c
··· 4346 die_errno("readlink(%s)", one->path); 4347 prep_temp_blob(r->index, one->path, temp, sb.buf, sb.len, 4348 (one->oid_valid ? 4349 - &one->oid : null_oid()), 4350 (one->oid_valid ? 4351 one->mode : S_IFLNK)); 4352 strbuf_release(&sb); ··· 4355 /* we can borrow from the file in the work tree */ 4356 temp->name = one->path; 4357 if (!one->oid_valid) 4358 - oid_to_hex_r(temp->hex, null_oid()); 4359 else 4360 oid_to_hex_r(temp->hex, &one->oid); 4361 /* Even though we may sometimes borrow the ··· 6649 6650 one = alloc_filespec(e->key); 6651 two = alloc_filespec(e->key); 6652 - fill_filespec(one, null_oid(), 0, 0); 6653 - fill_filespec(two, null_oid(), 0, 0); 6654 p = diff_queue(q, one, two); 6655 p->status = DIFF_STATUS_MODIFIED; 6656 }
··· 4346 die_errno("readlink(%s)", one->path); 4347 prep_temp_blob(r->index, one->path, temp, sb.buf, sb.len, 4348 (one->oid_valid ? 4349 + &one->oid : null_oid(the_hash_algo)), 4350 (one->oid_valid ? 4351 one->mode : S_IFLNK)); 4352 strbuf_release(&sb); ··· 4355 /* we can borrow from the file in the work tree */ 4356 temp->name = one->path; 4357 if (!one->oid_valid) 4358 + oid_to_hex_r(temp->hex, null_oid(the_hash_algo)); 4359 else 4360 oid_to_hex_r(temp->hex, &one->oid); 4361 /* Even though we may sometimes borrow the ··· 6649 6650 one = alloc_filespec(e->key); 6651 two = alloc_filespec(e->key); 6652 + fill_filespec(one, null_oid(the_hash_algo), 0, 0); 6653 + fill_filespec(two, null_oid(the_hash_algo), 0, 0); 6654 p = diff_queue(q, one, two); 6655 p->status = DIFF_STATUS_MODIFIED; 6656 }
+1 -1
diff.h
··· 656 657 int diff_result_code(struct rev_info *); 658 659 - int diff_no_index(struct rev_info *, 660 int implicit_no_index, int, const char **); 661 662 int index_differs_from(struct repository *r, const char *def,
··· 656 657 int diff_result_code(struct rev_info *); 658 659 + int diff_no_index(struct rev_info *, const struct git_hash_algo *algop, 660 int implicit_no_index, int, const char **); 661 662 int index_differs_from(struct repository *r, const char *def,
+1 -1
dir.c
··· 4035 */ 4036 i++; 4037 4038 - sub = submodule_from_path(&subrepo, null_oid(), ce->name); 4039 if (!sub || !is_submodule_active(&subrepo, ce->name)) 4040 /* .gitmodules broken or inactive sub */ 4041 continue;
··· 4035 */ 4036 i++; 4037 4038 + sub = submodule_from_path(&subrepo, null_oid(the_hash_algo), ce->name); 4039 if (!sub || !is_submodule_active(&subrepo, ce->name)) 4040 /* .gitmodules broken or inactive sub */ 4041 continue;
+1 -1
grep.c
··· 1517 fill_filespec(df, gs->identifier, 1, 0100644); 1518 break; 1519 case GREP_SOURCE_FILE: 1520 - fill_filespec(df, null_oid(), 0, 0100644); 1521 break; 1522 default: 1523 BUG("attempt to textconv something without a path?");
··· 1517 fill_filespec(df, gs->identifier, 1, 0100644); 1518 break; 1519 case GREP_SOURCE_FILE: 1520 + fill_filespec(df, null_oid(r->hash_algo), 0, 0100644); 1521 break; 1522 default: 1523 BUG("attempt to textconv something without a path?");
+2 -4
hash.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 - 3 #include "git-compat-util.h" 4 #include "hash.h" 5 #include "hex.h" ··· 232 } 233 }; 234 235 - const struct object_id *null_oid(void) 236 { 237 - return the_hash_algo->null_oid; 238 } 239 240 const char *empty_tree_oid_hex(const struct git_hash_algo *algop)
··· 1 #include "git-compat-util.h" 2 #include "hash.h" 3 #include "hex.h" ··· 230 } 231 }; 232 233 + const struct object_id *null_oid(const struct git_hash_algo *algop) 234 { 235 + return algop->null_oid; 236 } 237 238 const char *empty_tree_oid_hex(const struct git_hash_algo *algop)
+1 -1
hash.h
··· 340 341 const struct git_hash_algo *unsafe_hash_algo(const struct git_hash_algo *algop); 342 343 - const struct object_id *null_oid(void); 344 345 static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop) 346 {
··· 340 341 const struct git_hash_algo *unsafe_hash_algo(const struct git_hash_algo *algop); 342 343 + const struct object_id *null_oid(const struct git_hash_algo *algop); 344 345 static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop) 346 {
+1 -1
log-tree.c
··· 499 { 500 struct strbuf headers = STRBUF_INIT; 501 const char *name = oid_to_hex(opt->zero_commit ? 502 - null_oid() : &commit->object.oid); 503 504 *need_8bit_cte_p = 0; /* unknown */ 505
··· 499 { 500 struct strbuf headers = STRBUF_INIT; 501 const char *name = oid_to_hex(opt->zero_commit ? 502 + null_oid(the_hash_algo) : &commit->object.oid); 503 504 *need_8bit_cte_p = 0; /* unknown */ 505
+13 -13
merge-ort.c
··· 1817 BUG("submodule deleted on one side; this should be handled outside of merge_submodule()"); 1818 1819 if ((sub_not_initialized = repo_submodule_init(&subrepo, 1820 - opt->repo, path, null_oid()))) { 1821 path_msg(opt, CONFLICT_SUBMODULE_NOT_INITIALIZED, 0, 1822 path, NULL, NULL, NULL, 1823 _("Failed to merge submodule %s (not checked out)"), ··· 2199 two_way = ((S_IFMT & o->mode) != (S_IFMT & a->mode)); 2200 2201 merge_status = merge_3way(opt, path, 2202 - two_way ? null_oid() : &o->oid, 2203 &a->oid, &b->oid, 2204 pathnames, extra_marker_size, 2205 &result_buf); ··· 2231 } else if (S_ISGITLINK(a->mode)) { 2232 int two_way = ((S_IFMT & o->mode) != (S_IFMT & a->mode)); 2233 clean = merge_submodule(opt, pathnames[0], 2234 - two_way ? null_oid() : &o->oid, 2235 &a->oid, &b->oid, &result->oid); 2236 if (clean < 0) 2237 return -1; ··· 2739 assert(!new_ci->match_mask); 2740 new_ci->dirmask = 0; 2741 new_ci->stages[1].mode = 0; 2742 - oidcpy(&new_ci->stages[1].oid, null_oid()); 2743 2744 /* 2745 * Now that we have the file information in new_ci, make sure ··· 2752 continue; 2753 /* zero out any entries related to files */ 2754 ci->stages[i].mode = 0; 2755 - oidcpy(&ci->stages[i].oid, null_oid()); 2756 } 2757 2758 /* Now we want to focus on new_ci, so reassign ci to it. */ ··· 3122 if (type_changed) { 3123 /* rename vs. typechange */ 3124 /* Mark the original as resolved by removal */ 3125 - memcpy(&oldinfo->stages[0].oid, null_oid(), 3126 sizeof(oldinfo->stages[0].oid)); 3127 oldinfo->stages[0].mode = 0; 3128 oldinfo->filemask &= 0x06; ··· 3994 if (ci->filemask & (1 << i)) 3995 continue; 3996 ci->stages[i].mode = 0; 3997 - oidcpy(&ci->stages[i].oid, null_oid()); 3998 } 3999 } else if (ci->df_conflict && ci->merged.result.mode != 0) { 4000 /* ··· 4041 continue; 4042 /* zero out any entries related to directories */ 4043 new_ci->stages[i].mode = 0; 4044 - oidcpy(&new_ci->stages[i].oid, null_oid()); 4045 } 4046 4047 /* ··· 4163 new_ci->merged.result.mode = ci->stages[2].mode; 4164 oidcpy(&new_ci->merged.result.oid, &ci->stages[2].oid); 4165 new_ci->stages[1].mode = 0; 4166 - oidcpy(&new_ci->stages[1].oid, null_oid()); 4167 new_ci->filemask = 5; 4168 if ((S_IFMT & b_mode) != (S_IFMT & o_mode)) { 4169 new_ci->stages[0].mode = 0; 4170 - oidcpy(&new_ci->stages[0].oid, null_oid()); 4171 new_ci->filemask = 4; 4172 } 4173 ··· 4175 ci->merged.result.mode = ci->stages[1].mode; 4176 oidcpy(&ci->merged.result.oid, &ci->stages[1].oid); 4177 ci->stages[2].mode = 0; 4178 - oidcpy(&ci->stages[2].oid, null_oid()); 4179 ci->filemask = 3; 4180 if ((S_IFMT & a_mode) != (S_IFMT & o_mode)) { 4181 ci->stages[0].mode = 0; 4182 - oidcpy(&ci->stages[0].oid, null_oid()); 4183 ci->filemask = 2; 4184 } 4185 ··· 4304 /* Deleted on both sides */ 4305 ci->merged.is_null = 1; 4306 ci->merged.result.mode = 0; 4307 - oidcpy(&ci->merged.result.oid, null_oid()); 4308 assert(!ci->df_conflict); 4309 ci->merged.clean = !ci->path_conflict; 4310 }
··· 1817 BUG("submodule deleted on one side; this should be handled outside of merge_submodule()"); 1818 1819 if ((sub_not_initialized = repo_submodule_init(&subrepo, 1820 + opt->repo, path, null_oid(the_hash_algo)))) { 1821 path_msg(opt, CONFLICT_SUBMODULE_NOT_INITIALIZED, 0, 1822 path, NULL, NULL, NULL, 1823 _("Failed to merge submodule %s (not checked out)"), ··· 2199 two_way = ((S_IFMT & o->mode) != (S_IFMT & a->mode)); 2200 2201 merge_status = merge_3way(opt, path, 2202 + two_way ? null_oid(the_hash_algo) : &o->oid, 2203 &a->oid, &b->oid, 2204 pathnames, extra_marker_size, 2205 &result_buf); ··· 2231 } else if (S_ISGITLINK(a->mode)) { 2232 int two_way = ((S_IFMT & o->mode) != (S_IFMT & a->mode)); 2233 clean = merge_submodule(opt, pathnames[0], 2234 + two_way ? null_oid(the_hash_algo) : &o->oid, 2235 &a->oid, &b->oid, &result->oid); 2236 if (clean < 0) 2237 return -1; ··· 2739 assert(!new_ci->match_mask); 2740 new_ci->dirmask = 0; 2741 new_ci->stages[1].mode = 0; 2742 + oidcpy(&new_ci->stages[1].oid, null_oid(the_hash_algo)); 2743 2744 /* 2745 * Now that we have the file information in new_ci, make sure ··· 2752 continue; 2753 /* zero out any entries related to files */ 2754 ci->stages[i].mode = 0; 2755 + oidcpy(&ci->stages[i].oid, null_oid(the_hash_algo)); 2756 } 2757 2758 /* Now we want to focus on new_ci, so reassign ci to it. */ ··· 3122 if (type_changed) { 3123 /* rename vs. typechange */ 3124 /* Mark the original as resolved by removal */ 3125 + memcpy(&oldinfo->stages[0].oid, null_oid(the_hash_algo), 3126 sizeof(oldinfo->stages[0].oid)); 3127 oldinfo->stages[0].mode = 0; 3128 oldinfo->filemask &= 0x06; ··· 3994 if (ci->filemask & (1 << i)) 3995 continue; 3996 ci->stages[i].mode = 0; 3997 + oidcpy(&ci->stages[i].oid, null_oid(the_hash_algo)); 3998 } 3999 } else if (ci->df_conflict && ci->merged.result.mode != 0) { 4000 /* ··· 4041 continue; 4042 /* zero out any entries related to directories */ 4043 new_ci->stages[i].mode = 0; 4044 + oidcpy(&new_ci->stages[i].oid, null_oid(the_hash_algo)); 4045 } 4046 4047 /* ··· 4163 new_ci->merged.result.mode = ci->stages[2].mode; 4164 oidcpy(&new_ci->merged.result.oid, &ci->stages[2].oid); 4165 new_ci->stages[1].mode = 0; 4166 + oidcpy(&new_ci->stages[1].oid, null_oid(the_hash_algo)); 4167 new_ci->filemask = 5; 4168 if ((S_IFMT & b_mode) != (S_IFMT & o_mode)) { 4169 new_ci->stages[0].mode = 0; 4170 + oidcpy(&new_ci->stages[0].oid, null_oid(the_hash_algo)); 4171 new_ci->filemask = 4; 4172 } 4173 ··· 4175 ci->merged.result.mode = ci->stages[1].mode; 4176 oidcpy(&ci->merged.result.oid, &ci->stages[1].oid); 4177 ci->stages[2].mode = 0; 4178 + oidcpy(&ci->stages[2].oid, null_oid(the_hash_algo)); 4179 ci->filemask = 3; 4180 if ((S_IFMT & a_mode) != (S_IFMT & o_mode)) { 4181 ci->stages[0].mode = 0; 4182 + oidcpy(&ci->stages[0].oid, null_oid(the_hash_algo)); 4183 ci->filemask = 2; 4184 } 4185 ··· 4304 /* Deleted on both sides */ 4305 ci->merged.is_null = 1; 4306 ci->merged.result.mode = 0; 4307 + oidcpy(&ci->merged.result.oid, null_oid(the_hash_algo)); 4308 assert(!ci->df_conflict); 4309 ci->merged.clean = !ci->path_conflict; 4310 }
+6 -6
merge-recursive.c
··· 502 503 ret = get_tree_entry(r, tree, path, &dfs->oid, &dfs->mode); 504 if (S_ISDIR(dfs->mode)) { 505 - oidcpy(&dfs->oid, null_oid()); 506 dfs->mode = 0; 507 } 508 return ret; ··· 1238 if (is_null_oid(b)) 1239 return 0; 1240 1241 - if (repo_submodule_init(&subrepo, opt->repo, path, null_oid())) { 1242 output(opt, 1, _("Failed to merge submodule %s (not checked out)"), path); 1243 return 0; 1244 } ··· 1698 1699 /* Store things in diff_filespecs for functions that need it */ 1700 null.path = (char *)collide_path; 1701 - oidcpy(&null.oid, null_oid()); 1702 null.mode = 0; 1703 1704 if (merge_mode_and_contents(opt, &null, a, b, collide_path, ··· 2897 dst_other.mode = ren1->dst_entry->stages[other_stage].mode; 2898 try_merge = 0; 2899 2900 - if (oideq(&src_other.oid, null_oid()) && 2901 ren1->dir_rename_original_type == 'A') { 2902 setup_rename_conflict_info(RENAME_VIA_DIR, 2903 opt, ren1, NULL); 2904 } else if (renamed_to_self) { 2905 setup_rename_conflict_info(RENAME_NORMAL, 2906 opt, ren1, NULL); 2907 - } else if (oideq(&src_other.oid, null_oid())) { 2908 setup_rename_conflict_info(RENAME_DELETE, 2909 opt, ren1, NULL); 2910 } else if ((dst_other.mode == ren1->pair->two->mode) && ··· 2923 1, /* update_cache */ 2924 0 /* update_wd */)) 2925 clean_merge = -1; 2926 - } else if (!oideq(&dst_other.oid, null_oid())) { 2927 /* 2928 * Probably not a clean merge, but it's 2929 * premature to set clean_merge to 0 here,
··· 502 503 ret = get_tree_entry(r, tree, path, &dfs->oid, &dfs->mode); 504 if (S_ISDIR(dfs->mode)) { 505 + oidcpy(&dfs->oid, null_oid(the_hash_algo)); 506 dfs->mode = 0; 507 } 508 return ret; ··· 1238 if (is_null_oid(b)) 1239 return 0; 1240 1241 + if (repo_submodule_init(&subrepo, opt->repo, path, null_oid(the_hash_algo))) { 1242 output(opt, 1, _("Failed to merge submodule %s (not checked out)"), path); 1243 return 0; 1244 } ··· 1698 1699 /* Store things in diff_filespecs for functions that need it */ 1700 null.path = (char *)collide_path; 1701 + oidcpy(&null.oid, null_oid(the_hash_algo)); 1702 null.mode = 0; 1703 1704 if (merge_mode_and_contents(opt, &null, a, b, collide_path, ··· 2897 dst_other.mode = ren1->dst_entry->stages[other_stage].mode; 2898 try_merge = 0; 2899 2900 + if (oideq(&src_other.oid, null_oid(the_hash_algo)) && 2901 ren1->dir_rename_original_type == 'A') { 2902 setup_rename_conflict_info(RENAME_VIA_DIR, 2903 opt, ren1, NULL); 2904 } else if (renamed_to_self) { 2905 setup_rename_conflict_info(RENAME_NORMAL, 2906 opt, ren1, NULL); 2907 + } else if (oideq(&src_other.oid, null_oid(the_hash_algo))) { 2908 setup_rename_conflict_info(RENAME_DELETE, 2909 opt, ren1, NULL); 2910 } else if ((dst_other.mode == ren1->pair->two->mode) && ··· 2923 1, /* update_cache */ 2924 0 /* update_wd */)) 2925 clean_merge = -1; 2926 + } else if (!oideq(&dst_other.oid, null_oid(the_hash_algo))) { 2927 /* 2928 * Probably not a clean merge, but it's 2929 * premature to set clean_merge to 0 here,
+1 -1
notes-merge.c
··· 617 if (repo_get_merge_bases(the_repository, local, remote, &bases) < 0) 618 exit(128); 619 if (!bases) { 620 - base_oid = null_oid(); 621 base_tree_oid = the_hash_algo->empty_tree; 622 if (o->verbosity >= 4) 623 printf("No merge base found; doing history-less merge\n");
··· 617 if (repo_get_merge_bases(the_repository, local, remote, &bases) < 0) 618 exit(128); 619 if (!bases) { 620 + base_oid = null_oid(the_hash_algo); 621 base_tree_oid = the_hash_algo->empty_tree; 622 if (o->verbosity >= 4) 623 printf("No merge base found; doing history-less merge\n");
+1 -1
notes.c
··· 1353 if (note) 1354 return add_note(t, to_obj, note, combine_notes); 1355 else if (existing_note) 1356 - return add_note(t, to_obj, null_oid(), combine_notes); 1357 1358 return 0; 1359 }
··· 1353 if (note) 1354 return add_note(t, to_obj, note, combine_notes); 1355 else if (existing_note) 1356 + return add_note(t, to_obj, null_oid(the_hash_algo), combine_notes); 1357 1358 return 0; 1359 }
+1 -1
object-file.c
··· 2405 2406 opts.strict = 1; 2407 opts.error_func = hash_format_check_report; 2408 - if (fsck_buffer(null_oid(), type, buf, size, &opts)) 2409 die(_("refusing to create malformed object")); 2410 fsck_finish(&opts); 2411 }
··· 2405 2406 opts.strict = 1; 2407 opts.error_func = hash_format_check_report; 2408 + if (fsck_buffer(null_oid(the_hash_algo), type, buf, size, &opts)) 2409 die(_("refusing to create malformed object")); 2410 fsck_finish(&opts); 2411 }
+1 -1
parse-options-cb.c
··· 145 struct object_id *target = opt->value; 146 147 if (unset) { 148 - oidcpy(target, null_oid()); 149 return 0; 150 } 151 if (!arg)
··· 145 struct object_id *target = opt->value; 146 147 if (unset) { 148 + oidcpy(target, null_oid(the_hash_algo)); 149 return 0; 150 } 151 if (!arg)
+1 -1
range-diff.c
··· 467 { 468 struct diff_filespec *spec = alloc_filespec(name); 469 470 - fill_filespec(spec, null_oid(), 0, 0100644); 471 spec->data = (char *)p; 472 spec->size = strlen(p); 473 spec->should_munmap = 0;
··· 467 { 468 struct diff_filespec *spec = alloc_filespec(name); 469 470 + fill_filespec(spec, null_oid(the_hash_algo), 0, 0100644); 471 spec->data = (char *)p; 472 spec->size = strlen(p); 473 spec->should_munmap = 0;
+1 -1
read-cache.c
··· 1735 end = (unsigned char *)hdr + size; 1736 start = end - the_hash_algo->rawsz; 1737 oidread(&oid, start, the_repository->hash_algo); 1738 - if (oideq(&oid, null_oid())) 1739 return 0; 1740 1741 the_hash_algo->init_fn(&c);
··· 1735 end = (unsigned char *)hdr + size; 1736 start = end - the_hash_algo->rawsz; 1737 oidread(&oid, start, the_repository->hash_algo); 1738 + if (oideq(&oid, null_oid(the_hash_algo))) 1739 return 0; 1740 1741 the_hash_algo->init_fn(&c);
+6 -6
refs.c
··· 1377 return 1; 1378 } 1379 return ref_transaction_update(transaction, refname, new_oid, 1380 - null_oid(), new_target, NULL, flags, 1381 msg, err); 1382 } 1383 ··· 1396 if (old_target && !(flags & REF_NO_DEREF)) 1397 BUG("delete cannot operate on symrefs with deref mode"); 1398 return ref_transaction_update(transaction, refname, 1399 - null_oid(), old_oid, 1400 NULL, old_target, flags, 1401 msg, err); 1402 } ··· 2160 subrepo = xmalloc(sizeof(*subrepo)); 2161 2162 if (repo_submodule_init(subrepo, repo, submodule, 2163 - null_oid())) { 2164 free(subrepo); 2165 goto done; 2166 } ··· 2345 strbuf_reset(&buf); 2346 2347 if (!(update->flags & REF_HAVE_OLD)) 2348 - strbuf_addf(&buf, "%s ", oid_to_hex(null_oid())); 2349 else if (update->old_target) 2350 strbuf_addf(&buf, "ref:%s ", update->old_target); 2351 else 2352 strbuf_addf(&buf, "%s ", oid_to_hex(&update->old_oid)); 2353 2354 if (!(update->flags & REF_HAVE_NEW)) 2355 - strbuf_addf(&buf, "%s ", oid_to_hex(null_oid())); 2356 else if (update->new_target) 2357 strbuf_addf(&buf, "ref:%s ", update->new_target); 2358 else ··· 2794 if (ret < 0) 2795 goto done; 2796 2797 - ret = ref_transaction_update(data->transaction, refname, NULL, null_oid(), 2798 symref_target.buf, NULL, 2799 REF_SKIP_CREATE_REFLOG | REF_NO_DEREF, NULL, data->errbuf); 2800 if (ret < 0)
··· 1377 return 1; 1378 } 1379 return ref_transaction_update(transaction, refname, new_oid, 1380 + null_oid(the_hash_algo), new_target, NULL, flags, 1381 msg, err); 1382 } 1383 ··· 1396 if (old_target && !(flags & REF_NO_DEREF)) 1397 BUG("delete cannot operate on symrefs with deref mode"); 1398 return ref_transaction_update(transaction, refname, 1399 + null_oid(the_hash_algo), old_oid, 1400 NULL, old_target, flags, 1401 msg, err); 1402 } ··· 2160 subrepo = xmalloc(sizeof(*subrepo)); 2161 2162 if (repo_submodule_init(subrepo, repo, submodule, 2163 + null_oid(the_hash_algo))) { 2164 free(subrepo); 2165 goto done; 2166 } ··· 2345 strbuf_reset(&buf); 2346 2347 if (!(update->flags & REF_HAVE_OLD)) 2348 + strbuf_addf(&buf, "%s ", oid_to_hex(null_oid(the_hash_algo))); 2349 else if (update->old_target) 2350 strbuf_addf(&buf, "ref:%s ", update->old_target); 2351 else 2352 strbuf_addf(&buf, "%s ", oid_to_hex(&update->old_oid)); 2353 2354 if (!(update->flags & REF_HAVE_NEW)) 2355 + strbuf_addf(&buf, "%s ", oid_to_hex(null_oid(the_hash_algo))); 2356 else if (update->new_target) 2357 strbuf_addf(&buf, "ref:%s ", update->new_target); 2358 else ··· 2794 if (ret < 0) 2795 goto done; 2796 2797 + ret = ref_transaction_update(data->transaction, refname, NULL, null_oid(the_hash_algo), 2798 symref_target.buf, NULL, 2799 REF_SKIP_CREATE_REFLOG | REF_NO_DEREF, NULL, data->errbuf); 2800 if (ret < 0)
+1 -1
refs/debug.c
··· 217 struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store; 218 int res = 0; 219 220 - oidcpy(oid, null_oid()); 221 res = drefs->refs->be->read_raw_ref(drefs->refs, refname, oid, referent, 222 type, failure_errno); 223
··· 217 struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store; 218 int res = 0; 219 220 + oidcpy(oid, null_oid(ref_store->repo->hash_algo)); 221 res = drefs->refs->be->read_raw_ref(drefs->refs, refname, oid, referent, 222 type, failure_errno); 223
+1 -1
refs/files-backend.c
··· 1270 ref_transaction_add_update( 1271 transaction, r->name, 1272 REF_NO_DEREF | REF_HAVE_NEW | REF_HAVE_OLD | REF_IS_PRUNING, 1273 - null_oid(), &r->oid, NULL, NULL, NULL, NULL); 1274 if (ref_transaction_commit(transaction, &err)) 1275 goto cleanup; 1276
··· 1270 ref_transaction_add_update( 1271 transaction, r->name, 1272 REF_NO_DEREF | REF_HAVE_NEW | REF_HAVE_OLD | REF_IS_PRUNING, 1273 + null_oid(the_hash_algo), &r->oid, NULL, NULL, NULL, NULL); 1274 if (ref_transaction_commit(transaction, &err)) 1275 goto cleanup; 1276
+1 -1
reset.c
··· 80 } 81 if (!ret && run_hook) 82 run_hooks_l(the_repository, "post-checkout", 83 - oid_to_hex(head ? head : null_oid()), 84 oid_to_hex(oid), "1", NULL); 85 strbuf_release(&msg); 86 return ret;
··· 80 } 81 if (!ret && run_hook) 82 run_hooks_l(the_repository, "post-checkout", 83 + oid_to_hex(head ? head : null_oid(the_hash_algo)), 84 oid_to_hex(oid), "1", NULL); 85 strbuf_release(&msg); 86 return ret;
+5 -5
sequencer.c
··· 265 266 CALLOC_ARRAY(rec, 1); 267 268 - oidcpy(&rec->before, null_oid()); 269 - oidcpy(&rec->after, null_oid()); 270 271 /* This may fail, but that's fine, we will keep the null OID. */ 272 refs_read_ref(get_main_ref_store(the_repository), ref, &rec->before); ··· 667 if (!transaction || 668 ref_transaction_update(transaction, "HEAD", 669 to, unborn && !is_rebase_i(opts) ? 670 - null_oid() : from, NULL, NULL, 671 0, sb.buf, &err) || 672 ref_transaction_commit(transaction, &err)) { 673 ref_transaction_free(transaction); ··· 1301 0, err); 1302 if (!transaction || 1303 ref_transaction_update(transaction, "HEAD", new_head, 1304 - old_head ? &old_head->object.oid : null_oid(), 1305 NULL, NULL, 0, sb.buf, err) || 1306 ref_transaction_commit(transaction, err)) { 1307 ret = -1; ··· 4683 write_file(path, "%s", oid_to_hex(&oid)); 4684 } else { 4685 refs_update_ref(get_main_ref_store(r), "", refname, 4686 - &oid, null_oid(), 0, UPDATE_REFS_DIE_ON_ERR); 4687 } 4688 4689 printf(_("Created autostash: %s\n"), buf.buf);
··· 265 266 CALLOC_ARRAY(rec, 1); 267 268 + oidcpy(&rec->before, null_oid(the_hash_algo)); 269 + oidcpy(&rec->after, null_oid(the_hash_algo)); 270 271 /* This may fail, but that's fine, we will keep the null OID. */ 272 refs_read_ref(get_main_ref_store(the_repository), ref, &rec->before); ··· 667 if (!transaction || 668 ref_transaction_update(transaction, "HEAD", 669 to, unborn && !is_rebase_i(opts) ? 670 + null_oid(the_hash_algo) : from, NULL, NULL, 671 0, sb.buf, &err) || 672 ref_transaction_commit(transaction, &err)) { 673 ref_transaction_free(transaction); ··· 1301 0, err); 1302 if (!transaction || 1303 ref_transaction_update(transaction, "HEAD", new_head, 1304 + old_head ? &old_head->object.oid : null_oid(the_hash_algo), 1305 NULL, NULL, 0, sb.buf, err) || 1306 ref_transaction_commit(transaction, err)) { 1307 ret = -1; ··· 4683 write_file(path, "%s", oid_to_hex(&oid)); 4684 } else { 4685 refs_update_ref(get_main_ref_store(r), "", refname, 4686 + &oid, null_oid(the_hash_algo), 0, UPDATE_REFS_DIE_ON_ERR); 4687 } 4688 4689 printf(_("Created autostash: %s\n"), buf.buf);
+1 -1
submodule-config.c
··· 831 832 parameter.cache = repo->submodule_cache; 833 parameter.treeish_name = NULL; 834 - parameter.gitmodules_oid = null_oid(); 835 parameter.overwrite = 1; 836 837 return parse_config(var, value, ctx, &parameter);
··· 831 832 parameter.cache = repo->submodule_cache; 833 parameter.treeish_name = NULL; 834 + parameter.gitmodules_oid = null_oid(the_hash_algo); 835 parameter.overwrite = 1; 836 837 return parse_config(var, value, ctx, &parameter);
+14 -14
submodule.c
··· 124 if (is_gitmodules_unmerged(the_repository->index)) 125 die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first")); 126 127 - submodule = submodule_from_path(the_repository, null_oid(), oldpath); 128 if (!submodule || !submodule->name) { 129 warning(_("Could not find section in .gitmodules where path=%s"), oldpath); 130 return -1; ··· 153 if (is_gitmodules_unmerged(the_repository->index)) 154 die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first")); 155 156 - submodule = submodule_from_path(the_repository, null_oid(), path); 157 if (!submodule || !submodule->name) { 158 warning(_("Could not find section in .gitmodules where path=%s"), path); 159 return -1; ··· 204 const char *path) 205 { 206 const struct submodule *submodule = submodule_from_path(the_repository, 207 - null_oid(), 208 path); 209 if (submodule) { 210 const char *ignore; ··· 312 313 int is_submodule_active(struct repository *repo, const char *path) 314 { 315 - return is_tree_submodule_active(repo, null_oid(), path); 316 } 317 318 int is_submodule_populated_gently(const char *path, int *return_error_code) ··· 778 if (!should_update_submodules()) 779 return NULL; 780 781 - return submodule_from_path(the_repository, null_oid(), ce->name); 782 } 783 784 ··· 1062 const char *path, 1063 struct oid_array *commits) 1064 { 1065 - if (!submodule_has_commits(r, path, null_oid(), commits)) 1066 /* 1067 * NOTE: We do consider it safe to return "no" here. The 1068 * correct answer would be "We do not know" instead of ··· 1126 const struct submodule *submodule; 1127 const char *path = NULL; 1128 1129 - submodule = submodule_from_name(r, null_oid(), name->string); 1130 if (submodule) 1131 path = submodule->path; 1132 else ··· 1351 const struct submodule *submodule; 1352 const char *path = NULL; 1353 1354 - submodule = submodule_from_name(r, null_oid(), name->string); 1355 if (submodule) 1356 path = submodule->path; 1357 else ··· 1360 if (!path) 1361 continue; 1362 1363 - if (submodule_has_commits(r, path, null_oid(), &cs_data->new_commits)) { 1364 changed_submodule_data_clear(cs_data); 1365 *name->string = '\0'; 1366 } ··· 1602 if (!S_ISGITLINK(ce->ce_mode)) 1603 continue; 1604 1605 - task = fetch_task_create(spf, ce->name, null_oid()); 1606 if (!task) 1607 continue; 1608 ··· 2166 if (old_head && !is_submodule_populated_gently(path, error_code_ptr)) 2167 return 0; 2168 2169 - sub = submodule_from_path(the_repository, null_oid(), path); 2170 2171 if (!sub) 2172 BUG("could not get submodule information for '%s'", path); ··· 2376 2377 real_old_git_dir = real_pathdup(old_git_dir, 1); 2378 2379 - sub = submodule_from_path(the_repository, null_oid(), path); 2380 if (!sub) 2381 die(_("could not lookup name for submodule '%s'"), path); 2382 ··· 2462 * superproject did not rewrite the git file links yet, 2463 * fix it now. 2464 */ 2465 - sub = submodule_from_path(the_repository, null_oid(), path); 2466 if (!sub) 2467 die(_("could not lookup name for submodule '%s'"), path); 2468 submodule_name_to_gitdir(&sub_gitdir, the_repository, sub->name); ··· 2594 strbuf_addstr(buf, git_dir); 2595 } 2596 if (!is_git_directory(buf->buf)) { 2597 - sub = submodule_from_path(repo, null_oid(), submodule); 2598 if (!sub) { 2599 ret = -1; 2600 goto cleanup;
··· 124 if (is_gitmodules_unmerged(the_repository->index)) 125 die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first")); 126 127 + submodule = submodule_from_path(the_repository, null_oid(the_hash_algo), oldpath); 128 if (!submodule || !submodule->name) { 129 warning(_("Could not find section in .gitmodules where path=%s"), oldpath); 130 return -1; ··· 153 if (is_gitmodules_unmerged(the_repository->index)) 154 die(_("Cannot change unmerged .gitmodules, resolve merge conflicts first")); 155 156 + submodule = submodule_from_path(the_repository, null_oid(the_hash_algo), path); 157 if (!submodule || !submodule->name) { 158 warning(_("Could not find section in .gitmodules where path=%s"), path); 159 return -1; ··· 204 const char *path) 205 { 206 const struct submodule *submodule = submodule_from_path(the_repository, 207 + null_oid(the_hash_algo), 208 path); 209 if (submodule) { 210 const char *ignore; ··· 312 313 int is_submodule_active(struct repository *repo, const char *path) 314 { 315 + return is_tree_submodule_active(repo, null_oid(the_hash_algo), path); 316 } 317 318 int is_submodule_populated_gently(const char *path, int *return_error_code) ··· 778 if (!should_update_submodules()) 779 return NULL; 780 781 + return submodule_from_path(the_repository, null_oid(the_hash_algo), ce->name); 782 } 783 784 ··· 1062 const char *path, 1063 struct oid_array *commits) 1064 { 1065 + if (!submodule_has_commits(r, path, null_oid(the_hash_algo), commits)) 1066 /* 1067 * NOTE: We do consider it safe to return "no" here. The 1068 * correct answer would be "We do not know" instead of ··· 1126 const struct submodule *submodule; 1127 const char *path = NULL; 1128 1129 + submodule = submodule_from_name(r, null_oid(the_hash_algo), name->string); 1130 if (submodule) 1131 path = submodule->path; 1132 else ··· 1351 const struct submodule *submodule; 1352 const char *path = NULL; 1353 1354 + submodule = submodule_from_name(r, null_oid(the_hash_algo), name->string); 1355 if (submodule) 1356 path = submodule->path; 1357 else ··· 1360 if (!path) 1361 continue; 1362 1363 + if (submodule_has_commits(r, path, null_oid(the_hash_algo), &cs_data->new_commits)) { 1364 changed_submodule_data_clear(cs_data); 1365 *name->string = '\0'; 1366 } ··· 1602 if (!S_ISGITLINK(ce->ce_mode)) 1603 continue; 1604 1605 + task = fetch_task_create(spf, ce->name, null_oid(the_hash_algo)); 1606 if (!task) 1607 continue; 1608 ··· 2166 if (old_head && !is_submodule_populated_gently(path, error_code_ptr)) 2167 return 0; 2168 2169 + sub = submodule_from_path(the_repository, null_oid(the_hash_algo), path); 2170 2171 if (!sub) 2172 BUG("could not get submodule information for '%s'", path); ··· 2376 2377 real_old_git_dir = real_pathdup(old_git_dir, 1); 2378 2379 + sub = submodule_from_path(the_repository, null_oid(the_hash_algo), path); 2380 if (!sub) 2381 die(_("could not lookup name for submodule '%s'"), path); 2382 ··· 2462 * superproject did not rewrite the git file links yet, 2463 * fix it now. 2464 */ 2465 + sub = submodule_from_path(the_repository, null_oid(the_hash_algo), path); 2466 if (!sub) 2467 die(_("could not lookup name for submodule '%s'"), path); 2468 submodule_name_to_gitdir(&sub_gitdir, the_repository, sub->name); ··· 2594 strbuf_addstr(buf, git_dir); 2595 } 2596 if (!is_git_directory(buf->buf)) { 2597 + sub = submodule_from_path(repo, null_oid(the_hash_algo), submodule); 2598 if (!sub) { 2599 ret = -1; 2600 goto cleanup;
+1 -1
t/helper/test-ref-store.c
··· 179 180 static int cmd_resolve_ref(struct ref_store *refs, const char **argv) 181 { 182 - struct object_id oid = *null_oid(); 183 const char *refname = notnull(*argv++, "refname"); 184 int resolve_flags = arg_flags(*argv++, "resolve-flags", empty_flags); 185 int flags;
··· 179 180 static int cmd_resolve_ref(struct ref_store *refs, const char **argv) 181 { 182 + struct object_id oid = *null_oid(the_hash_algo); 183 const char *refname = notnull(*argv++, "refname"); 184 int resolve_flags = arg_flags(*argv++, "resolve-flags", empty_flags); 185 int flags;
+1 -1
t/helper/test-submodule-nested-repo-config.c
··· 21 22 setup_git_directory(); 23 24 - if (repo_submodule_init(&subrepo, the_repository, argv[1], null_oid())) { 25 die_usage(argv, "Submodule not found."); 26 } 27
··· 21 22 setup_git_directory(); 23 24 + if (repo_submodule_init(&subrepo, the_repository, argv[1], null_oid(the_hash_algo))) { 25 die_usage(argv, "Submodule not found."); 26 } 27
+2 -2
tree-diff.c
··· 181 182 strbuf_add(base, path, pathlen); 183 p = combine_diff_path_new(base->buf, base->len, mode, 184 - oid ? oid : null_oid(), 185 nparent); 186 strbuf_setlen(base, old_baselen); 187 ··· 206 mode_i = tp[i].entry.mode; 207 } 208 else { 209 - oid_i = null_oid(); 210 mode_i = 0; 211 } 212
··· 181 182 strbuf_add(base, path, pathlen); 183 p = combine_diff_path_new(base->buf, base->len, mode, 184 + oid ? oid : null_oid(the_hash_algo), 185 nparent); 186 strbuf_setlen(base, old_baselen); 187 ··· 206 mode_i = tp[i].entry.mode; 207 } 208 else { 209 + oid_i = null_oid(the_hash_algo); 210 mode_i = 0; 211 } 212
+1 -1
upload-pack.c
··· 1449 for_each_namespaced_ref_1(send_ref, &data); 1450 if (!data.sent_capabilities) { 1451 const char *refname = "capabilities^{}"; 1452 - write_v0_ref(&data, refname, refname, null_oid()); 1453 } 1454 /* 1455 * fflush stdout before calling advertise_shallow_grafts because send_ref
··· 1449 for_each_namespaced_ref_1(send_ref, &data); 1450 if (!data.sent_capabilities) { 1451 const char *refname = "capabilities^{}"; 1452 + write_v0_ref(&data, refname, refname, null_oid(the_hash_algo)); 1453 } 1454 /* 1455 * fflush stdout before calling advertise_shallow_grafts because send_ref
+2 -2
wt-status.c
··· 1824 if (!sequencer_get_last_command(r, &action)) { 1825 if (action == REPLAY_PICK && !state->cherry_pick_in_progress) { 1826 state->cherry_pick_in_progress = 1; 1827 - oidcpy(&state->cherry_pick_head_oid, null_oid()); 1828 } else if (action == REPLAY_REVERT && !state->revert_in_progress) { 1829 state->revert_in_progress = 1; 1830 - oidcpy(&state->revert_head_oid, null_oid()); 1831 } 1832 } 1833 if (get_detached_from)
··· 1824 if (!sequencer_get_last_command(r, &action)) { 1825 if (action == REPLAY_PICK && !state->cherry_pick_in_progress) { 1826 state->cherry_pick_in_progress = 1; 1827 + oidcpy(&state->cherry_pick_head_oid, null_oid(the_hash_algo)); 1828 } else if (action == REPLAY_REVERT && !state->revert_in_progress) { 1829 state->revert_in_progress = 1; 1830 + oidcpy(&state->revert_head_oid, null_oid(the_hash_algo)); 1831 } 1832 } 1833 if (get_detached_from)
+1 -1
xdiff-interface.c
··· 181 unsigned long size; 182 enum object_type type; 183 184 - if (oideq(oid, null_oid())) { 185 ptr->ptr = xstrdup(""); 186 ptr->size = 0; 187 return;
··· 181 unsigned long size; 182 enum object_type type; 183 184 + if (oideq(oid, null_oid(the_hash_algo))) { 185 ptr->ptr = xstrdup(""); 186 ptr->size = 0; 187 return;