Skip to content

Commit 7d9ebdc

Browse files
committed
Merge remote-tracking branch 'origin/main' into cgraph-write
2 parents 94008e6 + 2998a84 commit 7d9ebdc

38 files changed

+1205
-143
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"postCreateCommand": "bash .devcontainer/setup.sh"
3+
}

.devcontainer/setup.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
set -e
3+
4+
sudo apt-get update
5+
sudo apt-get -y --no-install-recommends install cmake
6+
7+
mkdir build
8+
cd build
9+
cmake ..

.vscode/launch.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "(gdb) Launch",
9+
"type": "cppdbg",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/build/libgit2_clar",
12+
"args": [],
13+
"stopAtEntry": false,
14+
"cwd": "${fileDirname}",
15+
"environment": [],
16+
"externalConsole": false,
17+
"MIMode": "gdb",
18+
"setupCommands": [
19+
{
20+
"description": "Enable pretty-printing for gdb",
21+
"text": "-enable-pretty-printing",
22+
"ignoreFailures": true
23+
}
24+
]
25+
}
26+
]
27+
}

.vscode/tasks.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Build",
8+
"type": "shell",
9+
"command": "cd build && cmake --build . --parallel",
10+
"group": "build",
11+
"presentation": {
12+
"reveal": "always",
13+
"panel": "new"
14+
}
15+
},
16+
{
17+
"label": "Run Tests",
18+
"type": "shell",
19+
"command": "build/libgit2_clar -v",
20+
"group": "test",
21+
"presentation": {
22+
"reveal": "always",
23+
"panel": "new"
24+
}
25+
}
26+
]
27+
}

cmake/SelectHashes.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ ELSE()
5656
MESSAGE(FATAL_ERROR "Asked for unknown SHA1 backend: ${USE_SHA1}")
5757
ENDIF()
5858

59+
list(APPEND SRC_SHA1 "hash/sha1.h")
5960
list(SORT SRC_SHA1)
6061

6162
ADD_FEATURE_INFO(SHA ON "using ${USE_SHA1}")

docs/changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,9 @@ with v0.28.0.
509509
The breaking change is that the `username` member of the underlying struct
510510
is now hidden, and a new `git_cred_get_username` function has been provided.
511511

512+
* Some errors of class `GIT_ERROR_NET` now have class `GIT_ERROR_HTTP`.
513+
Most authentication failures now have error code `GIT_EAUTH` instead of `GIT_ERROR`.
514+
512515
### Breaking CMake configuration changes
513516

514517
* The CMake option to use a system http-parser library, instead of the

