您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xfdopen函数代码示例

51自学网 2021-06-03 10:19:05
  C++
这篇教程C++ xfdopen函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中xfdopen函数的典型用法代码示例。如果您正苦于以下问题:C++ xfdopen函数的具体用法?C++ xfdopen怎么用?C++ xfdopen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了xfdopen函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: read_alternate_refs

static void read_alternate_refs(const char *path,				alternate_ref_fn *cb,				void *data){	struct child_process cmd = CHILD_PROCESS_INIT;	struct strbuf line = STRBUF_INIT;	FILE *fh;	fill_alternate_refs_command(&cmd, path);	if (start_command(&cmd))		return;	fh = xfdopen(cmd.out, "r");	while (strbuf_getline_lf(&line, fh) != EOF) {		struct object_id oid;		const char *p;		if (parse_oid_hex(line.buf, &oid, &p) || *p) {			warning(_("invalid line while parsing alternate refs: %s"),				line.buf);			break;		}		cb(&oid, data);	}	fclose(fh);	finish_command(&cmd);}
开发者ID:MichaelBlume,项目名称:git,代码行数:30,


示例2: read_alternate_refs

static void read_alternate_refs(const char *path,				alternate_ref_fn *cb,				void *data){	struct child_process cmd = CHILD_PROCESS_INIT;	struct strbuf line = STRBUF_INIT;	FILE *fh;	cmd.git_cmd = 1;	argv_array_pushf(&cmd.args, "--git-dir=%s", path);	argv_array_push(&cmd.args, "for-each-ref");	argv_array_push(&cmd.args, "--format=%(objectname) %(refname)");	cmd.env = local_repo_env;	cmd.out = -1;	if (start_command(&cmd))		return;	fh = xfdopen(cmd.out, "r");	while (strbuf_getline_lf(&line, fh) != EOF) {		struct object_id oid;		if (get_oid_hex(line.buf, &oid) ||		    line.buf[GIT_SHA1_HEXSZ] != ' ') {			warning("invalid line while parsing alternate refs: %s",				line.buf);			break;		}		cb(line.buf + GIT_SHA1_HEXSZ + 1, &oid, data);	}	fclose(fh);	finish_command(&cmd);}
开发者ID:KarthikNayak,项目名称:git,代码行数:35,


示例3: changed_files

static void changed_files(struct hashmap *result, const char *index_path,			  const char *workdir){	struct child_process update_index = CHILD_PROCESS_INIT;	struct child_process diff_files = CHILD_PROCESS_INIT;	struct strbuf index_env = STRBUF_INIT, buf = STRBUF_INIT;	const char *git_dir = absolute_path(get_git_dir()), *env[] = {		NULL, NULL	};	FILE *fp;	strbuf_addf(&index_env, "GIT_INDEX_FILE=%s", index_path);	env[0] = index_env.buf;	argv_array_pushl(&update_index.args,			 "--git-dir", git_dir, "--work-tree", workdir,			 "update-index", "--really-refresh", "-q",			 "--unmerged", NULL);	update_index.no_stdin = 1;	update_index.no_stdout = 1;	update_index.no_stderr = 1;	update_index.git_cmd = 1;	update_index.use_shell = 0;	update_index.clean_on_exit = 1;	update_index.dir = workdir;	update_index.env = env;	/* Ignore any errors of update-index */	run_command(&update_index);	argv_array_pushl(&diff_files.args,			 "--git-dir", git_dir, "--work-tree", workdir,			 "diff-files", "--name-only", "-z", NULL);	diff_files.no_stdin = 1;	diff_files.git_cmd = 1;	diff_files.use_shell = 0;	diff_files.clean_on_exit = 1;	diff_files.out = -1;	diff_files.dir = workdir;	diff_files.env = env;	if (start_command(&diff_files))		die("could not obtain raw diff");	fp = xfdopen(diff_files.out, "r");	while (!strbuf_getline_nul(&buf, fp)) {		struct path_entry *entry;		FLEX_ALLOC_STR(entry, path, buf.buf);		hashmap_entry_init(entry, strhash(buf.buf));		hashmap_add(result, entry);	}	fclose(fp);	if (finish_command(&diff_files))		die("diff-files did not exit properly");	strbuf_release(&index_env);	strbuf_release(&buf);}
开发者ID:Litttle-butterfly,项目名称:git,代码行数:54,


示例4: run_credential_helper

static int run_credential_helper(struct credential *c,				 const char *cmd,				 int want_output){	struct child_process helper = CHILD_PROCESS_INIT;	const char *argv[] = { NULL, NULL };	FILE *fp;	argv[0] = cmd;	helper.argv = argv;	helper.use_shell = 1;	helper.in = -1;	if (want_output)		helper.out = -1;	else		helper.no_stdout = 1;	if (start_command(&helper) < 0)		return -1;	fp = xfdopen(helper.in, "w");	sigchain_push(SIGPIPE, SIG_IGN);	credential_write(c, fp);	fclose(fp);	sigchain_pop(SIGPIPE);	if (want_output) {		int r;		fp = xfdopen(helper.out, "r");		r = credential_read(c, fp);		fclose(fp);		if (r < 0) {			finish_command(&helper);			return -1;		}	}	if (finish_command(&helper))		return -1;	return 0;}
开发者ID:PEPE-coin,项目名称:git,代码行数:41,


示例5: serve_cache_loop

static int serve_cache_loop(int fd){	struct pollfd pfd;	unsigned long wakeup;	wakeup = check_expirations();	if (!wakeup)		return 0;	pfd.fd = fd;	pfd.events = POLLIN;	if (poll(&pfd, 1, 1000 * wakeup) < 0) {		if (errno != EINTR)			die_errno("poll failed");		return 1;	}	if (pfd.revents & POLLIN) {		int client, client2;		FILE *in, *out;		client = accept(fd, NULL, NULL);		if (client < 0) {			warning("accept failed: %s", strerror(errno));			return 1;		}		client2 = dup(client);		if (client2 < 0) {			warning("dup failed: %s", strerror(errno));			close(client);			return 1;		}		in = xfdopen(client, "r");		out = xfdopen(client2, "w");		serve_one_client(in, out);		fclose(in);		fclose(out);	}	return 1;}
开发者ID:120011676,项目名称:git,代码行数:41,


