Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--abspath.c7
-rw-r--r--builtin/bundle.c2
-rw-r--r--cache.h3
-rwxr-xr-xt/t6020-bundle-misc.sh11
4 files changed, 22 insertions, 1 deletions
diff --git a/abspath.c b/abspath.c
index 39e06b5848..9a81c5525b 100644
--- a/abspath.c
+++ b/abspath.c
@@ -280,3 +280,10 @@ char *prefix_filename(const char *pfx, const char *arg)
#endif
return strbuf_detach(&path, NULL);
}
+
+char *prefix_filename_except_for_dash(const char *pfx, const char *arg)
+{
+ if (!strcmp(arg, "-"))
+ return xstrdup(arg);
+ return prefix_filename(pfx, arg);
+}
diff --git a/builtin/bundle.c b/builtin/bundle.c
index 02dab1cfa0..eca39b64bf 100644
--- a/builtin/bundle.c
+++ b/builtin/bundle.c
@@ -59,7 +59,7 @@ static int parse_options_cmd_bundle(int argc,
PARSE_OPT_STOP_AT_NON_OPTION);
if (!argc)
usage_msg_opt(_("need a <file> argument"), usagestr, options);
- *bundle_file = prefix_filename(prefix, argv[0]);
+ *bundle_file = prefix_filename_except_for_dash(prefix, argv[0]);
return argc;
}
diff --git a/cache.h b/cache.h
index fcf49706ad..d21b19a402 100644
--- a/cache.h
+++ b/cache.h
@@ -634,6 +634,9 @@ char *prefix_path_gently(const char *prefix, int len, int *remaining, const char
*/
char *prefix_filename(const char *prefix, const char *path);
+/* Likewise, but path=="-" always yields "-" */
+char *prefix_filename_except_for_dash(const char *prefix, const char *path);
+
int check_filename(const char *prefix, const char *name);
void verify_filename(const char *prefix,
const char *name,
diff --git a/t/t6020-bundle-misc.sh b/t/t6020-bundle-misc.sh
index 063e8ce6b4..7fc39660f1 100755
--- a/t/t6020-bundle-misc.sh
+++ b/t/t6020-bundle-misc.sh
@@ -581,4 +581,15 @@ test_expect_success 'read bundle over stdin' '
test_cmp expect actual
'
+test_expect_success 'send a bundle to standard output' '
+ git bundle create - --all HEAD >bundle-one &&
+ mkdir -p down &&
+ git -C down bundle create - --all HEAD >bundle-two &&
+ git bundle verify bundle-one &&
+ git bundle verify bundle-two &&
+ git ls-remote bundle-one >expect &&
+ git ls-remote bundle-two >actual &&
+ test_cmp expect actual
+'
+
test_done