summaryrefslogtreecommitdiff
path: root/refs/files-backend.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-09-12 15:34:31 -0700
committerJunio C Hamano <gitster@pobox.com>2016-09-12 15:34:31 -0700
commit305d7f133956a5f43c94d938beabbfbb0ac1753c (patch)
tree6f3324895e1885de1a7369da012c5132b9104176 /refs/files-backend.c
parentcda1bbd474805e653dda8a71d4ea3790e2a66cbb (diff)
parentfd47ae6a5b9cc0cfc56c1f7c43db612d26ca4b75 (diff)
downloadgit-305d7f133956a5f43c94d938beabbfbb0ac1753c.tar.gz
Merge branch 'jk/diff-submodule-diff-inline'
The "git diff --submodule={short,log}" mechanism has been enhanced to allow "--submodule=diff" to show the patch between the submodule commits bound to the superproject. * jk/diff-submodule-diff-inline: diff: teach diff to display submodule difference with an inline diff submodule: refactor show_submodule_summary with helper function submodule: convert show_submodule_summary to use struct object_id * allow do_submodule_path to work even if submodule isn't checked out diff: prepare for additional submodule formats graph: add support for --line-prefix on all graph-aware output diff.c: remove output_prefix_length field cache: add empty_tree_oid object and helper function
Diffstat (limited to 'refs/files-backend.c')
-rw-r--r--refs/files-backend.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 12290d2496..1f34b444af 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1225,13 +1225,19 @@ static void read_loose_refs(const char *dirname, struct ref_dir *dir)
struct strbuf refname;
struct strbuf path = STRBUF_INIT;
size_t path_baselen;
+ int err = 0;
if (*refs->name)
- strbuf_git_path_submodule(&path, refs->name, "%s", dirname);
+ err = strbuf_git_path_submodule(&path, refs->name, "%s", dirname);
else
strbuf_git_path(&path, "%s", dirname);
path_baselen = path.len;
+ if (err) {
+ strbuf_release(&path);
+ return;
+ }
+
d = opendir(path.buf);
if (!d) {
strbuf_release(&path);