Merge branch 'jk/bundle-use-dash-for-stdfiles'
"git bundle" learned that "-" is a common way to say that the input comes from the standard input and/or the output goes to the standard output. It used to work only for output and only from the root level of the working tree. * jk/bundle-use-dash-for-stdfiles: parse-options: use prefix_filename_except_for_dash() helper parse-options: consistently allocate memory in fix_filename() bundle: don't blindly apply prefix_filename() to "-" bundle: document handling of "-" as stdin bundle: let "-" mean stdin for reading operations
This commit is contained in:
@@ -59,12 +59,12 @@ static enum parse_opt_result get_arg(struct parse_opt_ctx_t *p,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void fix_filename(const char *prefix, const char **file)
|
||||
static void fix_filename(const char *prefix, char **file)
|
||||
{
|
||||
if (!file || !*file || !prefix || is_absolute_path(*file)
|
||||
|| !strcmp("-", *file))
|
||||
return;
|
||||
*file = prefix_filename(prefix, *file);
|
||||
if (!file || !*file)
|
||||
; /* leave as NULL */
|
||||
else
|
||||
*file = prefix_filename_except_for_dash(prefix, *file);
|
||||
}
|
||||
|
||||
static enum parse_opt_result opt_command_mode_error(
|
||||
@@ -177,7 +177,7 @@ static enum parse_opt_result get_value(struct parse_opt_ctx_t *p,
|
||||
err = get_arg(p, opt, flags, (const char **)opt->value);
|
||||
|
||||
if (!err)
|
||||
fix_filename(p->prefix, (const char **)opt->value);
|
||||
fix_filename(p->prefix, (char **)opt->value);
|
||||
return err;
|
||||
|
||||
case OPTION_CALLBACK:
|
||||
|
||||
Reference in New Issue
Block a user