Select Git revision
Forked from
Jonas Rabenstein / Linux
Source project has a limited visibility.
-
Jussi Kivilinna authored
Initialization of cra_list is currently mixed, most ciphers initialize this field and most shashes do not. Initialization however is not needed at all since cra_list is initialized/overwritten in __crypto_register_alg() with list_add(). Therefore perform cleanup to remove all unneeded initializations of this field in 'crypto/'. Signed-off-by:
Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by:
Herbert Xu <herbert@gondor.apana.org.au>
Jussi Kivilinna authoredInitialization of cra_list is currently mixed, most ciphers initialize this field and most shashes do not. Initialization however is not needed at all since cra_list is initialized/overwritten in __crypto_register_alg() with list_add(). Therefore perform cleanup to remove all unneeded initializations of this field in 'crypto/'. Signed-off-by:
Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by:
Herbert Xu <herbert@gondor.apana.org.au>
clone-pack.c 6.54 KiB
#include "cache.h"
#include "refs.h"
#include "pkt-line.h"
#include <sys/wait.h>
static const char clone_pack_usage[] =
"git-clone-pack [--exec=<git-upload-pack>] [<host>:]<directory> [<heads>]*";
static const char *exec = "git-upload-pack";
static void clone_handshake(int fd[2], struct ref *ref)
{
unsigned char sha1[20];
while (ref) {
packet_write(fd[1], "want %s\n", sha1_to_hex(ref->old_sha1));
ref = ref->next;
}
packet_flush(fd[1]);
/* We don't have nuttin' */
packet_write(fd[1], "done\n");
if (get_ack(fd[0], sha1))
error("Huh! git-clone-pack got positive ack for %s", sha1_to_hex(sha1));
}
static int is_master(struct ref *ref)
{
return !strcmp(ref->name, "refs/heads/master");
}
static void write_one_ref(struct ref *ref)
{
char *path = git_path("%s", ref->name);
int fd;
char *hex;
if (!strncmp(ref->name, "refs/", 5) &&
check_ref_format(ref->name + 5)) {
error("refusing to create funny ref '%s' locally", ref->name);
return;
}
if (safe_create_leading_directories(path))
die("unable to create leading directory for %s", ref->name);
fd = open(path, O_CREAT | O_EXCL | O_WRONLY, 0666);
if (fd < 0)
die("unable to create ref %s", ref->name);
hex = sha1_to_hex(ref->old_sha1);
hex[40] = '\n';
if (write(fd, hex, 41) != 41)
die("unable to write ref %s", ref->name);
close(fd);
}
static void write_refs(struct ref *ref)
{
struct ref *head = NULL, *head_ptr, *master_ref;
char *head_path;
/* Upload-pack must report HEAD first */
if (!strcmp(ref->name, "HEAD")) {
head = ref;
ref = ref->next;
}
head_ptr = NULL;
master_ref = NULL;
while (ref) {
if (is_master(ref))
master_ref = ref;
if (head &&