Skip to content

Commit fd34fe0

Browse files
committed
fixup! gvfs: add the feature that blobs may be missing
As of 9e59b38 (object-file: emit corruption errors when detected, 2022-12-14), Git will loudly complain about corrupt objects. That is fine, as long as the idea isn't to re-download locally-corrupted objects. But that's exactly what we want to do in VFS for Git. While at it, avoid the XOR operator to flip the bits, when we actually want to make sure that they are turned off: Use the AND-NOT operator for that purpose. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 6e437e9 commit fd34fe0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

commit.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,14 @@ int repo_parse_commit_internal(struct repository *r,
566566
int flags = OBJECT_INFO_LOOKUP_REPLACE | OBJECT_INFO_SKIP_FETCH_OBJECT |
567567
OBJECT_INFO_DIE_IF_CORRUPT;
568568

569-
/* But the GVFS Protocol _does_ support missing commits! */
569+
/*
570+
* But the GVFS Protocol _does_ support missing commits!
571+
* And the idea with VFS for Git is to re-download corrupted objects,
572+
* not to fail!
573+
*/
570574
if (gvfs_config_is_set(GVFS_MISSING_OK))
571-
flags ^= OBJECT_INFO_SKIP_FETCH_OBJECT;
575+
flags &= ~(OBJECT_INFO_SKIP_FETCH_OBJECT |
576+
OBJECT_INFO_DIE_IF_CORRUPT);
572577

573578
if (!item)
574579
return -1;

object-store.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "dir.h"
88
#include "environment.h"
99
#include "gettext.h"
10+
#include "gvfs.h"
1011
#include "gvfs-helper-client.h"
1112
#include "hex.h"
1213
#include "hook.h"
@@ -1104,6 +1105,9 @@ void *repo_read_object_file(struct repository *r,
11041105
unsigned flags = OBJECT_INFO_DIE_IF_CORRUPT | OBJECT_INFO_LOOKUP_REPLACE;
11051106
void *data;
11061107

1108+
if (gvfs_config_is_set(GVFS_MISSING_OK))
1109+
flags &= ~OBJECT_INFO_DIE_IF_CORRUPT;
1110+
11071111
oi.typep = type;
11081112
oi.sizep = size;
11091113
oi.contentp = &data;

0 commit comments

Comments
 (0)