diff options
author | Jiang Xin <worldhello.net@gmail.com> | 2021-10-30 09:34:30 +0800 |
---|---|---|
committer | Jiang Xin <worldhello.net@gmail.com> | 2021-10-30 09:34:30 +0800 |
commit | cd9ef9ce67bf2934845a6a76a1ecdbc9a5f7a6e0 (patch) | |
tree | ba34cf45622ddcd8e9d250a048661a7e6a8a35ee /fetch-pack.c | |
parent | Merge branch 'master' of github.com:nafmo/git-l10n-sv (diff) | |
parent | Git 2.34-rc0 (diff) | |
download | tgif-cd9ef9ce67bf2934845a6a76a1ecdbc9a5f7a6e0.tar.xz |
Merge branch 'master' of github.com:git/git
* 'master' of github.com:git/git: (762 commits)
Git 2.34-rc0
wrapper: remove xunsetenv()
log: document --encoding behavior on iconv() failure
Revert "logmsg_reencode(): warn when iconv() fails"
completion: fix incorrect bash/zsh string equality check
add, rm, mv: fix bug that prevents the update of non-sparse dirs
git-bundle.txt: add missing words and punctuation
Documentation/Makefile: fix lint-docs mkdir dependency
submodule: drop unused sm_name parameter from append_fetch_remotes()
The fifteenth batch
gitweb.txt: change "folder" to "directory"
gitignore.txt: change "folder" to "directory"
git-multi-pack-index.txt: change "folder" to "directory"
git.txt: fix typo
archive: describe compression level option
config.txt: fix typo
command-list.txt: remove 'sparse-index' from main help
userdiff-cpp: back out the digit-separators in numbers
submodule--helper: fix incorrect newlines in an error message
branch (doc): -m/-c copies config and reflog
...
Diffstat (limited to 'fetch-pack.c')
-rw-r--r-- | fetch-pack.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/fetch-pack.c b/fetch-pack.c index b0c7be717c..a9604f35a3 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -119,6 +119,11 @@ static struct commit *deref_without_lazy_fetch(const struct object_id *oid, { enum object_type type; struct object_info info = { .typep = &type }; + struct commit *commit; + + commit = lookup_commit_in_graph(the_repository, oid); + if (commit) + return commit; while (1) { if (oid_object_info_extended(the_repository, oid, &info, @@ -137,8 +142,14 @@ static struct commit *deref_without_lazy_fetch(const struct object_id *oid, break; } } - if (type == OBJ_COMMIT) - return (struct commit *) parse_object(the_repository, oid); + + if (type == OBJ_COMMIT) { + struct commit *commit = lookup_commit(the_repository, oid); + if (!commit || repo_parse_commit(the_repository, commit)) + return NULL; + return commit; + } + return NULL; } @@ -1906,16 +1917,15 @@ static void update_shallow(struct fetch_pack_args *args, oid_array_clear(&ref); } -static int iterate_ref_map(void *cb_data, struct object_id *oid) +static const struct object_id *iterate_ref_map(void *cb_data) { struct ref **rm = cb_data; struct ref *ref = *rm; if (!ref) - return -1; /* end of the list */ + return NULL; *rm = ref->next; - oidcpy(oid, &ref->old_oid); - return 0; + return &ref->old_oid; } struct ref *fetch_pack(struct fetch_pack_args *args, |