示例6: run_credential_helper

static int run_credential_helper(struct credential *c,				 const char *cmd,				 int want_output){	struct child_process helper;	const char *argv[] = { NULL, NULL };	FILE *fp;	memset(&helper, 0, sizeof(helper));	argv[0] = cmd;	helper.argv = argv;	helper.use_shell = 1;	helper.in = -1;	if (want_output)		helper.out = -1;	else		helper.no_stdout = 1;	if (start_command(&helper) < 0)		return -1;	fp = xfdopen(helper.in, "w");	credential_write(c, fp);	fclose(fp);	if (want_output) {		int r;		fp = xfdopen(helper.out, "r");		r = credential_read(c, fp);		fclose(fp);		if (r < 0) {			finish_command(&helper);			return -1;		}	}	if (finish_command(&helper))		return -1;	return 0;}
开发者ID:LeoWang,项目名称:git,代码行数:40,


示例7: edit_patch

static int edit_patch(int argc, const char **argv, const char *prefix){	char *file = git_pathdup("ADD_EDIT.patch");	const char *apply_argv[] = { "apply", "--recount", "--cached",		NULL, NULL };	struct child_process child;	struct rev_info rev;	int out;	struct stat st;	apply_argv[3] = file;	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */	if (read_cache() < 0)		die(_("Could not read the index"));	init_revisions(&rev, prefix);	rev.diffopt.context = 7;	argc = setup_revisions(argc, argv, &rev, NULL);	rev.diffopt.output_format = DIFF_FORMAT_PATCH;	rev.diffopt.use_color = 0;	DIFF_OPT_SET(&rev.diffopt, IGNORE_DIRTY_SUBMODULES);	out = open(file, O_CREAT | O_WRONLY, 0666);	if (out < 0)		die(_("Could not open '%s' for writing."), file);	rev.diffopt.file = xfdopen(out, "w");	rev.diffopt.close_file = 1;	if (run_diff_files(&rev, 0))		die(_("Could not write patch"));	launch_editor(file, NULL, NULL);	if (stat(file, &st))		die_errno(_("Could not stat '%s'"), file);	if (!st.st_size)		die(_("Empty patch. Aborted."));	memset(&child, 0, sizeof(child));	child.git_cmd = 1;	child.argv = apply_argv;	if (run_command(&child))		die(_("Could not apply '%s'"), file);	unlink(file);	free(file);	return 0;}
开发者ID:13leaf,项目名称:git,代码行数:49,


示例8: edit_patch

static int edit_patch(int argc, const char **argv, const char *prefix){	char *file = git_pathdup("ADD_EDIT.patch");	const char *apply_argv[] = { "apply", "--recount", "--cached",		NULL, NULL };	struct child_process child = CHILD_PROCESS_INIT;	struct rev_info rev;	int out;	struct stat st;	apply_argv[3] = file;	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */	if (read_cache() < 0)		die(_("Could not read the index"));	repo_init_revisions(the_repository, &rev, prefix);	rev.diffopt.context = 7;	argc = setup_revisions(argc, argv, &rev, NULL);	rev.diffopt.output_format = DIFF_FORMAT_PATCH;	rev.diffopt.use_color = 0;	rev.diffopt.flags.ignore_dirty_submodules = 1;	out = open(file, O_CREAT | O_WRONLY | O_TRUNC, 0666);	if (out < 0)		die(_("Could not open '%s' for writing."), file);	rev.diffopt.file = xfdopen(out, "w");	rev.diffopt.close_file = 1;	if (run_diff_files(&rev, 0))		die(_("Could not write patch"));	if (launch_editor(file, NULL, NULL))		die(_("editing patch failed"));	if (stat(file, &st))		die_errno(_("Could not stat '%s'"), file);	if (!st.st_size)		die(_("Empty patch. Aborted."));	child.git_cmd = 1;	child.argv = apply_argv;	if (run_command(&child))		die(_("Could not apply '%s'"), file);	unlink(file);	free(file);	return 0;}
开发者ID:Noffica,项目名称:git,代码行数:49,


示例9: split_one

/* Called with the first line (potentially partial) * already in buf[] -- normally that should begin with * the Unix "From " line.  Write it into the specified * file. */static int split_one(FILE *mbox, const char *name, int allow_bare){	FILE *output = NULL;	int fd;	int status = 0;	int is_bare = !is_from_line(buf.buf, buf.len);	if (is_bare && !allow_bare)		goto corrupt;	fd = open(name, O_WRONLY | O_CREAT | O_EXCL, 0666);	if (fd < 0)		die_errno("cannot open output file '%s'", name);	output = xfdopen(fd, "w");	/* Copy it out, while searching for a line that begins with	 * "From " and having something that looks like a date format.	 */	for (;;) {		if (!keep_cr && buf.len > 1 && buf.buf[buf.len-1] == '/n' &&			buf.buf[buf.len-2] == '/r') {			strbuf_setlen(&buf, buf.len-2);			strbuf_addch(&buf, '/n');		}		if (fwrite(buf.buf, 1, buf.len, output) != buf.len)			die_errno("cannot write output");		if (strbuf_getwholeline(&buf, mbox, '/n')) {			if (feof(mbox)) {				status = 1;				break;			}			die_errno("cannot read mbox");		}		if (!is_bare && is_from_line(buf.buf, buf.len))			break; /* done with one message */	}	fclose(output);	return status; corrupt:	if (output)		fclose(output);	unlink(name);	fprintf(stderr, "corrupt mailbox/n");	exit(1);}
开发者ID:asoltys,项目名称:git,代码行数:53,


示例10: get_helper

static struct ref *get_refs_list(struct transport *transport, int for_push){	struct child_process *helper;	struct ref *ret = NULL;	struct ref **tail = &ret;	struct ref *posn;	struct strbuf buf = STRBUF_INIT;	FILE *file;	helper = get_helper(transport);	write_str_in_full(helper->in, "list/n");	file = xfdopen(helper->out, "r");	while (1) {		char *eov, *eon;		if (strbuf_getline(&buf, file, '/n') == EOF)			exit(128); /* child died, message supplied already */		if (!*buf.buf)			break;		eov = strchr(buf.buf, ' ');		if (!eov)			die("Malformed response in ref list: %s", buf.buf);		eon = strchr(eov + 1, ' ');		*eov = '/0';		if (eon)			*eon = '/0';		*tail = alloc_ref(eov + 1);		if (buf.buf[0] == '@')			(*tail)->symref = xstrdup(buf.buf + 1);		else if (buf.buf[0] != '?')			get_sha1_hex(buf.buf, (*tail)->old_sha1);		tail = &((*tail)->next);	}	strbuf_release(&buf);	for (posn = ret; posn; posn = posn->next)		resolve_remote_symref(posn, ret);	return ret;}
开发者ID:asoltys,项目名称:git,代码行数:43,


示例11: do_rev_list

static int do_rev_list(int fd, void *create_full_pack){	int i;	struct rev_info revs;	pack_pipe = xfdopen(fd, "w");	init_revisions(&revs, NULL);	revs.tag_objects = 1;	revs.tree_objects = 1;	revs.blob_objects = 1;	if (use_thin_pack)		revs.edge_hint = 1;	if (create_full_pack) {		const char *args[] = {"rev-list", "--all", NULL};		setup_revisions(2, args, &revs, NULL);	} else {		for (i = 0; i < want_obj.nr; i++) {			struct object *o = want_obj.objects[i].item;			/* why??? */			o->flags &= ~UNINTERESTING;			add_pending_object(&revs, o, NULL);		}		for (i = 0; i < have_obj.nr; i++) {			struct object *o = have_obj.objects[i].item;			o->flags |= UNINTERESTING;			add_pending_object(&revs, o, NULL);		}		setup_revisions(0, NULL, &revs, NULL);	}	if (prepare_revision_walk(&revs))		die("revision walk setup failed");	mark_edges_uninteresting(revs.commits, &revs, show_edge);	if (use_thin_pack)		for (i = 0; i < extra_edge_obj.nr; i++)			fprintf(pack_pipe, "-%s/n", sha1_to_hex(					extra_edge_obj.objects[i].item->sha1));	traverse_commit_list(&revs, show_commit, show_object, NULL);	fflush(pack_pipe);	fclose(pack_pipe);	return 0;}
开发者ID:asoltys,项目名称:git,代码行数:42,


示例12: xcalloc

static struct child_process *get_helper(struct transport *transport){	struct helper_data *data = transport->data;	struct strbuf buf = STRBUF_INIT;	struct child_process *helper;	if (data->helper)		return data->helper;	helper = xcalloc(1, sizeof(*helper));	helper->in = -1;	helper->out = -1;	helper->err = 0;	helper->argv = xcalloc(4, sizeof(*helper->argv));	strbuf_addf(&buf, "remote-%s", data->name);	helper->argv[0] = strbuf_detach(&buf, NULL);	helper->argv[1] = transport->remote->name;	helper->argv[2] = transport->url;	helper->git_cmd = 1;	if (start_command(helper))		die("Unable to run helper: git %s", helper->argv[0]);	data->helper = helper;	write_str_in_full(helper->in, "capabilities/n");	data->out = xfdopen(helper->out, "r");	while (1) {		if (strbuf_getline(&buf, data->out, '/n') == EOF)			exit(128); /* child died, message supplied already */		if (!*buf.buf)			break;		if (!strcmp(buf.buf, "fetch"))			data->fetch = 1;		if (!strcmp(buf.buf, "option"))			data->option = 1;		if (!strcmp(buf.buf, "push"))			data->push = 1;	}	return data->helper;}
开发者ID:samv,项目名称:git,代码行数:41,


示例13: compute_and_write_prerequisites

static int compute_and_write_prerequisites(int bundle_fd,					   struct rev_info *revs,					   int argc, const char **argv){	struct child_process rls = CHILD_PROCESS_INIT;	struct strbuf buf = STRBUF_INIT;	FILE *rls_fout;	int i;	argv_array_pushl(&rls.args,			 "rev-list", "--boundary", "--pretty=oneline",			 NULL);	for (i = 1; i < argc; i++)		argv_array_push(&rls.args, argv[i]);	rls.out = -1;	rls.git_cmd = 1;	if (start_command(&rls))		return -1;	rls_fout = xfdopen(rls.out, "r");	while (strbuf_getwholeline(&buf, rls_fout, '/n') != EOF) {		unsigned char sha1[20];		if (buf.len > 0 && buf.buf[0] == '-') {			write_or_die(bundle_fd, buf.buf, buf.len);			if (!get_sha1_hex(buf.buf + 1, sha1)) {				struct object *object = parse_object_or_die(sha1, buf.buf);				object->flags |= UNINTERESTING;				add_pending_object(revs, object, buf.buf);			}		} else if (!get_sha1_hex(buf.buf, sha1)) {			struct object *object = parse_object_or_die(sha1, buf.buf);			object->flags |= SHOWN;		}	}	strbuf_release(&buf);	fclose(rls_fout);	if (finish_command(&rls))		return error(_("rev-list died"));	return 0;}
开发者ID:86joca,项目名称:git,代码行数:39,


示例14: write_commented_object

static void write_commented_object(int fd, const unsigned char *object){	const char *show_args[5] =		{"show", "--stat", "--no-notes", sha1_to_hex(object), NULL};	struct child_process show;	struct strbuf buf = STRBUF_INIT;	FILE *show_out;	/* Invoke "git show --stat --no-notes $object" */	memset(&show, 0, sizeof(show));	show.argv = show_args;	show.no_stdin = 1;	show.out = -1;	show.err = 0;	show.git_cmd = 1;	if (start_command(&show))		die("unable to start 'show' for object '%s'",		    sha1_to_hex(object));	/* Open the output as FILE* so strbuf_getline() can be used. */	show_out = xfdopen(show.out, "r");	if (show_out == NULL)		die_errno("can't fdopen 'show' output fd");	/* Prepend "# " to each output line and write result to 'fd' */	while (strbuf_getline(&buf, show_out, '/n') != EOF) {		write_or_die(fd, "# ", 2);		write_or_die(fd, buf.buf, buf.len);		write_or_die(fd, "/n", 1);	}	strbuf_release(&buf);	if (fclose(show_out))		die_errno("failed to close pipe to 'show' for object '%s'",			  sha1_to_hex(object));	if (finish_command(&show))		die("failed to finish 'show' for object '%s'",		    sha1_to_hex(object));}
开发者ID:flichtenheld,项目名称:git,代码行数:38,


示例15: fetch_with_fetch

static int fetch_with_fetch(struct transport *transport,			    int nr_heads, const struct ref **to_fetch){	struct child_process *helper = get_helper(transport);	FILE *file = xfdopen(helper->out, "r");	int i;	struct strbuf buf = STRBUF_INIT;	for (i = 0; i < nr_heads; i++) {		const struct ref *posn = to_fetch[i];		if (posn->status & REF_STATUS_UPTODATE)			continue;		strbuf_addf(&buf, "fetch %s %s/n",			    sha1_to_hex(posn->old_sha1), posn->name);		write_in_full(helper->in, buf.buf, buf.len);		strbuf_reset(&buf);		if (strbuf_getline(&buf, file, '/n') == EOF)			exit(128); /* child died, message supplied already */	}	return 0;}
开发者ID:asoltys,项目名称:git,代码行数:23,


示例16: pack_objects

/* * Make a pack stream and spit it out into file descriptor fd */static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, struct send_pack_args *args){	/*	 * The child becomes pack-objects --revs; we feed	 * the revision parameters to it via its stdin and	 * let its stdout go back to the other end.	 */	const char *argv[] = {		"pack-objects",		"--all-progress-implied",		"--revs",		"--stdout",		NULL,		NULL,		NULL,		NULL,		NULL,		NULL,	};	struct child_process po = CHILD_PROCESS_INIT;	FILE *po_in;	int i;	int rc;	i = 4;	if (args->use_thin_pack)		argv[i++] = "--thin";	if (args->use_ofs_delta)		argv[i++] = "--delta-base-offset";	if (args->quiet || !args->progress)		argv[i++] = "-q";	if (args->progress)		argv[i++] = "--progress";	if (is_repository_shallow())		argv[i++] = "--shallow";	po.argv = argv;	po.in = -1;	po.out = args->stateless_rpc ? -1 : fd;	po.git_cmd = 1;	if (start_command(&po))		die_errno("git pack-objects failed");	/*	 * We feed the pack-objects we just spawned with revision	 * parameters by writing to the pipe.	 */	po_in = xfdopen(po.in, "w");	for (i = 0; i < extra->nr; i++)		feed_object(extra->sha1[i], po_in, 1);	while (refs) {		if (!is_null_oid(&refs->old_oid))			feed_object(refs->old_oid.hash, po_in, 1);		if (!is_null_oid(&refs->new_oid))			feed_object(refs->new_oid.hash, po_in, 0);		refs = refs->next;	}	fflush(po_in);	if (ferror(po_in))		die_errno("error writing to pack-objects");	fclose(po_in);	if (args->stateless_rpc) {		char *buf = xmalloc(LARGE_PACKET_MAX);		while (1) {			ssize_t n = xread(po.out, buf, LARGE_PACKET_MAX);			if (n <= 0)				break;			send_sideband(fd, -1, buf, n, LARGE_PACKET_MAX);		}		free(buf);		close(po.out);		po.out = -1;	}	rc = finish_command(&po);	if (rc) {		/*		 * For a normal non-zero exit, we assume pack-objects wrote		 * something useful to stderr. For death by signal, though,		 * we should mention it to the user. The exception is SIGPIPE		 * (141), because that's a normal occurence if the remote end		 * hangs up (and we'll report that by trying to read the unpack		 * status).		 */		if (rc > 128 && rc != 141)			error("pack-objects died of signal %d", rc - 128);		return -1;	}	return 0;}
开发者ID:beyond2002,项目名称:GT813C,代码行数:95,


示例17: cmd_format_patch

//.........这里部分代码省略.........			rev.pending.objects[0].item->flags |= UNINTERESTING;			add_head_to_pending(&rev);		}		/*		 * Otherwise, it is "format-patch -22 HEAD", and/or		 * "format-patch --root HEAD".  The user wants		 * get_revision() to do the usual traversal.		 */	}	/*	 * We cannot move this anywhere earlier because we do want to	 * know if --root was given explicitly from the comand line.	 */	rev.show_root_diff = 1;	if (cover_letter) {		/* remember the range */		int i;		for (i = 0; i < rev.pending.nr; i++) {			struct object *o = rev.pending.objects[i].item;			if (!(o->flags & UNINTERESTING))				head = (struct commit *)o;		}		/* We can't generate a cover letter without any patches */		if (!head)			return 0;	}	if (ignore_if_in_upstream)		get_patch_ids(&rev, &ids, prefix);	if (!use_stdout)		realstdout = xfdopen(xdup(1), "w");	if (prepare_revision_walk(&rev))		die("revision walk setup failed");	rev.boundary = 1;	while ((commit = get_revision(&rev)) != NULL) {		if (commit->object.flags & BOUNDARY) {			boundary_count++;			origin = (boundary_count == 1) ? commit : NULL;			continue;		}		/* ignore merges */		if (commit->parents && commit->parents->next)			continue;		if (ignore_if_in_upstream &&				has_commit_patch_id(commit, &ids))			continue;		nr++;		list = xrealloc(list, nr * sizeof(list[0]));		list[nr - 1] = commit;	}	total = nr;	if (!keep_subject && auto_number && total > 1)		numbered = 1;	if (numbered)		rev.total = total + start_number - 1;	if (in_reply_to || thread || cover_letter)		rev.ref_message_ids = xcalloc(1, sizeof(struct string_list));	if (in_reply_to) {		const char *msgid = clean_message_id(in_reply_to);
开发者ID:samv,项目名称:git,代码行数:67,


示例18: pack_objects

/* * Make a pack stream and spit it out into file descriptor fd */static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, struct send_pack_args *args){	/*	 * The child becomes pack-objects --revs; we feed	 * the revision parameters to it via its stdin and	 * let its stdout go back to the other end.	 */	const char *argv[] = {		"pack-objects",		"--all-progress-implied",		"--revs",		"--stdout",		NULL,		NULL,		NULL,		NULL,		NULL,		NULL,	};	struct child_process po = CHILD_PROCESS_INIT;	FILE *po_in;	int i;	i = 4;	if (args->use_thin_pack)		argv[i++] = "--thin";	if (args->use_ofs_delta)		argv[i++] = "--delta-base-offset";	if (args->quiet || !args->progress)		argv[i++] = "-q";	if (args->progress)		argv[i++] = "--progress";	if (is_repository_shallow())		argv[i++] = "--shallow";	po.argv = argv;	po.in = -1;	po.out = args->stateless_rpc ? -1 : fd;	po.git_cmd = 1;	if (start_command(&po))		die_errno("git pack-objects failed");	/*	 * We feed the pack-objects we just spawned with revision	 * parameters by writing to the pipe.	 */	po_in = xfdopen(po.in, "w");	for (i = 0; i < extra->nr; i++)		feed_object(extra->sha1[i], po_in, 1);	while (refs) {		if (!is_null_oid(&refs->old_oid))			feed_object(refs->old_oid.hash, po_in, 1);		if (!is_null_oid(&refs->new_oid))			feed_object(refs->new_oid.hash, po_in, 0);		refs = refs->next;	}	fflush(po_in);	if (ferror(po_in))		die_errno("error writing to pack-objects");	fclose(po_in);	if (args->stateless_rpc) {		char *buf = xmalloc(LARGE_PACKET_MAX);		while (1) {			ssize_t n = xread(po.out, buf, LARGE_PACKET_MAX);			if (n <= 0)				break;			send_sideband(fd, -1, buf, n, LARGE_PACKET_MAX);		}		free(buf);		close(po.out);		po.out = -1;	}	if (finish_command(&po))		return -1;	return 0;}
开发者ID:tomyy,项目名称:git,代码行数:82,


示例19: run_dir_diff

static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,			int argc, const char **argv){	char tmpdir[PATH_MAX];	struct strbuf info = STRBUF_INIT, lpath = STRBUF_INIT;	struct strbuf rpath = STRBUF_INIT, buf = STRBUF_INIT;	struct strbuf ldir = STRBUF_INIT, rdir = STRBUF_INIT;	struct strbuf wtdir = STRBUF_INIT;	char *lbase_dir, *rbase_dir;	size_t ldir_len, rdir_len, wtdir_len;	const char *workdir, *tmp;	int ret = 0, i;	FILE *fp;	struct hashmap working_tree_dups, submodules, symlinks2;	struct hashmap_iter iter;	struct pair_entry *entry;	struct index_state wtindex;	struct checkout lstate, rstate;	int rc, flags = RUN_GIT_CMD, err = 0;	struct child_process child = CHILD_PROCESS_INIT;	const char *helper_argv[] = { "difftool--helper", NULL, NULL, NULL };	struct hashmap wt_modified, tmp_modified;	int indices_loaded = 0;	workdir = get_git_work_tree();	/* Setup temp directories */	tmp = getenv("TMPDIR");	xsnprintf(tmpdir, sizeof(tmpdir), "%s/git-difftool.XXXXXX", tmp ? tmp : "/tmp");	if (!mkdtemp(tmpdir))		return error("could not create '%s'", tmpdir);	strbuf_addf(&ldir, "%s/left/", tmpdir);	strbuf_addf(&rdir, "%s/right/", tmpdir);	strbuf_addstr(&wtdir, workdir);	if (!wtdir.len || !is_dir_sep(wtdir.buf[wtdir.len - 1]))		strbuf_addch(&wtdir, '/');	mkdir(ldir.buf, 0700);	mkdir(rdir.buf, 0700);	memset(&wtindex, 0, sizeof(wtindex));	memset(&lstate, 0, sizeof(lstate));	lstate.base_dir = lbase_dir = xstrdup(ldir.buf);	lstate.base_dir_len = ldir.len;	lstate.force = 1;	memset(&rstate, 0, sizeof(rstate));	rstate.base_dir = rbase_dir = xstrdup(rdir.buf);	rstate.base_dir_len = rdir.len;	rstate.force = 1;	ldir_len = ldir.len;	rdir_len = rdir.len;	wtdir_len = wtdir.len;	hashmap_init(&working_tree_dups,		     (hashmap_cmp_fn)working_tree_entry_cmp, NULL, 0);	hashmap_init(&submodules, (hashmap_cmp_fn)pair_cmp, NULL, 0);	hashmap_init(&symlinks2, (hashmap_cmp_fn)pair_cmp, NULL, 0);	child.no_stdin = 1;	child.git_cmd = 1;	child.use_shell = 0;	child.clean_on_exit = 1;	child.dir = prefix;	child.out = -1;	argv_array_pushl(&child.args, "diff", "--raw", "--no-abbrev", "-z",			 NULL);	for (i = 0; i < argc; i++)		argv_array_push(&child.args, argv[i]);	if (start_command(&child))		die("could not obtain raw diff");	fp = xfdopen(child.out, "r");	/* Build index info for left and right sides of the diff */	i = 0;	while (!strbuf_getline_nul(&info, fp)) {		int lmode, rmode;		struct object_id loid, roid;		char status;		const char *src_path, *dst_path;		if (starts_with(info.buf, "::"))			die(N_("combined diff formats('-c' and '--cc') are "			       "not supported in/n"			       "directory diff mode('-d' and '--dir-diff')."));		if (parse_index_info(info.buf, &lmode, &rmode, &loid, &roid,				     &status))			break;		if (strbuf_getline_nul(&lpath, fp))			break;		src_path = lpath.buf;		i++;		if (status != 'C' && status != 'R') {			dst_path = src_path;		} else {			if (strbuf_getline_nul(&rpath, fp))				break;			dst_path = rpath.buf;//.........这里部分代码省略.........
开发者ID:Litttle-butterfly,项目名称:git,代码行数:101,


示例20: create_bundle

int create_bundle(struct bundle_header *header, const char *path,		int argc, const char **argv){	static struct lock_file lock;	int bundle_fd = -1;	int bundle_to_stdout;	const char **argv_boundary = xmalloc((argc + 4) * sizeof(const char *));	const char **argv_pack = xmalloc(6 * sizeof(const char *));	int i, ref_count = 0;	struct strbuf buf = STRBUF_INIT;	struct rev_info revs;	struct child_process rls;	FILE *rls_fout;	bundle_to_stdout = !strcmp(path, "-");	if (bundle_to_stdout)		bundle_fd = 1;	else		bundle_fd = hold_lock_file_for_update(&lock, path,						      LOCK_DIE_ON_ERROR);	/* write signature */	write_or_die(bundle_fd, bundle_signature, strlen(bundle_signature));	/* init revs to list objects for pack-objects later */	save_commit_buffer = 0;	init_revisions(&revs, NULL);	/* write prerequisites */	memcpy(argv_boundary + 3, argv + 1, argc * sizeof(const char *));	argv_boundary[0] = "rev-list";	argv_boundary[1] = "--boundary";	argv_boundary[2] = "--pretty=oneline";	argv_boundary[argc + 2] = NULL;	memset(&rls, 0, sizeof(rls));	rls.argv = argv_boundary;	rls.out = -1;	rls.git_cmd = 1;	if (start_command(&rls))		return -1;	rls_fout = xfdopen(rls.out, "r");	while (strbuf_getwholeline(&buf, rls_fout, '/n') != EOF) {		unsigned char sha1[20];		if (buf.len > 0 && buf.buf[0] == '-') {			write_or_die(bundle_fd, buf.buf, buf.len);			if (!get_sha1_hex(buf.buf + 1, sha1)) {				struct object *object = parse_object(sha1);				object->flags |= UNINTERESTING;				add_pending_object(&revs, object, xstrdup(buf.buf));			}		} else if (!get_sha1_hex(buf.buf, sha1)) {			struct object *object = parse_object(sha1);			object->flags |= SHOWN;		}	}	strbuf_release(&buf);	fclose(rls_fout);	if (finish_command(&rls))		return error("rev-list died");	/* write references */	argc = setup_revisions(argc, argv, &revs, NULL);	if (argc > 1)		return error("unrecognized argument: %s", argv[1]);	object_array_remove_duplicates(&revs.pending);	for (i = 0; i < revs.pending.nr; i++) {		struct object_array_entry *e = revs.pending.objects + i;		unsigned char sha1[20];		char *ref;		const char *display_ref;		int flag;		if (e->item->flags & UNINTERESTING)			continue;		if (dwim_ref(e->name, strlen(e->name), sha1, &ref) != 1)			continue;		if (read_ref_full(e->name, sha1, 1, &flag))			flag = 0;		display_ref = (flag & REF_ISSYMREF) ? e->name : ref;		if (e->item->type == OBJ_TAG &&				!is_tag_in_date_range(e->item, &revs)) {			e->item->flags |= UNINTERESTING;			continue;		}		/*		 * Make sure the refs we wrote out is correct; --max-count and		 * other limiting options could have prevented all the tips		 * from getting output.		 *		 * Non commit objects such as tags and blobs do not have		 * this issue as they are not affected by those extra		 * constraints.		 */		if (!(e->item->flags & SHOWN) && e->item->type == OBJ_COMMIT) {			warning("ref '%s' is excluded by the rev-list options",//.........这里部分代码省略.........
开发者ID:avish,项目名称:git,代码行数:101,


示例21: create_pack_file

static void create_pack_file(void){	struct child_process pack_objects = CHILD_PROCESS_INIT;	char data[8193], progress[128];	char abort_msg[] = "aborting due to possible repository "		"corruption on the remote side.";	int buffered = -1;	ssize_t sz;	const char *argv[12];	int i, arg = 0;	FILE *pipe_fd;	if (shallow_nr) {		argv[arg++] = "--shallow-file";		argv[arg++] = "";	}	argv[arg++] = "pack-objects";	argv[arg++] = "--revs";	if (use_thin_pack)		argv[arg++] = "--thin";	argv[arg++] = "--stdout";	if (!no_progress)		argv[arg++] = "--progress";	if (use_ofs_delta)		argv[arg++] = "--delta-base-offset";	if (use_include_tag)		argv[arg++] = "--include-tag";	argv[arg++] = NULL;	pack_objects.in = -1;	pack_objects.out = -1;	pack_objects.err = -1;	pack_objects.git_cmd = 1;	pack_objects.argv = argv;	if (start_command(&pack_objects))		die("git upload-pack: unable to fork git-pack-objects");	pipe_fd = xfdopen(pack_objects.in, "w");	if (shallow_nr)		for_each_commit_graft(write_one_shallow, pipe_fd);	for (i = 0; i < want_obj.nr; i++)		fprintf(pipe_fd, "%s/n",			sha1_to_hex(want_obj.objects[i].item->sha1));	fprintf(pipe_fd, "--not/n");	for (i = 0; i < have_obj.nr; i++)		fprintf(pipe_fd, "%s/n",			sha1_to_hex(have_obj.objects[i].item->sha1));	for (i = 0; i < extra_edge_obj.nr; i++)		fprintf(pipe_fd, "%s/n",			sha1_to_hex(extra_edge_obj.objects[i].item->sha1));	fprintf(pipe_fd, "/n");	fflush(pipe_fd);	fclose(pipe_fd);	/* We read from pack_objects.err to capture stderr output for	 * progress bar, and pack_objects.out to capture the pack data.	 */	while (1) {		struct pollfd pfd[2];		int pe, pu, pollsize;		int ret;		reset_timeout();		pollsize = 0;		pe = pu = -1;		if (0 <= pack_objects.out) {			pfd[pollsize].fd = pack_objects.out;			pfd[pollsize].events = POLLIN;			pu = pollsize;			pollsize++;		}		if (0 <= pack_objects.err) {			pfd[pollsize].fd = pack_objects.err;			pfd[pollsize].events = POLLIN;			pe = pollsize;			pollsize++;		}		if (!pollsize)			break;		ret = poll(pfd, pollsize,			keepalive < 0 ? -1 : 1000 * keepalive);		if (ret < 0) {			if (errno != EINTR) {				error("poll failed, resuming: %s",				      strerror(errno));				sleep(1);			}			continue;		}		if (0 <= pe && (pfd[pe].revents & (POLLIN|POLLHUP))) {//.........这里部分代码省略.........
开发者ID:AViscatanius,项目名称:git,代码行数:101,


示例22: cmd_format_patch

//.........这里部分代码省略.........		if (!strcmp(rev.pending.objects[0].name, "HEAD"))			check_head = 1;		if (check_head) {			unsigned char sha1[20];			const char *ref, *v;			ref = resolve_ref_unsafe("HEAD", RESOLVE_REF_READING,						 sha1, NULL);			if (ref && skip_prefix(ref, "refs/heads/", &v))				branch_name = xstrdup(v);			else				branch_name = xstrdup(""); /* no branch */		}	}	/*	 * We cannot move this anywhere earlier because we do want to	 * know if --root was given explicitly from the command line.	 */	rev.show_root_diff = 1;	if (ignore_if_in_upstream) {		/* Don't say anything if head and upstream are the same. */		if (rev.pending.nr == 2) {			struct object_array_entry *o = rev.pending.objects;			if (hashcmp(o[0].item->sha1, o[1].item->sha1) == 0)				return 0;		}		get_patch_ids(&rev, &ids);	}	if (!use_stdout)		realstdout = xfdopen(xdup(1), "w");	if (prepare_revision_walk(&rev))		die(_("revision walk setup failed"));	rev.boundary = 1;	while ((commit = get_revision(&rev)) != NULL) {		if (commit->object.flags & BOUNDARY) {			boundary_count++;			origin = (boundary_count == 1) ? commit : NULL;			continue;		}		if (ignore_if_in_upstream &&				has_commit_patch_id(commit, &ids))			continue;		nr++;		REALLOC_ARRAY(list, nr);		list[nr - 1] = commit;	}	if (nr == 0)		/* nothing to do */		return 0;	total = nr;	if (!keep_subject && auto_number && total > 1)		numbered = 1;	if (numbered)		rev.total = total + start_number - 1;	if (cover_letter == -1) {		if (config_cover_letter == COVER_AUTO)			cover_letter = (total > 1);		else			cover_letter = (config_cover_letter == COVER_ON);
开发者ID:AbelTian,项目名称:git,代码行数:67,


示例23: xcalloc

static struct child_process *get_helper(struct transport *transport){	struct helper_data *data = transport->data;	struct strbuf buf = STRBUF_INIT;	struct child_process *helper;	const char **refspecs = NULL;	int refspec_nr = 0;	int refspec_alloc = 0;	int duped;	int code;	if (data->helper)		return data->helper;	helper = xcalloc(1, sizeof(*helper));	helper->in = -1;	helper->out = -1;	helper->err = 0;	helper->argv = xcalloc(4, sizeof(*helper->argv));	strbuf_addf(&buf, "git-remote-%s", data->name);	helper->argv[0] = strbuf_detach(&buf, NULL);	helper->argv[1] = transport->remote->name;	helper->argv[2] = remove_ext_force(transport->url);	helper->git_cmd = 0;	helper->silent_exec_failure = 1;	code = start_command(helper);	if (code < 0 && errno == ENOENT)		die("Unable to find remote helper for '%s'", data->name);	else if (code != 0)		exit(code);	data->helper = helper;	data->no_disconnect_req = 0;	/*	 * Open the output as FILE* so strbuf_getline() can be used.	 * Do this with duped fd because fclose() will close the fd,	 * and stuff like taking over will require the fd to remain.	 */	duped = dup(helper->out);	if (duped < 0)		die_errno("Can't dup helper output fd");	data->out = xfdopen(duped, "r");	write_constant(helper->in, "capabilities/n");	while (1) {		const char *capname;		int mandatory = 0;		recvline(data, &buf);		if (!*buf.buf)			break;		if (*buf.buf == '*') {			capname = buf.buf + 1;			mandatory = 1;		} else			capname = buf.buf;		if (debug)			fprintf(stderr, "Debug: Got cap %s/n", capname);		if (!strcmp(capname, "fetch"))			data->fetch = 1;		else if (!strcmp(capname, "option"))			data->option = 1;		else if (!strcmp(capname, "push"))			data->push = 1;		else if (!strcmp(capname, "import"))			data->import = 1;		else if (!data->refspecs && !prefixcmp(capname, "refspec ")) {			ALLOC_GROW(refspecs,				   refspec_nr + 1,				   refspec_alloc);			refspecs[refspec_nr++] = strdup(buf.buf + strlen("refspec "));		} else if (!strcmp(capname, "connect")) {			data->connect = 1;		} else if (mandatory) {			die("Unknown mandatory capability %s. This remote "			    "helper probably needs newer version of Git./n",			    capname);		}	}	if (refspecs) {		int i;		data->refspec_nr = refspec_nr;		data->refspecs = parse_fetch_refspec(refspec_nr, refspecs);		for (i = 0; i < refspec_nr; i++) {			free((char *)refspecs[i]);		}		free(refspecs);	}	strbuf_release(&buf);	if (debug)		fprintf(stderr, "Debug: Capabilities complete./n");	return data->helper;}
开发者ID:astubbs,项目名称:git,代码行数:97,


示例24: output_skeleton

static voidoutput_skeleton (void){  int filter_fd[2];  pid_t pid;  /* Compute the names of the package data dir and skeleton files.  */  char const *m4 = (m4 = getenv ("M4")) ? m4 : M4;  char const *datadir = pkgdatadir ();  char *m4sugar = xconcatenated_filename (datadir, "m4sugar/m4sugar.m4", NULL);  char *m4bison = xconcatenated_filename (datadir, "bison.m4", NULL);  char *skel = (IS_PATH_WITH_DIR (skeleton)                ? xstrdup (skeleton)                : xconcatenated_filename (datadir, skeleton, NULL));  /* Test whether m4sugar.m4 is readable, to check for proper     installation.  A faulty installation can cause deadlock, so a     cheap sanity check is worthwhile.  */  xfclose (xfopen (m4sugar, "r"));  /* Create an m4 subprocess connected to us via two pipes.  */  if (trace_flag & trace_tools)    fprintf (stderr, "running: %s %s - %s %s/n",             m4, m4sugar, m4bison, skel);  /* Some future version of GNU M4 (most likely 1.6) may treat the -dV in a     position-dependent manner.  Keep it as the first argument so that all     files are traced.     See the thread starting at     <http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>     for details.  */  {    char const *argv[10];    int i = 0;    argv[i++] = m4;    /* When POSIXLY_CORRECT is set, GNU M4 1.6 and later disable GNU       extensions, which Bison's skeletons depend on.  With older M4,       it has no effect.  M4 1.4.12 added a -g/--gnu command-line       option to make it explicit that a program wants GNU M4       extensions even when POSIXLY_CORRECT is set.       See the thread starting at       <http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>       for details.  */    if (*M4_GNU_OPTION)      argv[i++] = M4_GNU_OPTION;    argv[i++] = "-I";    argv[i++] = datadir;    if (trace_flag & trace_m4)      argv[i++] = "-dV";    argv[i++] = m4sugar;    argv[i++] = "-";    argv[i++] = m4bison;    argv[i++] = skel;    argv[i++] = NULL;    aver (i <= ARRAY_CARDINALITY (argv));    /* The ugly cast is because gnulib gets the const-ness wrong.  */    pid = create_pipe_bidi ("m4", m4, (char **)(void*)argv, false, true,                            true, filter_fd);  }  free (m4sugar);  free (m4bison);  free (skel);  if (trace_flag & trace_muscles)    muscles_output (stderr);  {    FILE *out = xfdopen (filter_fd[1], "w");    muscles_output (out);    xfclose (out);  }  /* Read and process m4's output.  */  timevar_push (TV_M4);  {    FILE *in = xfdopen (filter_fd[0], "r");    scan_skel (in);    /* scan_skel should have read all of M4's output.  Otherwise, when we       close the pipe, we risk letting M4 report a broken-pipe to the       Bison user.  */    aver (feof (in));    xfclose (in);  }  wait_subprocess (pid, "m4", false, false, true, true, NULL);  timevar_pop (TV_M4);}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:92,


示例25: create_pack_file

static void create_pack_file(void){	struct async rev_list;	struct child_process pack_objects;	int create_full_pack = (nr_our_refs == want_obj.nr && !have_obj.nr);	char data[8193], progress[128];	char abort_msg[] = "aborting due to possible repository "		"corruption on the remote side.";	int buffered = -1;	ssize_t sz;	const char *argv[10];	int arg = 0;	argv[arg++] = "pack-objects";	if (!shallow_nr) {		argv[arg++] = "--revs";		if (create_full_pack)			argv[arg++] = "--all";		else if (use_thin_pack)			argv[arg++] = "--thin";	}	argv[arg++] = "--stdout";	if (!no_progress)		argv[arg++] = "--progress";	if (use_ofs_delta)		argv[arg++] = "--delta-base-offset";	if (use_include_tag)		argv[arg++] = "--include-tag";	argv[arg++] = NULL;	memset(&pack_objects, 0, sizeof(pack_objects));	pack_objects.in = -1;	pack_objects.out = -1;	pack_objects.err = -1;	pack_objects.git_cmd = 1;	pack_objects.argv = argv;	if (start_command(&pack_objects))		die("git upload-pack: unable to fork git-pack-objects");	if (shallow_nr) {		memset(&rev_list, 0, sizeof(rev_list));		rev_list.proc = do_rev_list;		rev_list.out = pack_objects.in;		if (start_async(&rev_list))			die("git upload-pack: unable to fork git-rev-list");	}	else {		FILE *pipe_fd = xfdopen(pack_objects.in, "w");		if (!create_full_pack) {			int i;			for (i = 0; i < want_obj.nr; i++)				fprintf(pipe_fd, "%s/n", sha1_to_hex(want_obj.objects[i].item->sha1));			fprintf(pipe_fd, "--not/n");			for (i = 0; i < have_obj.nr; i++)				fprintf(pipe_fd, "%s/n", sha1_to_hex(have_obj.objects[i].item->sha1));		}		fprintf(pipe_fd, "/n");		fflush(pipe_fd);		fclose(pipe_fd);	}	/* We read from pack_objects.err to capture stderr output for	 * progress bar, and pack_objects.out to capture the pack data.	 */	while (1) {		struct pollfd pfd[2];		int pe, pu, pollsize;		reset_timeout();		pollsize = 0;		pe = pu = -1;		if (0 <= pack_objects.out) {			pfd[pollsize].fd = pack_objects.out;			pfd[pollsize].events = POLLIN;			pu = pollsize;			pollsize++;		}		if (0 <= pack_objects.err) {			pfd[pollsize].fd = pack_objects.err;			pfd[pollsize].events = POLLIN;			pe = pollsize;			pollsize++;		}		if (!pollsize)			break;		if (poll(pfd, pollsize, -1) < 0) {			if (errno != EINTR) {				error("poll failed, resuming: %s",				      strerror(errno));				sleep(1);			}//.........这里部分代码省略.........
开发者ID:Wushaowei001,项目名称:omnibus,代码行数:101,


示例26: cmd_format_patch

//.........这里部分代码省略.........	if (rev.pending.nr == 1) {		if (rev.max_count < 0 && !rev.show_root_diff) {			/*			 * This is traditional behaviour of "git format-patch			 * origin" that prepares what the origin side still			 * does not have.			 */			rev.pending.objects[0].item->flags |= UNINTERESTING;			add_head_to_pending(&rev);		}		/*		 * Otherwise, it is "format-patch -22 HEAD", and/or		 * "format-patch --root HEAD".  The user wants		 * get_revision() to do the usual traversal.		 */	}	if (cover_letter) {		/* remember the range */		int i;		for (i = 0; i < rev.pending.nr; i++) {			struct object *o = rev.pending.objects[i].item;			if (!(o->flags & UNINTERESTING))				head = (struct commit *)o;		}		/* We can't generate a cover letter without any patches */		if (!head)			return 0;	}	if (ignore_if_in_upstream)		get_patch_ids(&rev, &ids, prefix);	if (!use_stdout)		realstdout = xfdopen(xdup(1), "w");	if (prepare_revision_walk(&rev))		die("revision walk setup failed");	rev.boundary = 1;	while ((commit = get_revision(&rev)) != NULL) {		if (commit->object.flags & BOUNDARY) {			boundary_count++;			origin = (boundary_count == 1) ? commit : NULL;			continue;		}		/* ignore merges */		if (commit->parents && commit->parents->next)			continue;		if (ignore_if_in_upstream &&				has_commit_patch_id(commit, &ids))			continue;		nr++;		list = xrealloc(list, nr * sizeof(list[0]));		list[nr - 1] = commit;	}	total = nr;	if (!keep_subject && auto_number && total > 1)		numbered = 1;	if (numbered)		rev.total = total + start_number - 1;	if (in_reply_to)		rev.ref_message_id = clean_message_id(in_reply_to);	if (cover_letter) {		if (thread)
开发者ID:Inkdit,项目名称:git,代码行数:67,



注:本文中的xfdopen函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ xfopen函数代码示例
C++ xfault函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。