Skip to content

Commit 5915a2a

Browse files
committed
Merge pull request libgit2#3349 from libgit2/cmn/for-v23
A second round of 0.23 maint updates
2 parents 6a0d569 + 16cee5d commit 5915a2a

24 files changed

+137
-31
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# > cmake --build . --target install
1313

1414
PROJECT(libgit2 C)
15-
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
15+
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
1616
CMAKE_POLICY(SET CMP0015 NEW)
1717

1818
# Add find modules to the path
@@ -412,6 +412,7 @@ ELSE ()
412412
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
413413
ENDIF ()
414414

415+
ADD_C_FLAG_IF_SUPPORTED(-Wdocumentation)
415416
ADD_C_FLAG_IF_SUPPORTED(-Wno-missing-field-initializers)
416417
ADD_C_FLAG_IF_SUPPORTED(-Wstrict-aliasing=2)
417418
ADD_C_FLAG_IF_SUPPORTED(-Wstrict-prototypes)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Under Unix-like systems, like Linux, \*BSD and Mac OS X, libgit2 expects `pthrea
8888
they should be installed by default on all systems. Under Windows, libgit2 uses the native Windows API
8989
for threading.
9090

91-
The `libgit2` library is built using [CMake](<http://www.cmake.org>) (version 2.6 or newer) on all platforms.
91+
The `libgit2` library is built using [CMake](<http://www.cmake.org>) (version 2.8 or newer) on all platforms.
9292

9393
On most systems you can build the library using the following commands
9494

include/git2/repository.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ GIT_EXTERN(int) git_repository_ident(const char **name, const char **email, cons
745745
*
746746
* @param repo the repository to configure
747747
* @param name the name to use for the reflog entries
748-
* @param name the email to use for the reflog entries
748+
* @param email the email to use for the reflog entries
749749
*/
750750
GIT_EXTERN(int) git_repository_set_ident(git_repository *repo, const char *name, const char *email);
751751

include/git2/sys/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct git_config_backend {
7676
* Initializes a `git_config_backend` with default values. Equivalent to
7777
* creating an instance with GIT_CONFIG_BACKEND_INIT.
7878
*
79-
* @param opts the `git_config_backend` struct to initialize.
79+
* @param backend the `git_config_backend` struct to initialize.
8080
* @param version Version of struct; pass `GIT_CONFIG_BACKEND_VERSION`
8181
* @return Zero on success; -1 on failure.
8282
*/

include/git2/sys/diff.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ GIT_EXTERN(int) git_diff_print_callback__to_buf(
3838
const git_diff_delta *delta,
3939
const git_diff_hunk *hunk,
4040
const git_diff_line *line,
41-
void *payload); /*< payload must be a `git_buf *` */
41+
void *payload); /**< payload must be a `git_buf *` */
4242

4343
/**
4444
* Diff print callback that writes to stdio FILE handle.
@@ -58,16 +58,16 @@ GIT_EXTERN(int) git_diff_print_callback__to_file_handle(
5858
const git_diff_delta *delta,
5959
const git_diff_hunk *hunk,
6060
const git_diff_line *line,
61-
void *payload); /*< payload must be a `FILE *` */
61+
void *payload); /**< payload must be a `FILE *` */
6262

6363

6464
/**
6565
* Performance data from diffing
6666
*/
6767
typedef struct {
6868
unsigned int version;
69-
size_t stat_calls; /*< Number of stat() calls performed */
70-
size_t oid_calculations; /*< Number of ID calculations */
69+
size_t stat_calls; /**< Number of stat() calls performed */
70+
size_t oid_calculations; /**< Number of ID calculations */
7171
} git_diff_perfdata;
7272

7373
#define GIT_DIFF_PERFDATA_VERSION 1

include/git2/sys/odb_backend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct git_odb_backend {
9393
* Initializes a `git_odb_backend` with default values. Equivalent to
9494
* creating an instance with GIT_ODB_BACKEND_INIT.
9595
*
96-
* @param opts the `git_odb_backend` struct to initialize.
96+
* @param backend the `git_odb_backend` struct to initialize.
9797
* @param version Version the struct; pass `GIT_ODB_BACKEND_VERSION`
9898
* @return Zero on success; -1 on failure.
9999
*/

include/git2/sys/refdb_backend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ struct git_refdb_backend {
175175
* Initializes a `git_refdb_backend` with default values. Equivalent to
176176
* creating an instance with GIT_REFDB_BACKEND_INIT.
177177
*
178-
* @param opts the `git_refdb_backend` struct to initialize
178+
* @param backend the `git_refdb_backend` struct to initialize
179179
* @param version Version of struct; pass `GIT_REFDB_BACKEND_VERSION`
180180
* @return Zero on success; -1 on failure.
181181
*/

src/describe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "vector.h"
2020
#include "repository.h"
2121

22-
GIT__USE_OIDMAP;
22+
GIT__USE_OIDMAP
2323

2424
/* Ported from https://github.com/git/git/blob/89dde7882f71f846ccd0359756d27bebc31108de/builtin/describe.c */
2525

src/filebuf.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void git_filebuf_cleanup(git_filebuf *file)
101101
if (file->fd_is_open && file->fd >= 0)
102102
p_close(file->fd);
103103

104-
if (file->fd_is_open && file->path_lock && git_path_exists(file->path_lock))
104+
if (file->created_lock && !file->did_rename && file->path_lock && git_path_exists(file->path_lock))
105105
p_unlink(file->path_lock);
106106

107107
if (file->compute_digest) {
@@ -258,6 +258,7 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags, mode_t mode
258258
goto cleanup;
259259
}
260260
file->fd_is_open = true;
261+
file->created_lock = true;
261262

262263
/* No original path */
263264
file->path_original = NULL;
@@ -281,6 +282,8 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags, mode_t mode
281282
/* open the file for locking */
282283
if ((error = lock_file(file, flags, mode)) < 0)
283284
goto cleanup;
285+
286+
file->created_lock = true;
284287
}
285288

286289
return 0;
@@ -340,6 +343,8 @@ int git_filebuf_commit(git_filebuf *file)
340343
goto on_error;
341344
}
342345

346+
file->did_rename = true;
347+
343348
git_filebuf_cleanup(file);
344349
return 0;
345350

src/filebuf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ struct git_filebuf {
4444
size_t buf_size, buf_pos;
4545
git_file fd;
4646
bool fd_is_open;
47+
bool created_lock;
48+
bool did_rename;
4749
bool do_not_buffer;
4850
int last_error;
4951
};

0 commit comments

Comments
 (0)