diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2013-08-19 10:30:44 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-08-19 10:30:44 +0200 |
| commit | 3d2768747548ec24b58ebdaa012a6b757e65f5a0 (patch) | |
| tree | ac7653603379d3b1bc406becb247105967264221 /src/index.c | |
| parent | 8f81ea45ca107c992313f76ee73316f16751e64e (diff) | |
| download | libgit2-3d2768747548ec24b58ebdaa012a6b757e65f5a0.tar.gz | |
index: report when it's locked
Report the index being locked with its own error code in order to be
able to differentiate, as a locked index is typically the result of a
crashed process or concurrent access, both of which often require user
intervention to fix.
Diffstat (limited to 'src/index.c')
| -rw-r--r-- | src/index.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/index.c b/src/index.c index 5f53f1e2f..17e43903f 100644 --- a/src/index.c +++ b/src/index.c @@ -498,8 +498,12 @@ int git_index_write(git_index *index) git_vector_sort(&index->reuc); if ((error = git_filebuf_open( - &file, index->index_file_path, GIT_FILEBUF_HASH_CONTENTS)) < 0) + &file, index->index_file_path, GIT_FILEBUF_HASH_CONTENTS)) < 0) { + if (error == GIT_ELOCKED) + giterr_set(GITERR_INDEX, "The index is locked. This might be due to a concurrrent or crashed process"); + return error; + } if ((error = write_index(index, &file)) < 0) { git_filebuf_cleanup(&file); |