include/git2/checkout.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ typedef enum {
177177
/** Normally checkout writes the index upon completion; this prevents that. */
178178
GIT_CHECKOUT_DONT_WRITE_INDEX = (1u << 23),
179179

180+
/**
181+
* Show what would be done by a checkout. Stop after sending
182+
* notifications; don't update the working directory or index.
183+
*/
184+
GIT_CHECKOUT_DRY_RUN = (1u << 24),
185+
180186
/**
181187
* THE FOLLOWING OPTIONS ARE NOT YET IMPLEMENTED
182188
*/

include/git2/errors.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ typedef enum {
4242
GIT_ECONFLICT = -13, /**< Checkout conflicts prevented operation */
4343
GIT_ELOCKED = -14, /**< Lock file prevented operation */
4444
GIT_EMODIFIED = -15, /**< Reference value does not match expected */
45-
GIT_EAUTH = -16, /**< Authentication error */
46-
GIT_ECERTIFICATE = -17, /**< Server certificate is invalid */
45+
GIT_EAUTH = -16, /**< Authentication error */
46+
GIT_ECERTIFICATE = -17, /**< Server certificate is invalid */
4747
GIT_EAPPLIED = -18, /**< Patch/merge has already been applied */
48-
GIT_EPEEL = -19, /**< The requested peel operation is not possible */
49-
GIT_EEOF = -20, /**< Unexpected EOF */
50-
GIT_EINVALID = -21, /**< Invalid operation or input */
48+
GIT_EPEEL = -19, /**< The requested peel operation is not possible */
49+
GIT_EEOF = -20, /**< Unexpected EOF */
50+
GIT_EINVALID = -21, /**< Invalid operation or input */
5151
GIT_EUNCOMMITTED = -22, /**< Uncommitted changes in index prevented operation */
52-
GIT_EDIRECTORY = -23, /**< The operation is not valid for a directory */
52+
GIT_EDIRECTORY = -23, /**< The operation is not valid for a directory */
5353
GIT_EMERGECONFLICT = -24, /**< A merge conflict exists and cannot continue */
5454

5555
GIT_PASSTHROUGH = -30, /**< A user-configured callback refused to act */

include/git2/odb.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,20 @@ GIT_EXTERN(int) git_odb_write_pack(
390390
git_indexer_progress_cb progress_cb,
391391
void *progress_payload);
392392

393+
/**
394+
* Write a `multi-pack-index` file from all the `.pack` files in the ODB.
395+
*
396+
* If the ODB layer understands pack files, then this will create a file called
397+
* `multi-pack-index` next to the `.pack` and `.idx` files, which will contain
398+
* an index of all objects stored in `.pack` files. This will allow for
399+
* O(log n) lookup for n objects (regardless of how many packfiles there
400+
* exist).
401+
*
402+
* @param db object database where the `multi-pack-index` file will be written.
403+
*/
404+
GIT_EXTERN(int) git_odb_write_multi_pack_index(
405+
git_odb *db);
406+
393407
/**
394408
* Determine the object-ID (sha1 hash) of a data buffer
395409
*

include/git2/sys/midx.h

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* Copyright (C) the libgit2 contributors. All rights reserved.
3+
*
4+
* This file is part of libgit2, distributed under the GNU GPL v2 with
5+
* a Linking Exception. For full terms see the included COPYING file.
6+
*/
7+
#ifndef INCLUDE_sys_git_midx_h__
8+
#define INCLUDE_sys_git_midx_h__
9+
10+
#include "git2/common.h"
11+
#include "git2/types.h"
12+
13+
/**
14+
* @file git2/midx.h
15+
* @brief Git multi-pack-index routines
16+
* @defgroup git_midx Git multi-pack-index routines
17+
* @ingroup Git
18+
* @{
19+
*/
20+
GIT_BEGIN_DECL
21+
22+
/**
23+
* Create a new writer for `multi-pack-index` files.
24+
*
25+
* @param out location to store the writer pointer.
26+
* @param pack_dir the directory where the `.pack` and `.idx` files are. The
27+
* `multi-pack-index` file will be written in this directory, too.
28+
* @return 0 or an error code
29+
*/
30+
GIT_EXTERN(int) git_midx_writer_new(
31+
git_midx_writer **out,
32+
const char *pack_dir);
33+
34+
/**
35+
* Free the multi-pack-index writer and its resources.
36+
*
37+
* @param w the writer to free. If NULL no action is taken.
38+
*/
39+
GIT_EXTERN(void) git_midx_writer_free(git_midx_writer *w);
40+
41+
/**
42+
* Add an `.idx` file to the writer.
43+
*
44+
* @param w the writer
45+
* @param idx_path the path of an `.idx` file.
46+
* @return 0 or an error code
47+
*/
48+
GIT_EXTERN(int) git_midx_writer_add(
49+
git_midx_writer *w,
50+
const char *idx_path);
51+
52+
/**
53+
* Write a `multi-pack-index` file to a file.
54+
*
55+
* @param w the writer
56+
* @return 0 or an error code
57+
*/
58+
GIT_EXTERN(int) git_midx_writer_commit(
59+
git_midx_writer *w);
60+
61+
/**
62+
* Dump the contents of the `multi-pack-index` to an in-memory buffer.
63+
*
64+
* @param midx Buffer where to store the contents of the `multi-pack-index`.
65+
* @param w the writer
66+
* @return 0 or an error code
67+
*/
68+
GIT_EXTERN(int) git_midx_writer_dump(
69+
git_buf *midx,
70+
git_midx_writer *w);
71+
72+
/** @} */
73+
GIT_END_DECL
74+
#endif

0 commit comments

Comments
 (0)