diff options
author | Remy Suen <remy.suen@gmail.com> | 2016-12-01 18:11:22 +0900 |
---|---|---|
committer | Remy Suen <remy.suen@gmail.com> | 2016-12-01 18:11:22 +0900 |
commit | c75e5875480d9394e1bdd45d11a4ca205afb5d8a (patch) | |
tree | 57e54510a9ab24271fe208bf76cd45d854dafdfb | |
parent | 05fcd7c5c5d12002613f8479d5dab71a0243bded (diff) | |
download | org.eclipse.orion.client-c75e5875480d9394e1bdd45d11a4ca205afb5d8a.zip org.eclipse.orion.client-c75e5875480d9394e1bdd45d11a4ca205afb5d8a.tar.gz org.eclipse.orion.client-c75e5875480d9394e1bdd45d11a4ca205afb5d8a.tar.bz2 |
Bug 508511 - 'git log' throws many exceptions that are ignored when looking for refs and tags
When responding to a log request, we want to let the client know about
any refs that a given commit is pointing to. We do this in
getCommitRefs(*) by fetching all the references in the repository and
checking if the commit that ref is pointing to is one of the commits
that we are sending back to the client.
The current code catches and ignores all errors when processing the
refs. Since there are likely many refs in a repository that is pointing
to commits both old and new, it is highly unlikely that all of them
will be pointing at one of the commits to be included in the current
response. We should check whether a given ref is pointing at a commit
that is being sent back to the client before processing it instead of
blatantly trying to process every single commit that a ref is pointing
at.
Change-Id: I8cbdd2f81f880395b0311d3a06306f501630dabb
Signed-off-by: Remy Suen <remy.suen@gmail.com>
-rw-r--r-- | modules/orionode/lib/git/commit.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/orionode/lib/git/commit.js b/modules/orionode/lib/git/commit.js index 1014614..e7c2e6b 100644 --- a/modules/orionode/lib/git/commit.js +++ b/modules/orionode/lib/git/commit.js @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 IBM Corporation and others. + * Copyright (c) 2012, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials are made * available under the terms of the Eclipse Public License v1.0 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution @@ -390,15 +390,19 @@ function getCommitRefs(repo, fileDir, commits) { }) .then(function(){ commit = map[id]; - var tags = commit.Tags || (commit.Tags = []); - tags.push(mTags.tagJSON(fullName, shortName, id, undefined, fileDir)); + if (commit) { + var tags = commit.Tags || (commit.Tags = []); + tags.push(mTags.tagJSON(fullName, shortName, id, undefined, fileDir)); + } cb(); }); } id = oid.toString(); commit = map[id]; - var branches = commit.Branches || (commit.Branches = []); - branches.push({FullName: ref}); + if (commit) { + var branches = commit.Branches || (commit.Branches = []); + branches.push({FullName: ref}); + } cb(); }) .catch(function() { |