diff options
| author | Ben Straub <bs@github.com> | 2013-05-23 15:11:53 -0700 |
|---|---|---|
| committer | Ben Straub <bs@github.com> | 2013-05-23 15:35:50 -0700 |
| commit | 93d8f77fed9407421ba1c90141d997b2dea7e0e7 (patch) | |
| tree | 2212d7ad77c4fdc23425d7e8c5526a9c36332b57 /src | |
| parent | 9c941ccfaf600caef3c87387a6992bfe5a17c742 (diff) | |
| download | libgit2-93d8f77fed9407421ba1c90141d997b2dea7e0e7.tar.gz | |
Improve test failure output
Diffstat (limited to 'src')
| -rw-r--r-- | src/repository.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/repository.c b/src/repository.c index 9957f32b7..b0359a58f 100644 --- a/src/repository.c +++ b/src/repository.c @@ -1822,3 +1822,15 @@ int git_repository_state(git_repository *repo) git_buf_free(&repo_path); return state; } + +int git_repository_is_shallow(git_repository *repo) +{ + git_buf path = GIT_BUF_INIT; + struct stat st; + + git_buf_joinpath(&path, repo->path_repository, "shallow"); + + if (git_path_lstat(path.ptr, &st) == GIT_ENOTFOUND) + return 0; + return st.st_size == 0 ? 0 : 1; +} |
