testsvn: respect core.defaultBranchName
Since the default branch name can now be configured, the `testsvn` remote helper needs to be told about it. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
212055a474
commit
c45d469f22
@ -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, *default_branch;
|
||||||
|
|
||||||
setup_git_directory();
|
setup_git_directory();
|
||||||
if (argc < 2 || argc > 3) {
|
if (argc < 2 || argc > 3) {
|
||||||
@ -294,6 +294,10 @@ int cmd_main(int argc, const char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remote_ref = git_default_branch_name(0);
|
||||||
|
if (!skip_prefix(remote_ref, "refs/heads/", &default_branch))
|
||||||
|
BUG("unexpected remote_ref '%s'", remote_ref);
|
||||||
|
|
||||||
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 +310,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, default_branch);
|
||||||
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);
|
||||||
|
Reference in New Issue
Block a user