92
stat_validity_clear(r->parsed_objects->shallow_stat);
93
}
94
95
-int commit_shallow_file(struct repository *r, struct lock_file *lk)
95
+int commit_shallow_file(struct repository *r, struct shallow_lock *lk)
96
{
97
- int res = commit_lock_file(lk);
97
+ int res = commit_lock_file(&lk->lock);
98
reset_repository_shallow(r);
99
return res;
100
}
101
102
-void rollback_shallow_file(struct repository *r, struct lock_file *lk)
102
+void rollback_shallow_file(struct repository *r, struct shallow_lock *lk)
103
{
104
- rollback_lock_file(lk);
104
+ rollback_lock_file(&lk->lock);
105
reset_repository_shallow(r);
106
}
107
366
return "";
367
}
368
369
-void setup_alternate_shallow(struct lock_file *shallow_lock,
369
+void setup_alternate_shallow(struct shallow_lock *shallow_lock,
370
const char **alternate_shallow_file,
371
const struct oid_array *extra)
372
{
373
struct strbuf sb = STRBUF_INIT;
374
int fd;
375
376
- fd = hold_lock_file_for_update(shallow_lock,
376
+ fd = hold_lock_file_for_update(&shallow_lock->lock,
377
git_path_shallow(the_repository),
378
LOCK_DIE_ON_ERROR);
379
check_shallow_file_for_update(the_repository);
380
if (write_shallow_commits(&sb, 0, extra)) {
381
if (write_in_full(fd, sb.buf, sb.len) < 0)
382
die_errno("failed to write to %s",
383
- get_lock_file_path(shallow_lock));
384
- *alternate_shallow_file = get_lock_file_path(shallow_lock);
383
+ get_lock_file_path(&shallow_lock->lock));
384
+ *alternate_shallow_file = get_lock_file_path(&shallow_lock->lock);
385
} else
386
/*
387
* is_repository_shallow() sees empty string as "no
414
*/
415
void prune_shallow(unsigned options)
416
{
417
- struct lock_file shallow_lock = LOCK_INIT;
417
+ struct shallow_lock shallow_lock = SHALLOW_LOCK_INIT;
418
struct strbuf sb = STRBUF_INIT;
419
unsigned flags = SEEN_ONLY;
420
int fd;
428
strbuf_release(&sb);
429
return;
430
}
431
- fd = hold_lock_file_for_update(&shallow_lock,
431
+ fd = hold_lock_file_for_update(&shallow_lock.lock,
432
git_path_shallow(the_repository),
433
LOCK_DIE_ON_ERROR);
434
check_shallow_file_for_update(the_repository);
435
if (write_shallow_commits_1(&sb, 0, NULL, flags)) {
436
if (write_in_full(fd, sb.buf, sb.len) < 0)
437
die_errno("failed to write to %s",
438
- get_lock_file_path(&shallow_lock));
438
+ get_lock_file_path(&shallow_lock.lock));
439
commit_shallow_file(the_repository, &shallow_lock);
440
} else {
441
unlink(git_path_shallow(the_repository));