diff options
author | Sascha Cunz <Sascha@BabbelBox.org> | 2012-10-05 13:44:18 +0200 |
---|---|---|
committer | Sascha Cunz <Sascha@BabbelBox.org> | 2012-10-05 13:53:53 +0200 |
commit | 1dca8510a2e815c95293c1ebaacf2a286a9c6e1d (patch) | |
tree | c8aa8d8e764b71a0a32ea89e56756702e8692955 | |
parent | 1686641f18f028940b760ef554e9219c2c9a27d8 (diff) | |
download | libgit2-1dca8510a2e815c95293c1ebaacf2a286a9c6e1d.tar.gz |
Diff: Do not try to calculate an oid for a GITLINK.
We don't have anything useful that we could do with that oid anyway (We
need to query the submodule for the HEAD commit instead).
Without this, the following code creates the error "Failed to read
descriptor: Is a directory" when run against the submod2 test-case:
const char* oidstr = "873585b94bdeabccea991ea5e3ec1a277895b698";
git_tree* tree = resolve_commit_oid_to_tree(g_repo, oidstr);
git_diff_list* diff = NULL;
cl_assert(tree);
cl_git_pass(git_diff_workdir_to_tree(g_repo, NULL, tree, &diff));
-rw-r--r-- | src/diff.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/diff.c b/src/diff.c index 375520e04..7a0051ae3 100644 --- a/src/diff.c +++ b/src/diff.c @@ -448,7 +448,11 @@ static int oid_for_workdir_item( return -1; /* calculate OID for file if possible*/ - if (S_ISLNK(item->mode)) + if (S_ISGITLINK(item->mode)) { + /* Don't bother to figure out an oid for a submodule. We won't use it anyway. */ + memset(oid, 0, sizeof(*oid)); + result = 0; + } else if (S_ISLNK(item->mode)) result = git_odb__hashlink(oid, full_path.ptr); else if (!git__is_sizet(item->file_size)) { giterr_set(GITERR_OS, "File size overflow for 32-bit systems"); |