aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Spiers <git@adamspiers.org>2015-01-20 00:41:54 +0000
committerAdam Spiers <git@adamspiers.org>2015-01-20 10:43:22 +0000
commite21f94e66ab624f53b801556da97a2caf1aa27a9 (patch)
treebf7bcc9f0f1db5d97ae4a9bdffff451211ff8437
parent7bbc159a30bae1d9697cbef49600ba4db56e3757 (diff)
downloadgit-deps-e21f94e66ab624f53b801556da97a2caf1aa27a9.tar.gz
fix --exclude (closes #34)
branch_contains() was comparing truncated SHA1s with non-truncated SHA1s, so it never noticed when a branch contained a commit. Thanks a lot to Steven Bromling (@sbromling) for the great bug report!
-rwxr-xr-xgit-deps10
1 files changed, 5 insertions, 5 deletions
diff --git a/git-deps b/git-deps
index bb00335..6e1ef00 100755
--- a/git-deps
+++ b/git-deps
@@ -542,13 +542,13 @@ class DependencyDetector(object):
return False
def branch_contains(self, commit, branch):
- sha1 = commit.hex[:8]
- self.logger.debug(" Does %s contain %s?" %
- (branch, sha1))
+ sha1 = commit.hex
branch_commit = self.get_commit(branch)
branch_sha1 = branch_commit.hex
+ self.logger.debug(" Does %s (%s) contain %s?" %
+ (branch, branch_sha1[:8], sha1[:8]))
- if commit.hex not in self.branch_contains_cache:
+ if sha1 not in self.branch_contains_cache:
self.branch_contains_cache[sha1] = {}
if branch_sha1 in self.branch_contains_cache[sha1]:
memoized = self.branch_contains_cache[sha1][branch_sha1]
@@ -558,7 +558,7 @@ class DependencyDetector(object):
cmd = ['git', 'merge-base', sha1, branch_sha1]
# self.logger.debug(" ".join(cmd))
out = subprocess.check_output(cmd).strip()
- # self.logger.debug(out)
+ self.logger.debug(" merge-base returned: %s" % out[:8])
result = out == sha1
self.logger.debug(" %s" % result)
self.branch_contains_cache[sha1][branch_sha1] = result