зеркало из https://github.com/microsoft/git.git
Merge branch 'js/default-branch-name'
The name of the primary branch in existing repositories, and the default name used for the first branch in newly created repositories, is made configurable, so that we can eventually wean ourselves off of the hardcoded 'master'. * js/default-branch-name: contrib: subtree: adjust test to change in fmt-merge-msg testsvn: respect `init.defaultBranch` remote: use the configured default branch name when appropriate clone: use configured default branch name when appropriate init: allow setting the default for the initial branch name via the config init: allow specifying the initial branch name for the new repository docs: add missing diamond brackets submodule: fall back to remote's HEAD for missing remote.<name>.branch send-pack/transport-helper: avoid mentioning a particular branch fmt-merge-msg: stop treating `master` specially
This commit is contained in:
Коммит
11cbda2add
|
@ -1,3 +1,7 @@
|
||||||
init.templateDir::
|
init.templateDir::
|
||||||
Specify the directory from which templates will be copied.
|
Specify the directory from which templates will be copied.
|
||||||
(See the "TEMPLATE DIRECTORY" section of linkgit:git-init[1].)
|
(See the "TEMPLATE DIRECTORY" section of linkgit:git-init[1].)
|
||||||
|
|
||||||
|
init.defaultBranch::
|
||||||
|
Allows overriding the default branch name e.g. when initializing
|
||||||
|
a new repository or when cloning an empty repository.
|
||||||
|
|
|
@ -12,7 +12,7 @@ SYNOPSIS
|
||||||
[-v [--abbrev=<length> | --no-abbrev]]
|
[-v [--abbrev=<length> | --no-abbrev]]
|
||||||
[--column[=<options>] | --no-column] [--sort=<key>]
|
[--column[=<options>] | --no-column] [--sort=<key>]
|
||||||
[(--merged | --no-merged) [<commit>]]
|
[(--merged | --no-merged) [<commit>]]
|
||||||
[--contains [<commit]] [--no-contains [<commit>]]
|
[--contains [<commit>]] [--no-contains [<commit>]]
|
||||||
[--points-at <object>] [--format=<format>]
|
[--points-at <object>] [--format=<format>]
|
||||||
[(-r | --remotes) | (-a | --all)]
|
[(-r | --remotes) | (-a | --all)]
|
||||||
[--list] [<pattern>...]
|
[--list] [<pattern>...]
|
||||||
|
|
|
@ -259,7 +259,7 @@ maintain a branch with no references other than a single cloned
|
||||||
branch. This is useful e.g. to maintain minimal clones of the default
|
branch. This is useful e.g. to maintain minimal clones of the default
|
||||||
branch of some repository for search indexing.
|
branch of some repository for search indexing.
|
||||||
|
|
||||||
--recurse-submodules[=<pathspec]::
|
--recurse-submodules[=<pathspec>]::
|
||||||
After the clone is created, initialize and clone submodules
|
After the clone is created, initialize and clone submodules
|
||||||
within based on the provided pathspec. If no pathspec is
|
within based on the provided pathspec. If no pathspec is
|
||||||
provided, all submodules are initialized and cloned.
|
provided, all submodules are initialized and cloned.
|
||||||
|
|
|
@ -10,7 +10,8 @@ SYNOPSIS
|
||||||
--------
|
--------
|
||||||
[verse]
|
[verse]
|
||||||
'git init' [-q | --quiet] [--bare] [--template=<template_directory>]
|
'git init' [-q | --quiet] [--bare] [--template=<template_directory>]
|
||||||
[--separate-git-dir <git dir>] [--object-format=<format]
|
[--separate-git-dir <git dir>] [--object-format=<format>]
|
||||||
|
[-b <branch-name> | --initial-branch=<branch-name>]
|
||||||
[--shared[=<permissions>]] [directory]
|
[--shared[=<permissions>]] [directory]
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,6 +68,12 @@ repository.
|
||||||
+
|
+
|
||||||
If this is reinitialization, the repository will be moved to the specified path.
|
If this is reinitialization, the repository will be moved to the specified path.
|
||||||
|
|
||||||
|
-b <branch-name::
|
||||||
|
--initial-branch=<branch-name>::
|
||||||
|
|
||||||
|
Use the specified name for the initial branch in the newly created repository.
|
||||||
|
If not specified, fall back to the default name: `master`.
|
||||||
|
|
||||||
--shared[=(false|true|umask|group|all|world|everybody|0xxx)]::
|
--shared[=(false|true|umask|group|all|world|everybody|0xxx)]::
|
||||||
|
|
||||||
Specify that the Git repository is to be shared amongst several users. This
|
Specify that the Git repository is to be shared amongst several users. This
|
||||||
|
|
|
@ -183,7 +183,7 @@ set-branch (-d|--default) [--] <path>::
|
||||||
Sets the default remote tracking branch for the submodule. The
|
Sets the default remote tracking branch for the submodule. The
|
||||||
`--branch` option allows the remote branch to be specified. The
|
`--branch` option allows the remote branch to be specified. The
|
||||||
`--default` option removes the submodule.<name>.branch configuration
|
`--default` option removes the submodule.<name>.branch configuration
|
||||||
key, which causes the tracking branch to default to 'master'.
|
key, which causes the tracking branch to default to the remote 'HEAD'.
|
||||||
|
|
||||||
set-url [--] <path> <newurl>::
|
set-url [--] <path> <newurl>::
|
||||||
Sets the URL of the specified submodule to <newurl>. Then, it will
|
Sets the URL of the specified submodule to <newurl>. Then, it will
|
||||||
|
@ -284,7 +284,7 @@ OPTIONS
|
||||||
`.gitmodules` for `update --remote`. A special value of `.` is used to
|
`.gitmodules` for `update --remote`. A special value of `.` is used to
|
||||||
indicate that the name of the branch in the submodule should be the
|
indicate that the name of the branch in the submodule should be the
|
||||||
same name as the current branch in the current repository. If the
|
same name as the current branch in the current repository. If the
|
||||||
option is not specified, it defaults to 'master'.
|
option is not specified, it defaults to the remote 'HEAD'.
|
||||||
|
|
||||||
-f::
|
-f::
|
||||||
--force::
|
--force::
|
||||||
|
@ -322,10 +322,10 @@ OPTIONS
|
||||||
the superproject's recorded SHA-1 to update the submodule, use the
|
the superproject's recorded SHA-1 to update the submodule, use the
|
||||||
status of the submodule's remote-tracking branch. The remote used
|
status of the submodule's remote-tracking branch. The remote used
|
||||||
is branch's remote (`branch.<name>.remote`), defaulting to `origin`.
|
is branch's remote (`branch.<name>.remote`), defaulting to `origin`.
|
||||||
The remote branch used defaults to `master`, but the branch name may
|
The remote branch used defaults to the remote `HEAD`, but the branch
|
||||||
be overridden by setting the `submodule.<name>.branch` option in
|
name may be overridden by setting the `submodule.<name>.branch`
|
||||||
either `.gitmodules` or `.git/config` (with `.git/config` taking
|
option in either `.gitmodules` or `.git/config` (with `.git/config`
|
||||||
precedence).
|
taking precedence).
|
||||||
+
|
+
|
||||||
This works for any of the supported update procedures (`--checkout`,
|
This works for any of the supported update procedures (`--checkout`,
|
||||||
`--rebase`, etc.). The only change is the source of the target SHA-1.
|
`--rebase`, etc.). The only change is the source of the target SHA-1.
|
||||||
|
|
|
@ -49,9 +49,9 @@ submodule.<name>.update::
|
||||||
|
|
||||||
submodule.<name>.branch::
|
submodule.<name>.branch::
|
||||||
A remote branch name for tracking updates in the upstream submodule.
|
A remote branch name for tracking updates in the upstream submodule.
|
||||||
If the option is not specified, it defaults to 'master'. A special
|
If the option is not specified, it defaults to the remote 'HEAD'.
|
||||||
value of `.` is used to indicate that the name of the branch in the
|
A special value of `.` is used to indicate that the name of the branch
|
||||||
submodule should be the same name as the current branch in the
|
in the submodule should be the same name as the current branch in the
|
||||||
current repository. See the `--remote` documentation in
|
current repository. See the `--remote` documentation in
|
||||||
linkgit:git-submodule[1] for details.
|
linkgit:git-submodule[1] for details.
|
||||||
|
|
||||||
|
|
|
@ -1111,7 +1111,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init_db(git_dir, real_git_dir, option_template, GIT_HASH_UNKNOWN, INIT_DB_QUIET);
|
init_db(git_dir, real_git_dir, option_template, GIT_HASH_UNKNOWN, NULL,
|
||||||
|
INIT_DB_QUIET);
|
||||||
|
|
||||||
if (real_git_dir)
|
if (real_git_dir)
|
||||||
git_dir = real_git_dir;
|
git_dir = real_git_dir;
|
||||||
|
@ -1275,9 +1276,13 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
||||||
remote_head_points_at = NULL;
|
remote_head_points_at = NULL;
|
||||||
remote_head = NULL;
|
remote_head = NULL;
|
||||||
option_no_checkout = 1;
|
option_no_checkout = 1;
|
||||||
if (!option_bare)
|
if (!option_bare) {
|
||||||
install_branch_config(0, "master", option_origin,
|
const char *branch = git_default_branch_name();
|
||||||
"refs/heads/master");
|
char *ref = xstrfmt("refs/heads/%s", branch);
|
||||||
|
|
||||||
|
install_branch_config(0, branch, option_origin, ref);
|
||||||
|
free(ref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
write_refspec_config(src_ref_prefix, our_head_points_at,
|
write_refspec_config(src_ref_prefix, our_head_points_at,
|
||||||
|
|
|
@ -203,6 +203,7 @@ void initialize_repository_version(int hash_algo)
|
||||||
|
|
||||||
static int create_default_files(const char *template_path,
|
static int create_default_files(const char *template_path,
|
||||||
const char *original_git_dir,
|
const char *original_git_dir,
|
||||||
|
const char *initial_branch,
|
||||||
const struct repository_format *fmt)
|
const struct repository_format *fmt)
|
||||||
{
|
{
|
||||||
struct stat st1;
|
struct stat st1;
|
||||||
|
@ -258,15 +259,26 @@ static int create_default_files(const char *template_path,
|
||||||
die("failed to set up refs db: %s", err.buf);
|
die("failed to set up refs db: %s", err.buf);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the default symlink from ".git/HEAD" to the "master"
|
* Point the HEAD symref to the initial branch with if HEAD does
|
||||||
* branch, if it does not exist yet.
|
* not yet exist.
|
||||||
*/
|
*/
|
||||||
path = git_path_buf(&buf, "HEAD");
|
path = git_path_buf(&buf, "HEAD");
|
||||||
reinit = (!access(path, R_OK)
|
reinit = (!access(path, R_OK)
|
||||||
|| readlink(path, junk, sizeof(junk)-1) != -1);
|
|| readlink(path, junk, sizeof(junk)-1) != -1);
|
||||||
if (!reinit) {
|
if (!reinit) {
|
||||||
if (create_symref("HEAD", "refs/heads/master", NULL) < 0)
|
char *ref;
|
||||||
|
|
||||||
|
if (!initial_branch)
|
||||||
|
initial_branch = git_default_branch_name();
|
||||||
|
|
||||||
|
ref = xstrfmt("refs/heads/%s", initial_branch);
|
||||||
|
if (check_refname_format(ref, 0) < 0)
|
||||||
|
die(_("invalid initial branch name: '%s'"),
|
||||||
|
initial_branch);
|
||||||
|
|
||||||
|
if (create_symref("HEAD", ref, NULL) < 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
free(ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize_repository_version(fmt->hash_algo);
|
initialize_repository_version(fmt->hash_algo);
|
||||||
|
@ -383,7 +395,8 @@ static void validate_hash_algorithm(struct repository_format *repo_fmt, int hash
|
||||||
}
|
}
|
||||||
|
|
||||||
int init_db(const char *git_dir, const char *real_git_dir,
|
int init_db(const char *git_dir, const char *real_git_dir,
|
||||||
const char *template_dir, int hash, unsigned int flags)
|
const char *template_dir, int hash, const char *initial_branch,
|
||||||
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
int reinit;
|
int reinit;
|
||||||
int exist_ok = flags & INIT_DB_EXIST_OK;
|
int exist_ok = flags & INIT_DB_EXIST_OK;
|
||||||
|
@ -425,7 +438,11 @@ int init_db(const char *git_dir, const char *real_git_dir,
|
||||||
|
|
||||||
validate_hash_algorithm(&repo_fmt, hash);
|
validate_hash_algorithm(&repo_fmt, hash);
|
||||||
|
|
||||||
reinit = create_default_files(template_dir, original_git_dir, &repo_fmt);
|
reinit = create_default_files(template_dir, original_git_dir,
|
||||||
|
initial_branch, &repo_fmt);
|
||||||
|
if (reinit && initial_branch)
|
||||||
|
warning(_("re-init: ignored --initial-branch=%s"),
|
||||||
|
initial_branch);
|
||||||
|
|
||||||
create_object_directory();
|
create_object_directory();
|
||||||
|
|
||||||
|
@ -528,6 +545,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
|
||||||
const char *template_dir = NULL;
|
const char *template_dir = NULL;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
const char *object_format = NULL;
|
const char *object_format = NULL;
|
||||||
|
const char *initial_branch = NULL;
|
||||||
int hash_algo = GIT_HASH_UNKNOWN;
|
int hash_algo = GIT_HASH_UNKNOWN;
|
||||||
const struct option init_db_options[] = {
|
const struct option init_db_options[] = {
|
||||||
OPT_STRING(0, "template", &template_dir, N_("template-directory"),
|
OPT_STRING(0, "template", &template_dir, N_("template-directory"),
|
||||||
|
@ -541,6 +559,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
|
||||||
OPT_BIT('q', "quiet", &flags, N_("be quiet"), INIT_DB_QUIET),
|
OPT_BIT('q', "quiet", &flags, N_("be quiet"), INIT_DB_QUIET),
|
||||||
OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
|
OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
|
||||||
N_("separate git dir from working tree")),
|
N_("separate git dir from working tree")),
|
||||||
|
OPT_STRING('b', "initial-branch", &initial_branch, N_("name"),
|
||||||
|
N_("override the name of the initial branch")),
|
||||||
OPT_STRING(0, "object-format", &object_format, N_("hash"),
|
OPT_STRING(0, "object-format", &object_format, N_("hash"),
|
||||||
N_("specify the hash algorithm to use")),
|
N_("specify the hash algorithm to use")),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
|
@ -652,5 +672,6 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
|
||||||
UNLEAK(work_tree);
|
UNLEAK(work_tree);
|
||||||
|
|
||||||
flags |= INIT_DB_EXIST_OK;
|
flags |= INIT_DB_EXIST_OK;
|
||||||
return init_db(git_dir, real_git_dir, template_dir, hash_algo, flags);
|
return init_db(git_dir, real_git_dir, template_dir, hash_algo,
|
||||||
|
initial_branch, flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1981,7 +1981,7 @@ static const char *remote_submodule_branch(const char *path)
|
||||||
free(key);
|
free(key);
|
||||||
|
|
||||||
if (!branch)
|
if (!branch)
|
||||||
return "master";
|
return "HEAD";
|
||||||
|
|
||||||
if (!strcmp(branch, ".")) {
|
if (!strcmp(branch, ".")) {
|
||||||
const char *refname = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
|
const char *refname = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
|
||||||
|
|
2
cache.h
2
cache.h
|
@ -628,7 +628,7 @@ int path_inside_repo(const char *prefix, const char *path);
|
||||||
|
|
||||||
int init_db(const char *git_dir, const char *real_git_dir,
|
int init_db(const char *git_dir, const char *real_git_dir,
|
||||||
const char *template_dir, int hash_algo,
|
const char *template_dir, int hash_algo,
|
||||||
unsigned int flags);
|
const char *initial_branch, unsigned int flags);
|
||||||
void initialize_repository_version(int hash_algo);
|
void initialize_repository_version(int hash_algo);
|
||||||
|
|
||||||
void sanitize_stdfds(void);
|
void sanitize_stdfds(void);
|
||||||
|
|
|
@ -196,7 +196,8 @@ test_expect_success 'merge new subproj history into sub dir/ with --prefix' '
|
||||||
cd "$subtree_test_count" &&
|
cd "$subtree_test_count" &&
|
||||||
git fetch ./"sub proj" master &&
|
git fetch ./"sub proj" master &&
|
||||||
git subtree merge --prefix="sub dir" FETCH_HEAD &&
|
git subtree merge --prefix="sub dir" FETCH_HEAD &&
|
||||||
check_equal "$(last_commit_message)" "Merge commit '\''$(git rev-parse FETCH_HEAD)'\''"
|
check_equal "$(last_commit_message)" \
|
||||||
|
"Merge commit '\''$(git rev-parse FETCH_HEAD)'\'' into master"
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -273,7 +274,8 @@ test_expect_success 'merge new subproj history into subdir/ with a slash appende
|
||||||
cd "$test_count" &&
|
cd "$test_count" &&
|
||||||
git fetch ./subproj master &&
|
git fetch ./subproj master &&
|
||||||
git subtree merge --prefix=subdir/ FETCH_HEAD &&
|
git subtree merge --prefix=subdir/ FETCH_HEAD &&
|
||||||
check_equal "$(last_commit_message)" "Merge commit '\''$(git rev-parse FETCH_HEAD)'\''"
|
check_equal "$(last_commit_message)" \
|
||||||
|
"Merge commit '\''$(git rev-parse FETCH_HEAD)'\'' into master"
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
|
@ -451,10 +451,7 @@ static void fmt_merge_msg_title(struct strbuf *out,
|
||||||
strbuf_addf(out, " of %s", srcs.items[i].string);
|
strbuf_addf(out, " of %s", srcs.items[i].string);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp("master", current_branch))
|
strbuf_addf(out, " into %s\n", current_branch);
|
||||||
strbuf_addch(out, '\n');
|
|
||||||
else
|
|
||||||
strbuf_addf(out, " into %s\n", current_branch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fmt_tag_signature(struct strbuf *tagbuf,
|
static void fmt_tag_signature(struct strbuf *tagbuf,
|
||||||
|
|
30
refs.c
30
refs.c
|
@ -562,6 +562,36 @@ void expand_ref_prefix(struct argv_array *prefixes, const char *prefix)
|
||||||
argv_array_pushf(prefixes, *p, len, prefix);
|
argv_array_pushf(prefixes, *p, len, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *repo_default_branch_name(struct repository *r)
|
||||||
|
{
|
||||||
|
const char *config_key = "init.defaultbranch";
|
||||||
|
const char *config_display_key = "init.defaultBranch";
|
||||||
|
char *ret = NULL, *full_ref;
|
||||||
|
|
||||||
|
if (repo_config_get_string(r, config_key, &ret) < 0)
|
||||||
|
die(_("could not retrieve `%s`"), config_display_key);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = xstrdup("master");
|
||||||
|
|
||||||
|
full_ref = xstrfmt("refs/heads/%s", ret);
|
||||||
|
if (check_refname_format(full_ref, 0))
|
||||||
|
die(_("invalid branch name: %s = %s"), config_display_key, ret);
|
||||||
|
free(full_ref);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *git_default_branch_name(void)
|
||||||
|
{
|
||||||
|
static char *ret;
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = repo_default_branch_name(the_repository);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* *string and *len will only be substituted, and *string returned (for
|
* *string and *len will only be substituted, and *string returned (for
|
||||||
* later free()ing) if the string passed in is a magic short-hand form
|
* later free()ing) if the string passed in is a magic short-hand form
|
||||||
|
|
9
refs.h
9
refs.h
|
@ -154,6 +154,15 @@ int repo_dwim_log(struct repository *r, const char *str, int len, struct object_
|
||||||
int dwim_ref(const char *str, int len, struct object_id *oid, char **ref);
|
int dwim_ref(const char *str, int len, struct object_id *oid, char **ref);
|
||||||
int dwim_log(const char *str, int len, struct object_id *oid, char **ref);
|
int dwim_log(const char *str, int len, struct object_id *oid, char **ref);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Retrieves the default branch name for newly-initialized repositories.
|
||||||
|
*
|
||||||
|
* The return value of `repo_default_branch_name()` is an allocated string. The
|
||||||
|
* return value of `git_default_branch_name()` is a singleton.
|
||||||
|
*/
|
||||||
|
const char *git_default_branch_name(void);
|
||||||
|
char *repo_default_branch_name(struct repository *r);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A ref_transaction represents a collection of reference updates that
|
* A ref_transaction represents a collection of reference updates that
|
||||||
* should succeed or fail together.
|
* should succeed or fail together.
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
static const char *url;
|
static const char *url;
|
||||||
static int dump_from_file;
|
static int dump_from_file;
|
||||||
static const char *private_ref;
|
static const char *private_ref;
|
||||||
static const char *remote_ref = "refs/heads/master";
|
static char *remote_ref;
|
||||||
static const char *marksfilename, *notes_ref;
|
static const char *marksfilename, *notes_ref;
|
||||||
struct rev_note { unsigned int rev_nr; };
|
struct rev_note { unsigned int rev_nr; };
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ int cmd_main(int argc, const char **argv)
|
||||||
private_ref_sb = STRBUF_INIT, marksfilename_sb = STRBUF_INIT,
|
private_ref_sb = STRBUF_INIT, marksfilename_sb = STRBUF_INIT,
|
||||||
notes_ref_sb = STRBUF_INIT;
|
notes_ref_sb = STRBUF_INIT;
|
||||||
static struct remote *remote;
|
static struct remote *remote;
|
||||||
const char *url_in;
|
const char *url_in, *remote_ref_short;
|
||||||
|
|
||||||
setup_git_directory();
|
setup_git_directory();
|
||||||
if (argc < 2 || argc > 3) {
|
if (argc < 2 || argc > 3) {
|
||||||
|
@ -294,6 +294,9 @@ int cmd_main(int argc, const char **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remote_ref_short = git_default_branch_name();
|
||||||
|
remote_ref = xstrfmt("refs/heads/%s", remote_ref_short);
|
||||||
|
|
||||||
remote = remote_get(argv[1]);
|
remote = remote_get(argv[1]);
|
||||||
url_in = (argc == 3) ? argv[2] : remote->url[0];
|
url_in = (argc == 3) ? argv[2] : remote->url[0];
|
||||||
|
|
||||||
|
@ -306,7 +309,8 @@ int cmd_main(int argc, const char **argv)
|
||||||
url = url_sb.buf;
|
url = url_sb.buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_addf(&private_ref_sb, "refs/svn/%s/master", remote->name);
|
strbuf_addf(&private_ref_sb, "refs/svn/%s/%s",
|
||||||
|
remote->name, remote_ref_short);
|
||||||
private_ref = private_ref_sb.buf;
|
private_ref = private_ref_sb.buf;
|
||||||
|
|
||||||
strbuf_addf(¬es_ref_sb, "refs/notes/%s/revs", remote->name);
|
strbuf_addf(¬es_ref_sb, "refs/notes/%s/revs", remote->name);
|
||||||
|
|
14
remote.c
14
remote.c
|
@ -276,7 +276,7 @@ static void read_branches_file(struct remote *remote)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The branches file would have URL and optionally
|
* The branches file would have URL and optionally
|
||||||
* #branch specified. The "master" (or specified) branch is
|
* #branch specified. The default (or specified) branch is
|
||||||
* fetched and stored in the local branch matching the
|
* fetched and stored in the local branch matching the
|
||||||
* remote name.
|
* remote name.
|
||||||
*/
|
*/
|
||||||
|
@ -284,7 +284,7 @@ static void read_branches_file(struct remote *remote)
|
||||||
if (frag)
|
if (frag)
|
||||||
*(frag++) = '\0';
|
*(frag++) = '\0';
|
||||||
else
|
else
|
||||||
frag = "master";
|
frag = (char *)git_default_branch_name();
|
||||||
|
|
||||||
add_url_alias(remote, strbuf_detach(&buf, NULL));
|
add_url_alias(remote, strbuf_detach(&buf, NULL));
|
||||||
strbuf_addf(&buf, "refs/heads/%s:refs/heads/%s",
|
strbuf_addf(&buf, "refs/heads/%s:refs/heads/%s",
|
||||||
|
@ -2097,8 +2097,16 @@ struct ref *guess_remote_head(const struct ref *head,
|
||||||
if (head->symref)
|
if (head->symref)
|
||||||
return copy_ref(find_ref_by_name(refs, head->symref));
|
return copy_ref(find_ref_by_name(refs, head->symref));
|
||||||
|
|
||||||
/* If refs/heads/master could be right, it is. */
|
/* If a remote branch exists with the default branch name, let's use it. */
|
||||||
if (!all) {
|
if (!all) {
|
||||||
|
char *ref = xstrfmt("refs/heads/%s", git_default_branch_name());
|
||||||
|
|
||||||
|
r = find_ref_by_name(refs, ref);
|
||||||
|
free(ref);
|
||||||
|
if (r && oideq(&r->old_oid, &head->old_oid))
|
||||||
|
return copy_ref(r);
|
||||||
|
|
||||||
|
/* Fall back to the hard-coded historical default */
|
||||||
r = find_ref_by_name(refs, "refs/heads/master");
|
r = find_ref_by_name(refs, "refs/heads/master");
|
||||||
if (r && oideq(&r->old_oid, &head->old_oid))
|
if (r && oideq(&r->old_oid, &head->old_oid))
|
||||||
return copy_ref(r);
|
return copy_ref(r);
|
||||||
|
|
|
@ -410,7 +410,7 @@ int send_pack(struct send_pack_args *args,
|
||||||
|
|
||||||
if (!remote_refs) {
|
if (!remote_refs) {
|
||||||
fprintf(stderr, "No refs in common and none specified; doing nothing.\n"
|
fprintf(stderr, "No refs in common and none specified; doing nothing.\n"
|
||||||
"Perhaps you should specify a branch such as 'master'.\n");
|
"Perhaps you should specify a branch.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (args->atomic && !atomic_supported)
|
if (args->atomic && !atomic_supported)
|
||||||
|
|
|
@ -464,4 +464,30 @@ test_expect_success MINGW 'redirect std handles' '
|
||||||
grep "Needed a single revision" output.txt
|
grep "Needed a single revision" output.txt
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success '--initial-branch' '
|
||||||
|
git init --initial-branch=hello initial-branch-option &&
|
||||||
|
git -C initial-branch-option symbolic-ref HEAD >actual &&
|
||||||
|
echo refs/heads/hello >expect &&
|
||||||
|
test_cmp expect actual &&
|
||||||
|
|
||||||
|
: re-initializing should not change the branch name &&
|
||||||
|
git init --initial-branch=ignore initial-branch-option 2>err &&
|
||||||
|
test_i18ngrep "ignored --initial-branch" err &&
|
||||||
|
git -C initial-branch-option symbolic-ref HEAD >actual &&
|
||||||
|
grep hello actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'overridden default initial branch name (config)' '
|
||||||
|
test_config_global init.defaultBranch nmb &&
|
||||||
|
git init initial-branch-config &&
|
||||||
|
git -C initial-branch-config symbolic-ref HEAD >actual &&
|
||||||
|
grep nmb actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'invalid default branch name' '
|
||||||
|
test_config_global init.defaultBranch "with space" &&
|
||||||
|
test_must_fail git init initial-branch-invalid 2>err &&
|
||||||
|
test_i18ngrep "invalid branch name" err
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
|
@ -137,7 +137,7 @@ test_expect_success 'merge my-side@{u} records the correct name' '
|
||||||
git branch -t new my-side@{u} &&
|
git branch -t new my-side@{u} &&
|
||||||
git merge -s ours new@{u} &&
|
git merge -s ours new@{u} &&
|
||||||
git show -s --pretty=tformat:%s >actual &&
|
git show -s --pretty=tformat:%s >actual &&
|
||||||
echo "Merge remote-tracking branch ${SQ}origin/side${SQ}" >expect &&
|
echo "Merge remote-tracking branch ${SQ}origin/side${SQ} into master" >expect &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
|
@ -117,12 +117,12 @@ test_expect_success setup '
|
||||||
|
|
||||||
: <<\EOF
|
: <<\EOF
|
||||||
! [initial] Initial
|
! [initial] Initial
|
||||||
* [master] Merge branch 'side'
|
* [master] Merge branch 'side' into master
|
||||||
! [rearrange] Rearranged lines in dir/sub
|
! [rearrange] Rearranged lines in dir/sub
|
||||||
! [side] Side
|
! [side] Side
|
||||||
----
|
----
|
||||||
+ [rearrange] Rearranged lines in dir/sub
|
+ [rearrange] Rearranged lines in dir/sub
|
||||||
- [master] Merge branch 'side'
|
- [master] Merge branch 'side' into master
|
||||||
* + [side] Side
|
* + [side] Side
|
||||||
* [master^] Third
|
* [master^] Third
|
||||||
* [master~2] Second
|
* [master~2] Second
|
||||||
|
|
|
@ -31,7 +31,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a (refs/heads/side)
|
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a (refs/heads/side)
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
|
@ -31,7 +31,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a (side)
|
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a (side)
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
dir/sub | 2 ++
|
dir/sub | 2 ++
|
||||||
file0 | 3 +++
|
file0 | 3 +++
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
dir/sub | 2 ++
|
dir/sub | 2 ++
|
||||||
file0 | 3 +++
|
file0 | 3 +++
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
diff --git a/dir/sub b/dir/sub
|
diff --git a/dir/sub b/dir/sub
|
||||||
index cead32e..992913c 100644
|
index cead32e..992913c 100644
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
diff --git a/dir/sub b/dir/sub
|
diff --git a/dir/sub b/dir/sub
|
||||||
index cead32e..992913c 100644
|
index cead32e..992913c 100644
|
||||||
|
@ -33,7 +33,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
diff --git a/dir/sub b/dir/sub
|
diff --git a/dir/sub b/dir/sub
|
||||||
index 7289e35..992913c 100644
|
index 7289e35..992913c 100644
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
|
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
diff --git a/dir/sub b/dir/sub
|
diff --git a/dir/sub b/dir/sub
|
||||||
index cead32e..992913c 100644
|
index cead32e..992913c 100644
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
diff --combined dir/sub
|
diff --combined dir/sub
|
||||||
index cead32e,7289e35..992913c
|
index cead32e,7289e35..992913c
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
diff --git a/dir/sub b/dir/sub
|
diff --git a/dir/sub b/dir/sub
|
||||||
index cead32e..992913c 100644
|
index cead32e..992913c 100644
|
||||||
|
@ -33,7 +33,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
diff --git a/dir/sub b/dir/sub
|
diff --git a/dir/sub b/dir/sub
|
||||||
index 7289e35..992913c 100644
|
index 7289e35..992913c 100644
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
diff --cc dir/sub
|
diff --cc dir/sub
|
||||||
index cead32e,7289e35..992913c
|
index cead32e,7289e35..992913c
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
dir/sub | 2 ++
|
dir/sub | 2 ++
|
||||||
file0 | 3 +++
|
file0 | 3 +++
|
||||||
|
|
|
@ -4,7 +4,7 @@ Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
Date: Mon Jun 26 00:04:00 2006 +0000
|
Date: Mon Jun 26 00:04:00 2006 +0000
|
||||||
|
|
||||||
Merge branch 'side'
|
Merge branch 'side' into master
|
||||||
|
|
||||||
dir/sub | 2 ++
|
dir/sub | 2 ++
|
||||||
file0 | 3 +++
|
file0 | 3 +++
|
||||||
|
|
|
@ -483,7 +483,7 @@ test_expect_success 'set up merge history' '
|
||||||
'
|
'
|
||||||
|
|
||||||
cat > expect <<\EOF
|
cat > expect <<\EOF
|
||||||
* Merge branch 'side'
|
* Merge branch 'side' into master
|
||||||
|\
|
|\
|
||||||
| * side-2
|
| * side-2
|
||||||
| * side-1
|
| * side-1
|
||||||
|
@ -502,7 +502,7 @@ test_expect_success 'log --graph with merge' '
|
||||||
'
|
'
|
||||||
|
|
||||||
cat > expect <<\EOF
|
cat > expect <<\EOF
|
||||||
| | | * Merge branch 'side'
|
| | | * Merge branch 'side' into master
|
||||||
| | | |\
|
| | | |\
|
||||||
| | | | * side-2
|
| | | | * side-2
|
||||||
| | | | * side-1
|
| | | | * side-1
|
||||||
|
@ -521,7 +521,7 @@ test_expect_success 'log --graph --line-prefix="| | | " with merge' '
|
||||||
'
|
'
|
||||||
|
|
||||||
cat > expect.colors <<\EOF
|
cat > expect.colors <<\EOF
|
||||||
* Merge branch 'side'
|
* Merge branch 'side' into master
|
||||||
<BLUE>|<RESET><CYAN>\<RESET>
|
<BLUE>|<RESET><CYAN>\<RESET>
|
||||||
<BLUE>|<RESET> * side-2
|
<BLUE>|<RESET> * side-2
|
||||||
<BLUE>|<RESET> * side-1
|
<BLUE>|<RESET> * side-1
|
||||||
|
@ -555,7 +555,7 @@ cat > expect <<\EOF
|
||||||
|\ Merge: A B
|
|\ Merge: A B
|
||||||
| | Author: A U Thor <author@example.com>
|
| | Author: A U Thor <author@example.com>
|
||||||
| |
|
| |
|
||||||
| | Merge branch 'side'
|
| | Merge branch 'side' into master
|
||||||
| |
|
| |
|
||||||
| * commit tags/side-2
|
| * commit tags/side-2
|
||||||
| | Author: A U Thor <author@example.com>
|
| | Author: A U Thor <author@example.com>
|
||||||
|
@ -632,11 +632,11 @@ test_expect_success 'set up more tangled history' '
|
||||||
'
|
'
|
||||||
|
|
||||||
cat > expect <<\EOF
|
cat > expect <<\EOF
|
||||||
* Merge tag 'reach'
|
* Merge tag 'reach' into master
|
||||||
|\
|
|\
|
||||||
| \
|
| \
|
||||||
| \
|
| \
|
||||||
*-. \ Merge tags 'octopus-a' and 'octopus-b'
|
*-. \ Merge tags 'octopus-a' and 'octopus-b' into master
|
||||||
|\ \ \
|
|\ \ \
|
||||||
* | | | seventh
|
* | | | seventh
|
||||||
| | * | octopus-b
|
| | * | octopus-b
|
||||||
|
@ -646,14 +646,14 @@ cat > expect <<\EOF
|
||||||
|/ /
|
|/ /
|
||||||
| * reach
|
| * reach
|
||||||
|/
|
|/
|
||||||
* Merge branch 'tangle'
|
* Merge branch 'tangle' into master
|
||||||
|\
|
|\
|
||||||
| * Merge branch 'side' (early part) into tangle
|
| * Merge branch 'side' (early part) into tangle
|
||||||
| |\
|
| |\
|
||||||
| * \ Merge branch 'master' (early part) into tangle
|
| * \ Merge branch 'master' (early part) into tangle
|
||||||
| |\ \
|
| |\ \
|
||||||
| * | | tangle-a
|
| * | | tangle-a
|
||||||
* | | | Merge branch 'side'
|
* | | | Merge branch 'side' into master
|
||||||
|\ \ \ \
|
|\ \ \ \
|
||||||
| * | | | side-2
|
| * | | | side-2
|
||||||
| | |_|/
|
| | |_|/
|
||||||
|
@ -735,16 +735,16 @@ test_expect_success 'log.decorate configuration' '
|
||||||
|
|
||||||
test_expect_success 'decorate-refs with glob' '
|
test_expect_success 'decorate-refs with glob' '
|
||||||
cat >expect.decorate <<-\EOF &&
|
cat >expect.decorate <<-\EOF &&
|
||||||
Merge-tag-reach
|
Merge-tag-reach-into-master
|
||||||
Merge-tags-octopus-a-and-octopus-b
|
Merge-tags-octopus-a-and-octopus-b-into-master
|
||||||
seventh
|
seventh
|
||||||
octopus-b (octopus-b)
|
octopus-b (octopus-b)
|
||||||
octopus-a (octopus-a)
|
octopus-a (octopus-a)
|
||||||
reach
|
reach
|
||||||
EOF
|
EOF
|
||||||
cat >expect.no-decorate <<-\EOF &&
|
cat >expect.no-decorate <<-\EOF &&
|
||||||
Merge-tag-reach
|
Merge-tag-reach-into-master
|
||||||
Merge-tags-octopus-a-and-octopus-b
|
Merge-tags-octopus-a-and-octopus-b-into-master
|
||||||
seventh
|
seventh
|
||||||
octopus-b
|
octopus-b
|
||||||
octopus-a
|
octopus-a
|
||||||
|
@ -765,8 +765,8 @@ test_expect_success 'decorate-refs with glob' '
|
||||||
|
|
||||||
test_expect_success 'decorate-refs without globs' '
|
test_expect_success 'decorate-refs without globs' '
|
||||||
cat >expect.decorate <<-\EOF &&
|
cat >expect.decorate <<-\EOF &&
|
||||||
Merge-tag-reach
|
Merge-tag-reach-into-master
|
||||||
Merge-tags-octopus-a-and-octopus-b
|
Merge-tags-octopus-a-and-octopus-b-into-master
|
||||||
seventh
|
seventh
|
||||||
octopus-b
|
octopus-b
|
||||||
octopus-a
|
octopus-a
|
||||||
|
@ -779,8 +779,8 @@ test_expect_success 'decorate-refs without globs' '
|
||||||
|
|
||||||
test_expect_success 'multiple decorate-refs' '
|
test_expect_success 'multiple decorate-refs' '
|
||||||
cat >expect.decorate <<-\EOF &&
|
cat >expect.decorate <<-\EOF &&
|
||||||
Merge-tag-reach
|
Merge-tag-reach-into-master
|
||||||
Merge-tags-octopus-a-and-octopus-b
|
Merge-tags-octopus-a-and-octopus-b-into-master
|
||||||
seventh
|
seventh
|
||||||
octopus-b (octopus-b)
|
octopus-b (octopus-b)
|
||||||
octopus-a (octopus-a)
|
octopus-a (octopus-a)
|
||||||
|
@ -794,8 +794,8 @@ test_expect_success 'multiple decorate-refs' '
|
||||||
|
|
||||||
test_expect_success 'decorate-refs-exclude with glob' '
|
test_expect_success 'decorate-refs-exclude with glob' '
|
||||||
cat >expect.decorate <<-\EOF &&
|
cat >expect.decorate <<-\EOF &&
|
||||||
Merge-tag-reach (HEAD -> master)
|
Merge-tag-reach-into-master (HEAD -> master)
|
||||||
Merge-tags-octopus-a-and-octopus-b
|
Merge-tags-octopus-a-and-octopus-b-into-master
|
||||||
seventh (tag: seventh)
|
seventh (tag: seventh)
|
||||||
octopus-b (tag: octopus-b)
|
octopus-b (tag: octopus-b)
|
||||||
octopus-a (tag: octopus-a)
|
octopus-a (tag: octopus-a)
|
||||||
|
@ -811,8 +811,8 @@ test_expect_success 'decorate-refs-exclude with glob' '
|
||||||
|
|
||||||
test_expect_success 'decorate-refs-exclude without globs' '
|
test_expect_success 'decorate-refs-exclude without globs' '
|
||||||
cat >expect.decorate <<-\EOF &&
|
cat >expect.decorate <<-\EOF &&
|
||||||
Merge-tag-reach (HEAD -> master)
|
Merge-tag-reach-into-master (HEAD -> master)
|
||||||
Merge-tags-octopus-a-and-octopus-b
|
Merge-tags-octopus-a-and-octopus-b-into-master
|
||||||
seventh (tag: seventh)
|
seventh (tag: seventh)
|
||||||
octopus-b (tag: octopus-b, octopus-b)
|
octopus-b (tag: octopus-b, octopus-b)
|
||||||
octopus-a (tag: octopus-a, octopus-a)
|
octopus-a (tag: octopus-a, octopus-a)
|
||||||
|
@ -828,8 +828,8 @@ test_expect_success 'decorate-refs-exclude without globs' '
|
||||||
|
|
||||||
test_expect_success 'multiple decorate-refs-exclude' '
|
test_expect_success 'multiple decorate-refs-exclude' '
|
||||||
cat >expect.decorate <<-\EOF &&
|
cat >expect.decorate <<-\EOF &&
|
||||||
Merge-tag-reach (HEAD -> master)
|
Merge-tag-reach-into-master (HEAD -> master)
|
||||||
Merge-tags-octopus-a-and-octopus-b
|
Merge-tags-octopus-a-and-octopus-b-into-master
|
||||||
seventh (tag: seventh)
|
seventh (tag: seventh)
|
||||||
octopus-b (tag: octopus-b)
|
octopus-b (tag: octopus-b)
|
||||||
octopus-a (tag: octopus-a)
|
octopus-a (tag: octopus-a)
|
||||||
|
@ -851,8 +851,8 @@ test_expect_success 'multiple decorate-refs-exclude' '
|
||||||
|
|
||||||
test_expect_success 'decorate-refs and decorate-refs-exclude' '
|
test_expect_success 'decorate-refs and decorate-refs-exclude' '
|
||||||
cat >expect.no-decorate <<-\EOF &&
|
cat >expect.no-decorate <<-\EOF &&
|
||||||
Merge-tag-reach (master)
|
Merge-tag-reach-into-master (master)
|
||||||
Merge-tags-octopus-a-and-octopus-b
|
Merge-tags-octopus-a-and-octopus-b-into-master
|
||||||
seventh
|
seventh
|
||||||
octopus-b
|
octopus-b
|
||||||
octopus-a
|
octopus-a
|
||||||
|
@ -866,8 +866,8 @@ test_expect_success 'decorate-refs and decorate-refs-exclude' '
|
||||||
|
|
||||||
test_expect_success 'deocrate-refs and log.excludeDecoration' '
|
test_expect_success 'deocrate-refs and log.excludeDecoration' '
|
||||||
cat >expect.decorate <<-\EOF &&
|
cat >expect.decorate <<-\EOF &&
|
||||||
Merge-tag-reach (master)
|
Merge-tag-reach-into-master (master)
|
||||||
Merge-tags-octopus-a-and-octopus-b
|
Merge-tags-octopus-a-and-octopus-b-into-master
|
||||||
seventh
|
seventh
|
||||||
octopus-b (octopus-b)
|
octopus-b (octopus-b)
|
||||||
octopus-a (octopus-a)
|
octopus-a (octopus-a)
|
||||||
|
@ -881,10 +881,10 @@ test_expect_success 'deocrate-refs and log.excludeDecoration' '
|
||||||
|
|
||||||
test_expect_success 'decorate-refs-exclude and simplify-by-decoration' '
|
test_expect_success 'decorate-refs-exclude and simplify-by-decoration' '
|
||||||
cat >expect.decorate <<-\EOF &&
|
cat >expect.decorate <<-\EOF &&
|
||||||
Merge-tag-reach (HEAD -> master)
|
Merge-tag-reach-into-master (HEAD -> master)
|
||||||
reach (tag: reach, reach)
|
reach (tag: reach, reach)
|
||||||
seventh (tag: seventh)
|
seventh (tag: seventh)
|
||||||
Merge-branch-tangle
|
Merge-branch-tangle-into-master
|
||||||
Merge-branch-side-early-part-into-tangle (tangle)
|
Merge-branch-side-early-part-into-tangle (tangle)
|
||||||
tangle-a (tag: tangle-a)
|
tangle-a (tag: tangle-a)
|
||||||
EOF
|
EOF
|
||||||
|
@ -1068,7 +1068,7 @@ cat >expect <<\EOF
|
||||||
|\ Merge: MERGE_PARENTS
|
|\ Merge: MERGE_PARENTS
|
||||||
| | Author: A U Thor <author@example.com>
|
| | Author: A U Thor <author@example.com>
|
||||||
| |
|
| |
|
||||||
| | Merge branch 'tangle'
|
| | Merge branch 'tangle' into master
|
||||||
| |
|
| |
|
||||||
| * commit COMMIT_OBJECT_NAME
|
| * commit COMMIT_OBJECT_NAME
|
||||||
| |\ Merge: MERGE_PARENTS
|
| |\ Merge: MERGE_PARENTS
|
||||||
|
@ -1102,7 +1102,7 @@ cat >expect <<\EOF
|
||||||
|\ \ \ \ Merge: MERGE_PARENTS
|
|\ \ \ \ Merge: MERGE_PARENTS
|
||||||
| | | | | Author: A U Thor <author@example.com>
|
| | | | | Author: A U Thor <author@example.com>
|
||||||
| | | | |
|
| | | | |
|
||||||
| | | | | Merge branch 'side'
|
| | | | | Merge branch 'side' into master
|
||||||
| | | | |
|
| | | | |
|
||||||
| * | | | commit COMMIT_OBJECT_NAME
|
| * | | | commit COMMIT_OBJECT_NAME
|
||||||
| | |_|/ Author: A U Thor <author@example.com>
|
| | |_|/ Author: A U Thor <author@example.com>
|
||||||
|
@ -1343,7 +1343,7 @@ cat >expect <<\EOF
|
||||||
*** |\ Merge: MERGE_PARENTS
|
*** |\ Merge: MERGE_PARENTS
|
||||||
*** | | Author: A U Thor <author@example.com>
|
*** | | Author: A U Thor <author@example.com>
|
||||||
*** | |
|
*** | |
|
||||||
*** | | Merge branch 'tangle'
|
*** | | Merge branch 'tangle' into master
|
||||||
*** | |
|
*** | |
|
||||||
*** | * commit COMMIT_OBJECT_NAME
|
*** | * commit COMMIT_OBJECT_NAME
|
||||||
*** | |\ Merge: MERGE_PARENTS
|
*** | |\ Merge: MERGE_PARENTS
|
||||||
|
@ -1377,7 +1377,7 @@ cat >expect <<\EOF
|
||||||
*** |\ \ \ \ Merge: MERGE_PARENTS
|
*** |\ \ \ \ Merge: MERGE_PARENTS
|
||||||
*** | | | | | Author: A U Thor <author@example.com>
|
*** | | | | | Author: A U Thor <author@example.com>
|
||||||
*** | | | | |
|
*** | | | | |
|
||||||
*** | | | | | Merge branch 'side'
|
*** | | | | | Merge branch 'side' into master
|
||||||
*** | | | | |
|
*** | | | | |
|
||||||
*** | * | | | commit COMMIT_OBJECT_NAME
|
*** | * | | | commit COMMIT_OBJECT_NAME
|
||||||
*** | | |_|/ Author: A U Thor <author@example.com>
|
*** | | |_|/ Author: A U Thor <author@example.com>
|
||||||
|
@ -1540,8 +1540,8 @@ cat >expect <<-\EOF
|
||||||
* reach
|
* reach
|
||||||
|
|
|
|
||||||
| A reach.t
|
| A reach.t
|
||||||
* Merge branch 'tangle'
|
* Merge branch 'tangle' into master
|
||||||
* Merge branch 'side'
|
* Merge branch 'side' into master
|
||||||
|\
|
|\
|
||||||
| * side-2
|
| * side-2
|
||||||
|
|
|
|
||||||
|
@ -1562,8 +1562,8 @@ cat >expect <<-\EOF
|
||||||
* reach
|
* reach
|
||||||
|
|
|
|
||||||
| reach.t
|
| reach.t
|
||||||
* Merge branch 'tangle'
|
* Merge branch 'tangle' into master
|
||||||
* Merge branch 'side'
|
* Merge branch 'side' into master
|
||||||
|\
|
|\
|
||||||
| * side-2
|
| * side-2
|
||||||
|
|
|
|
||||||
|
|
|
@ -98,6 +98,12 @@ test_expect_success 'push from/to new branch with upstream, matching and simple'
|
||||||
test_push_failure upstream
|
test_push_failure upstream
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success '"matching" fails if none match' '
|
||||||
|
git init --bare empty &&
|
||||||
|
test_must_fail git push empty : 2>actual &&
|
||||||
|
test_i18ngrep "Perhaps you should specify a branch" actual
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'push ambiguously named branch with upstream, matching and simple' '
|
test_expect_success 'push ambiguously named branch with upstream, matching and simple' '
|
||||||
git checkout -b ambiguous &&
|
git checkout -b ambiguous &&
|
||||||
test_config branch.ambiguous.remote parent1 &&
|
test_config branch.ambiguous.remote parent1 &&
|
||||||
|
|
|
@ -35,4 +35,28 @@ test_expect_success 'redirected clone -v does show progress' '
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'chooses correct default initial branch name' '
|
||||||
|
git init --bare empty &&
|
||||||
|
git -c init.defaultBranch=up clone empty whats-up &&
|
||||||
|
test refs/heads/up = $(git -C whats-up symbolic-ref HEAD) &&
|
||||||
|
test refs/heads/up = $(git -C whats-up config branch.up.merge)
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'guesses initial branch name correctly' '
|
||||||
|
git init --initial-branch=guess initial-branch &&
|
||||||
|
test_commit -C initial-branch no-spoilers &&
|
||||||
|
git -C initial-branch branch abc guess &&
|
||||||
|
git clone initial-branch is-it &&
|
||||||
|
test refs/heads/guess = $(git -C is-it symbolic-ref HEAD) &&
|
||||||
|
|
||||||
|
git -c init.defaultBranch=none init --bare no-head &&
|
||||||
|
git -C initial-branch push ../no-head guess abc &&
|
||||||
|
git clone no-head is-it2 &&
|
||||||
|
test_must_fail git -C is-it2 symbolic-ref refs/remotes/origin/HEAD &&
|
||||||
|
git -C no-head update-ref --no-deref HEAD refs/heads/guess &&
|
||||||
|
git -c init.defaultBranch=guess clone no-head is-it3 &&
|
||||||
|
test refs/remotes/origin/guess = \
|
||||||
|
$(git -C is-it3 symbolic-ref refs/remotes/origin/HEAD)
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
|
@ -79,7 +79,7 @@ test_expect_success GPG 'set up a signed tag' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'message for merging local branch' '
|
test_expect_success 'message for merging local branch' '
|
||||||
echo "Merge branch ${apos}left${apos}" >expected &&
|
echo "Merge branch ${apos}left${apos} into master" >expected &&
|
||||||
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
git fetch . left &&
|
git fetch . left &&
|
||||||
|
@ -107,7 +107,7 @@ test_expect_success GPG 'message for merging local tag signed by unknown key' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'message for merging external branch' '
|
test_expect_success 'message for merging external branch' '
|
||||||
echo "Merge branch ${apos}left${apos} of $(pwd)" >expected &&
|
echo "Merge branch ${apos}left${apos} of $(pwd) into master" >expected &&
|
||||||
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
git fetch "$(pwd)" left &&
|
git fetch "$(pwd)" left &&
|
||||||
|
@ -118,7 +118,7 @@ test_expect_success 'message for merging external branch' '
|
||||||
|
|
||||||
test_expect_success '[merge] summary/log configuration' '
|
test_expect_success '[merge] summary/log configuration' '
|
||||||
cat >expected <<-EOF &&
|
cat >expected <<-EOF &&
|
||||||
Merge branch ${apos}left${apos}
|
Merge branch ${apos}left${apos} into master
|
||||||
|
|
||||||
# By Another Author (3) and A U Thor (2)
|
# By Another Author (3) and A U Thor (2)
|
||||||
# Via Another Committer
|
# Via Another Committer
|
||||||
|
@ -160,7 +160,7 @@ test_expect_success 'setup FETCH_HEAD' '
|
||||||
|
|
||||||
test_expect_success 'merge.log=3 limits shortlog length' '
|
test_expect_success 'merge.log=3 limits shortlog length' '
|
||||||
cat >expected <<-EOF &&
|
cat >expected <<-EOF &&
|
||||||
Merge branch ${apos}left${apos}
|
Merge branch ${apos}left${apos} into master
|
||||||
|
|
||||||
# By Another Author (3) and A U Thor (2)
|
# By Another Author (3) and A U Thor (2)
|
||||||
# Via Another Committer
|
# Via Another Committer
|
||||||
|
@ -177,7 +177,7 @@ test_expect_success 'merge.log=3 limits shortlog length' '
|
||||||
|
|
||||||
test_expect_success 'merge.log=5 shows all 5 commits' '
|
test_expect_success 'merge.log=5 shows all 5 commits' '
|
||||||
cat >expected <<-EOF &&
|
cat >expected <<-EOF &&
|
||||||
Merge branch ${apos}left${apos}
|
Merge branch ${apos}left${apos} into master
|
||||||
|
|
||||||
# By Another Author (3) and A U Thor (2)
|
# By Another Author (3) and A U Thor (2)
|
||||||
# Via Another Committer
|
# Via Another Committer
|
||||||
|
@ -195,7 +195,7 @@ test_expect_success 'merge.log=5 shows all 5 commits' '
|
||||||
|
|
||||||
test_expect_success '--log=5 with custom comment character' '
|
test_expect_success '--log=5 with custom comment character' '
|
||||||
cat >expected <<-EOF &&
|
cat >expected <<-EOF &&
|
||||||
Merge branch ${apos}left${apos}
|
Merge branch ${apos}left${apos} into master
|
||||||
|
|
||||||
x By Another Author (3) and A U Thor (2)
|
x By Another Author (3) and A U Thor (2)
|
||||||
x Via Another Committer
|
x Via Another Committer
|
||||||
|
@ -212,14 +212,14 @@ test_expect_success '--log=5 with custom comment character' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'merge.log=0 disables shortlog' '
|
test_expect_success 'merge.log=0 disables shortlog' '
|
||||||
echo "Merge branch ${apos}left${apos}" >expected &&
|
echo "Merge branch ${apos}left${apos} into master" >expected &&
|
||||||
git -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual &&
|
git -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success '--log=3 limits shortlog length' '
|
test_expect_success '--log=3 limits shortlog length' '
|
||||||
cat >expected <<-EOF &&
|
cat >expected <<-EOF &&
|
||||||
Merge branch ${apos}left${apos}
|
Merge branch ${apos}left${apos} into master
|
||||||
|
|
||||||
# By Another Author (3) and A U Thor (2)
|
# By Another Author (3) and A U Thor (2)
|
||||||
# Via Another Committer
|
# Via Another Committer
|
||||||
|
@ -236,7 +236,7 @@ test_expect_success '--log=3 limits shortlog length' '
|
||||||
|
|
||||||
test_expect_success '--log=5 shows all 5 commits' '
|
test_expect_success '--log=5 shows all 5 commits' '
|
||||||
cat >expected <<-EOF &&
|
cat >expected <<-EOF &&
|
||||||
Merge branch ${apos}left${apos}
|
Merge branch ${apos}left${apos} into master
|
||||||
|
|
||||||
# By Another Author (3) and A U Thor (2)
|
# By Another Author (3) and A U Thor (2)
|
||||||
# Via Another Committer
|
# Via Another Committer
|
||||||
|
@ -253,13 +253,13 @@ test_expect_success '--log=5 shows all 5 commits' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success '--no-log disables shortlog' '
|
test_expect_success '--no-log disables shortlog' '
|
||||||
echo "Merge branch ${apos}left${apos}" >expected &&
|
echo "Merge branch ${apos}left${apos} into master" >expected &&
|
||||||
git fmt-merge-msg --no-log <.git/FETCH_HEAD >actual &&
|
git fmt-merge-msg --no-log <.git/FETCH_HEAD >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success '--log=0 disables shortlog' '
|
test_expect_success '--log=0 disables shortlog' '
|
||||||
echo "Merge branch ${apos}left${apos}" >expected &&
|
echo "Merge branch ${apos}left${apos} into master" >expected &&
|
||||||
git fmt-merge-msg --no-log <.git/FETCH_HEAD >actual &&
|
git fmt-merge-msg --no-log <.git/FETCH_HEAD >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
@ -300,7 +300,7 @@ test_expect_success 'fmt-merge-msg -m' '
|
||||||
|
|
||||||
test_expect_success 'setup: expected shortlog for two branches' '
|
test_expect_success 'setup: expected shortlog for two branches' '
|
||||||
cat >expected <<-EOF
|
cat >expected <<-EOF
|
||||||
Merge branches ${apos}left${apos} and ${apos}right${apos}
|
Merge branches ${apos}left${apos} and ${apos}right${apos} into master
|
||||||
|
|
||||||
# By Another Author (3) and A U Thor (2)
|
# By Another Author (3) and A U Thor (2)
|
||||||
# Via Another Committer
|
# Via Another Committer
|
||||||
|
@ -397,7 +397,7 @@ test_expect_success 'merge-msg with nothing to merge' '
|
||||||
|
|
||||||
test_expect_success 'merge-msg tag' '
|
test_expect_success 'merge-msg tag' '
|
||||||
cat >expected <<-EOF &&
|
cat >expected <<-EOF &&
|
||||||
Merge tag ${apos}tag-r3${apos}
|
Merge tag ${apos}tag-r3${apos} into master
|
||||||
|
|
||||||
* tag ${apos}tag-r3${apos}:
|
* tag ${apos}tag-r3${apos}:
|
||||||
Right #3
|
Right #3
|
||||||
|
@ -418,7 +418,7 @@ test_expect_success 'merge-msg tag' '
|
||||||
|
|
||||||
test_expect_success 'merge-msg two tags' '
|
test_expect_success 'merge-msg two tags' '
|
||||||
cat >expected <<-EOF &&
|
cat >expected <<-EOF &&
|
||||||
Merge tags ${apos}tag-r3${apos} and ${apos}tag-l5${apos}
|
Merge tags ${apos}tag-r3${apos} and ${apos}tag-l5${apos} into master
|
||||||
|
|
||||||
* tag ${apos}tag-r3${apos}:
|
* tag ${apos}tag-r3${apos}:
|
||||||
Right #3
|
Right #3
|
||||||
|
@ -448,7 +448,7 @@ test_expect_success 'merge-msg two tags' '
|
||||||
|
|
||||||
test_expect_success 'merge-msg tag and branch' '
|
test_expect_success 'merge-msg tag and branch' '
|
||||||
cat >expected <<-EOF &&
|
cat >expected <<-EOF &&
|
||||||
Merge branch ${apos}left${apos}, tag ${apos}tag-r3${apos}
|
Merge branch ${apos}left${apos}, tag ${apos}tag-r3${apos} into master
|
||||||
|
|
||||||
* tag ${apos}tag-r3${apos}:
|
* tag ${apos}tag-r3${apos}:
|
||||||
Right #3
|
Right #3
|
||||||
|
@ -479,7 +479,7 @@ test_expect_success 'merge-msg tag and branch' '
|
||||||
test_expect_success 'merge-msg lots of commits' '
|
test_expect_success 'merge-msg lots of commits' '
|
||||||
{
|
{
|
||||||
cat <<-EOF &&
|
cat <<-EOF &&
|
||||||
Merge branch ${apos}long${apos}
|
Merge branch ${apos}long${apos} into master
|
||||||
|
|
||||||
* long: (35 commits)
|
* long: (35 commits)
|
||||||
EOF
|
EOF
|
||||||
|
@ -516,7 +516,7 @@ test_expect_success 'merge-msg with "merging" an annotated tag' '
|
||||||
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
|
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
|
||||||
{
|
{
|
||||||
cat <<-\EOF
|
cat <<-\EOF
|
||||||
Merge tag '\''annote'\''
|
Merge tag '\''annote'\'' into master
|
||||||
|
|
||||||
An annotated one
|
An annotated one
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ test_expect_success 'merge-msg with "merging" an annotated tag' '
|
||||||
git merge --no-commit --no-ff $annote &&
|
git merge --no-commit --no-ff $annote &&
|
||||||
{
|
{
|
||||||
cat <<-EOF
|
cat <<-EOF
|
||||||
Merge tag '\''$annote'\''
|
Merge tag '\''$annote'\'' into master
|
||||||
|
|
||||||
An annotated one
|
An annotated one
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,22 @@ test_expect_success 'setup a submodule tree' '
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'update --remote falls back to using HEAD' '
|
||||||
|
test_create_repo main-branch-submodule &&
|
||||||
|
test_commit -C main-branch-submodule initial &&
|
||||||
|
|
||||||
|
test_create_repo main-branch &&
|
||||||
|
git -C main-branch submodule add ../main-branch-submodule &&
|
||||||
|
git -C main-branch commit -m add-submodule &&
|
||||||
|
|
||||||
|
git -C main-branch-submodule switch -c hello &&
|
||||||
|
test_commit -C main-branch-submodule world &&
|
||||||
|
|
||||||
|
git clone --recursive main-branch main-branch-clone &&
|
||||||
|
git -C main-branch-clone submodule update --remote main-branch-submodule &&
|
||||||
|
test_path_exists main-branch-clone/main-branch-submodule/world.t
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'submodule update detaching the HEAD ' '
|
test_expect_success 'submodule update detaching the HEAD ' '
|
||||||
(cd super/submodule &&
|
(cd super/submodule &&
|
||||||
git reset --hard HEAD~1
|
git reset --hard HEAD~1
|
||||||
|
|
|
@ -52,12 +52,13 @@ test_expect_success 'test submodule set-branch --branch' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'test submodule set-branch --default' '
|
test_expect_success 'test submodule set-branch --default' '
|
||||||
|
test_commit -C submodule c &&
|
||||||
(cd super &&
|
(cd super &&
|
||||||
git submodule set-branch --default submodule &&
|
git submodule set-branch --default submodule &&
|
||||||
! grep branch .gitmodules &&
|
! grep branch .gitmodules &&
|
||||||
git submodule update --remote &&
|
git submodule update --remote &&
|
||||||
cat <<-\EOF >expect &&
|
cat <<-\EOF >expect &&
|
||||||
a
|
c
|
||||||
EOF
|
EOF
|
||||||
git -C submodule show -s --pretty=%s >actual &&
|
git -C submodule show -s --pretty=%s >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
|
@ -65,6 +66,7 @@ test_expect_success 'test submodule set-branch --default' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'test submodule set-branch -b' '
|
test_expect_success 'test submodule set-branch -b' '
|
||||||
|
test_commit -C submodule b &&
|
||||||
(cd super &&
|
(cd super &&
|
||||||
git submodule set-branch -b topic submodule &&
|
git submodule set-branch -b topic submodule &&
|
||||||
grep "branch = topic" .gitmodules &&
|
grep "branch = topic" .gitmodules &&
|
||||||
|
@ -78,12 +80,13 @@ test_expect_success 'test submodule set-branch -b' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'test submodule set-branch -d' '
|
test_expect_success 'test submodule set-branch -d' '
|
||||||
|
test_commit -C submodule d &&
|
||||||
(cd super &&
|
(cd super &&
|
||||||
git submodule set-branch -d submodule &&
|
git submodule set-branch -d submodule &&
|
||||||
! grep branch .gitmodules &&
|
! grep branch .gitmodules &&
|
||||||
git submodule update --remote &&
|
git submodule update --remote &&
|
||||||
cat <<-\EOF >expect &&
|
cat <<-\EOF >expect &&
|
||||||
a
|
d
|
||||||
EOF
|
EOF
|
||||||
git -C submodule show -s --pretty=%s >actual &&
|
git -C submodule show -s --pretty=%s >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
|
|
|
@ -14,9 +14,9 @@ Testing basic merge operations/option parsing.
|
||||||
! [c4] c4
|
! [c4] c4
|
||||||
! [c5] c5
|
! [c5] c5
|
||||||
! [c6] c6
|
! [c6] c6
|
||||||
* [master] Merge commit 'c1'
|
* [master] Merge commit 'c1' into master
|
||||||
--------
|
--------
|
||||||
- [master] Merge commit 'c1'
|
- [master] Merge commit 'c1' into master
|
||||||
+ * [c1] commit 1
|
+ * [c1] commit 1
|
||||||
+ [c6] c6
|
+ [c6] c6
|
||||||
+ [c5] c5
|
+ [c5] c5
|
||||||
|
@ -44,8 +44,8 @@ test_write_lines '1 X' 2 '3 X' 4 '5 X' 6 7 8 '9 X' >result.1-3-5-9
|
||||||
test_write_lines 1 2 3 4 5 6 7 8 '9 Z' >result.9z
|
test_write_lines 1 2 3 4 5 6 7 8 '9 Z' >result.9z
|
||||||
|
|
||||||
create_merge_msgs () {
|
create_merge_msgs () {
|
||||||
echo "Merge tag 'c2'" >msg.1-5 &&
|
echo "Merge tag 'c2' into master" >msg.1-5 &&
|
||||||
echo "Merge tags 'c2' and 'c3'" >msg.1-5-9 &&
|
echo "Merge tags 'c2' and 'c3' into master" >msg.1-5-9 &&
|
||||||
{
|
{
|
||||||
echo "Squashed commit of the following:" &&
|
echo "Squashed commit of the following:" &&
|
||||||
echo &&
|
echo &&
|
||||||
|
@ -258,7 +258,7 @@ test_expect_success 'merge c3 with c7 with commit.cleanup = scissors' '
|
||||||
git commit --no-edit -a &&
|
git commit --no-edit -a &&
|
||||||
|
|
||||||
cat >expect <<-\EOF &&
|
cat >expect <<-\EOF &&
|
||||||
Merge tag '"'"'c7'"'"'
|
Merge tag '"'"'c7'"'"' into master
|
||||||
|
|
||||||
# ------------------------ >8 ------------------------
|
# ------------------------ >8 ------------------------
|
||||||
# Do not modify or remove the line above.
|
# Do not modify or remove the line above.
|
||||||
|
@ -808,10 +808,10 @@ test_expect_success 'merge with conflicted --autostash changes' '
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >expected.branch <<\EOF
|
cat >expected.branch <<\EOF
|
||||||
Merge branch 'c5-branch' (early part)
|
Merge branch 'c5-branch' (early part) into master
|
||||||
EOF
|
EOF
|
||||||
cat >expected.tag <<\EOF
|
cat >expected.tag <<\EOF
|
||||||
Merge commit 'c5~1'
|
Merge commit 'c5~1' into master
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'merge early part of c2' '
|
test_expect_success 'merge early part of c2' '
|
||||||
|
|
|
@ -16,7 +16,7 @@ test_expect_success 'merge local branch' '
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
test_commit master-2 &&
|
test_commit master-2 &&
|
||||||
git merge local-branch &&
|
git merge local-branch &&
|
||||||
check_oneline "Merge branch Qlocal-branchQ"
|
check_oneline "Merge branch Qlocal-branchQ into master"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'merge octopus branches' '
|
test_expect_success 'merge octopus branches' '
|
||||||
|
@ -26,7 +26,7 @@ test_expect_success 'merge octopus branches' '
|
||||||
test_commit octopus-2 &&
|
test_commit octopus-2 &&
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
git merge octopus-a octopus-b &&
|
git merge octopus-a octopus-b &&
|
||||||
check_oneline "Merge branches Qoctopus-aQ and Qoctopus-bQ"
|
check_oneline "Merge branches Qoctopus-aQ and Qoctopus-bQ into master"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'merge tag' '
|
test_expect_success 'merge tag' '
|
||||||
|
@ -35,7 +35,7 @@ test_expect_success 'merge tag' '
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
test_commit master-3 &&
|
test_commit master-3 &&
|
||||||
git merge tag-1 &&
|
git merge tag-1 &&
|
||||||
check_oneline "Merge tag Qtag-1Q"
|
check_oneline "Merge tag Qtag-1Q into master"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'ambiguous tag' '
|
test_expect_success 'ambiguous tag' '
|
||||||
|
@ -44,7 +44,7 @@ test_expect_success 'ambiguous tag' '
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
test_commit master-4 &&
|
test_commit master-4 &&
|
||||||
git merge ambiguous &&
|
git merge ambiguous &&
|
||||||
check_oneline "Merge tag QambiguousQ"
|
check_oneline "Merge tag QambiguousQ into master"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'remote-tracking branch' '
|
test_expect_success 'remote-tracking branch' '
|
||||||
|
@ -54,7 +54,7 @@ test_expect_success 'remote-tracking branch' '
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
test_commit master-5 &&
|
test_commit master-5 &&
|
||||||
git merge origin/master &&
|
git merge origin/master &&
|
||||||
check_oneline "Merge remote-tracking branch Qorigin/masterQ"
|
check_oneline "Merge remote-tracking branch Qorigin/masterQ into master"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
|
@ -84,6 +84,12 @@ test_expect_success REMOTE_SVN 'incremental imports must lead to the same head'
|
||||||
test_cmp master.good .git/refs/remotes/svnsim/master
|
test_cmp master.good .git/refs/remotes/svnsim/master
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success REMOTE_SVN 'respects configured default initial branch' '
|
||||||
|
git -c init.defaultBranch=trunk remote add -f trunk \
|
||||||
|
"testsvn::file://$TEST_DIRECTORY/t9154/svn.dump" &&
|
||||||
|
git rev-parse --verify refs/remotes/trunk/trunk
|
||||||
|
'
|
||||||
|
|
||||||
test_debug 'git branch -a'
|
test_debug 'git branch -a'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
|
@ -1050,7 +1050,7 @@ static int push_refs(struct transport *transport,
|
||||||
if (!remote_refs) {
|
if (!remote_refs) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
_("No refs in common and none specified; doing nothing.\n"
|
_("No refs in common and none specified; doing nothing.\n"
|
||||||
"Perhaps you should specify a branch such as 'master'.\n"));
|
"Perhaps you should specify a branch.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче