Skip to content

Commit ef567fe

Browse files
committed
Merge branch 'ab/bundle'
* ab/bundle: Teach git-bundle to read revision arguments from stdin like git-rev-list.
2 parents 69b060c + 22568f0 commit ef567fe

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

bundle.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ int create_bundle(struct bundle_header *header, const char *path,
178178
int i, ref_count = 0;
179179
char buffer[1024];
180180
struct rev_info revs;
181+
int read_from_stdin = 0;
181182
struct child_process rls;
182183
FILE *rls_fout;
183184

@@ -227,8 +228,16 @@ int create_bundle(struct bundle_header *header, const char *path,
227228

228229
/* write references */
229230
argc = setup_revisions(argc, argv, &revs, NULL);
230-
if (argc > 1)
231-
return error("unrecognized argument: %s'", argv[1]);
231+
232+
for (i = 1; i < argc; i++) {
233+
if (!strcmp(argv[i], "--stdin")) {
234+
if (read_from_stdin++)
235+
die("--stdin given twice?");
236+
read_revisions_from_stdin(&revs);
237+
continue;
238+
}
239+
return error("unrecognized argument: %s'", argv[i]);
240+
}
232241

233242
for (i = 0; i < revs.pending.nr; i++) {
234243
struct object_array_entry *e = revs.pending.objects + i;

0 commit comments

Comments
 (0)