if (!fetching)
return 1;
- if (depth > 0) {
+ if (depth > 0) {
char line[1024];
unsigned char sha1[20];
int len;
if (!strncmp("shallow ", line, 8)) {
if (get_sha1_hex(line + 8, sha1))
die("invalid shallow line: %s", line);
- /* no need making it shallow if we have it already */
- if (lookup_object(sha1))
- continue;
register_shallow(sha1);
- } else if (!strncmp("unshallow ", line, 10)) {
+ continue;
+ }
+ if (!strncmp("unshallow ", line, 10)) {
if (get_sha1_hex(line + 10, sha1))
die("invalid unshallow line: %s", line);
if (!lookup_object(sha1))
parse_object(sha1);
if (unregister_shallow(sha1))
die("no shallow found: %s", line);
- } else
- die("expected shallow/unshallow, got %s", line);
+ continue;
+ }
+ die("expected shallow/unshallow, got %s", line);
}
}
fd = hold_lock_file_for_update(&lock, shallow, 1);
if (!write_shallow_commits(fd, 0)) {
- unlink(lock.filename);
+ unlink(shallow);
rollback_lock_file(&lock);
} else {
close(fd);