Skip to content

Commit e594349

Browse files
Kevin Willforddscho
authored andcommitted
gvfs: add the feature that blobs may be missing
Signed-off-by: Kevin Willford <kewillf@microsoft.com>
1 parent ff0718b commit e594349

4 files changed

Lines changed: 13 additions & 1 deletion

File tree

Documentation/config/core.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,10 @@ core.gvfs::
737737
GVFS_SKIP_SHA_ON_INDEX::
738738
Bit value 1
739739
Disables the calculation of the sha when writing the index
740+
GVFS_MISSING_OK::
741+
Bit value 4
742+
Normally git write-tree ensures that the objects referenced by the
743+
directory exist in the object database. This option disables this check.
740744
--
741745

742746
core.sparseCheckout::

cache-tree.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "cache.h"
2+
#include "gvfs.h"
23
#include "lockfile.h"
34
#include "tree.h"
45
#include "tree-walk.h"
@@ -252,7 +253,8 @@ static int update_one(struct cache_tree *it,
252253
int flags)
253254
{
254255
struct strbuf buffer;
255-
int missing_ok = flags & WRITE_TREE_MISSING_OK;
256+
int missing_ok = gvfs_config_is_set(GVFS_MISSING_OK) ?
257+
WRITE_TREE_MISSING_OK : (flags & WRITE_TREE_MISSING_OK);
256258
int dryrun = flags & WRITE_TREE_DRY_RUN;
257259
int repair = flags & WRITE_TREE_REPAIR;
258260
int to_invalidate = 0;

gvfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* The list of bits in the core_gvfs setting
1515
*/
1616
#define GVFS_SKIP_SHA_ON_INDEX (1 << 0)
17+
#define GVFS_MISSING_OK (1 << 2)
1718

1819
static inline int gvfs_config_is_set(int mask) {
1920
return (core_gvfs & mask) == mask;

t/t0000-basic.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,11 @@ test_expect_success 'writing this tree with --missing-ok' '
11051105
git write-tree --missing-ok
11061106
'
11071107

1108+
test_expect_success 'writing this tree with missing ok config value' '
1109+
git config core.gvfs 4 &&
1110+
git write-tree
1111+
'
1112+
11081113

11091114
################################################################
11101115
test_expect_success 'git read-tree followed by write-tree should be idempotent' '

0 commit comments

Comments
 (0)