* [PATCH] Extend "checkout --track" DWIM to support more cases @ 2008-08-20 18:50 Alex Riesen 2008-08-20 19:52 ` Johannes Schindelin 0 siblings, 1 reply; 11+ messages in thread From: Alex Riesen @ 2008-08-20 18:50 UTC (permalink / raw) To: git; +Cc: Junio C Hamano, Johannes Schindelin The code handles additionally "refs/remotes/<something>/name", "remotes/<something>/name", and "refs/<namespace>/name". Test cases included. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> --- Johannes has likable ideas :) builtin-checkout.c | 20 +++++++++++++++----- t/t7201-co.sh | 23 ++++++++++++++++++++++- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/builtin-checkout.c b/builtin-checkout.c index e95eab9..20466e2 100644 --- a/builtin-checkout.c +++ b/builtin-checkout.c @@ -447,11 +447,21 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) char *slash; if (!argc || !strcmp(argv[0], "--")) die ("--track needs a branch name"); - slash = strchr(argv[0], '/'); - if (slash && !prefixcmp(argv[0], "refs/")) - slash = strchr(slash + 1, '/'); - if (slash && !prefixcmp(argv[0], "remotes/")) - slash = strchr(slash + 1, '/'); + if (!prefixcmp(argv[0], "remotes/")) + /* skip the name of a remote */ + slash = strchr(argv[0] + 8, '/'); + else if (!prefixcmp(argv[0], "refs/")) { + /* skip namespaces, try use the names of their + * branches, but for the target namespace + * (heads) demand a new name. Also skip the + * first element in "remotes" namespace */ + const char *ns = argv[0] + 5; + slash = !prefixcmp(ns, "heads/") ? NULL: + !prefixcmp(ns, "remotes/") ? + strchr(ns + 8, '/'): strchr(ns, '/'); + } else + /* otherwise - just skip the first element */ + slash = strchr(argv[0], '/'); if (!slash || !slash[1]) die ("Missing branch name; try -b"); opts.new_branch = slash + 1; diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 943dd57..1dff84d 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -340,9 +340,30 @@ test_expect_success \ test_expect_success \ 'checkout with --track fakes a sensible -b <name>' ' git update-ref refs/remotes/origin/koala/bear renamer && + git update-ref refs/new/koala/bear renamer && + git checkout --track origin/koala/bear && test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" && - test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"' + test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" && + + git checkout master && git branch -D koala/bear && + + git checkout --track refs/remotes/origin/koala/bear && + test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" && + test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" && + + git checkout master && git branch -D koala/bear && + + git checkout --track remotes/origin/koala/bear && + test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" && + test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" && + + git checkout master && git branch -D koala/bear && + + git checkout --track refs/new/koala/bear && + test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" && + test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" +' test_expect_success \ 'checkout with --track, but without -b, fails with too short tracked name' ' -- 1.6.0.22.g09248 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] Extend "checkout --track" DWIM to support more cases 2008-08-20 18:50 [PATCH] Extend "checkout --track" DWIM to support more cases Alex Riesen @ 2008-08-20 19:52 ` Johannes Schindelin 2008-08-20 20:04 ` Alex Riesen 0 siblings, 1 reply; 11+ messages in thread From: Johannes Schindelin @ 2008-08-20 19:52 UTC (permalink / raw) To: Alex Riesen; +Cc: git, Junio C Hamano Hi, On Wed, 20 Aug 2008, Alex Riesen wrote: > The code handles additionally "refs/remotes/<something>/name", > "remotes/<something>/name", and "refs/<namespace>/name". > Test cases included. > > Signed-off-by: Alex Riesen <raa.lkml@gmail.com> > --- > > Johannes has likable ideas :) > > builtin-checkout.c | 20 +++++++++++++++----- > t/t7201-co.sh | 23 ++++++++++++++++++++++- > 2 files changed, 37 insertions(+), 6 deletions(-) > > diff --git a/builtin-checkout.c b/builtin-checkout.c > index e95eab9..20466e2 100644 > --- a/builtin-checkout.c > +++ b/builtin-checkout.c > @@ -447,11 +447,21 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) > char *slash; > if (!argc || !strcmp(argv[0], "--")) > die ("--track needs a branch name"); > - slash = strchr(argv[0], '/'); > - if (slash && !prefixcmp(argv[0], "refs/")) > - slash = strchr(slash + 1, '/'); > - if (slash && !prefixcmp(argv[0], "remotes/")) > - slash = strchr(slash + 1, '/'); Why is this not enough? It strips refs/ if there is one, and remotes/ if there is one (possibly after stripping refs/). No? Puzzled, Dscho ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Extend "checkout --track" DWIM to support more cases 2008-08-20 19:52 ` Johannes Schindelin @ 2008-08-20 20:04 ` Alex Riesen 2008-08-20 20:16 ` Johannes Schindelin 0 siblings, 1 reply; 11+ messages in thread From: Alex Riesen @ 2008-08-20 20:04 UTC (permalink / raw) To: Johannes Schindelin; +Cc: git, Junio C Hamano Johannes Schindelin, Wed, Aug 20, 2008 21:52:23 +0200: > On Wed, 20 Aug 2008, Alex Riesen wrote: > > - slash = strchr(argv[0], '/'); > > - if (slash && !prefixcmp(argv[0], "refs/")) > > - slash = strchr(slash + 1, '/'); > > - if (slash && !prefixcmp(argv[0], "remotes/")) > > - slash = strchr(slash + 1, '/'); > > Why is this not enough? It strips refs/ if there is one, and remotes/ if > there is one (possibly after stripping refs/). No? > No. It strips refs/ OR remotes/ (because of prefixcmp with argv[0]). And I still wanted refs/<namespace>/something... ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Extend "checkout --track" DWIM to support more cases 2008-08-20 20:04 ` Alex Riesen @ 2008-08-20 20:16 ` Johannes Schindelin 2008-08-20 20:29 ` Alex Riesen 0 siblings, 1 reply; 11+ messages in thread From: Johannes Schindelin @ 2008-08-20 20:16 UTC (permalink / raw) To: Alex Riesen; +Cc: git, Junio C Hamano Hi, On Wed, 20 Aug 2008, Alex Riesen wrote: > Johannes Schindelin, Wed, Aug 20, 2008 21:52:23 +0200: > > On Wed, 20 Aug 2008, Alex Riesen wrote: > > > - slash = strchr(argv[0], '/'); > > > - if (slash && !prefixcmp(argv[0], "refs/")) > > > - slash = strchr(slash + 1, '/'); > > > - if (slash && !prefixcmp(argv[0], "remotes/")) > > > - slash = strchr(slash + 1, '/'); > > > > Why is this not enough? It strips refs/ if there is one, and remotes/ if > > there is one (possibly after stripping refs/). No? > > > > No. It strips refs/ OR remotes/ (because of prefixcmp with argv[0]). > And I still wanted refs/<namespace>/something... Yes, you are correct. However, to fix my thinko, I deem this preferable: -- snipsnap -- builtin-checkout.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/builtin-checkout.c b/builtin-checkout.c index e95eab9..2a076cf 100644 --- a/builtin-checkout.c +++ b/builtin-checkout.c @@ -448,8 +448,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) if (!argc || !strcmp(argv[0], "--")) die ("--track needs a branch name"); slash = strchr(argv[0], '/'); - if (slash && !prefixcmp(argv[0], "refs/")) - slash = strchr(slash + 1, '/'); + if (slash && !prefixcmp(argv[0], "refs/")) { + argv[0] = slash + 1; + slash = strchr(argv[0], '/'); + } if (slash && !prefixcmp(argv[0], "remotes/")) slash = strchr(slash + 1, '/'); if (!slash || !slash[1]) ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] Extend "checkout --track" DWIM to support more cases 2008-08-20 20:16 ` Johannes Schindelin @ 2008-08-20 20:29 ` Alex Riesen 2008-08-20 22:22 ` Junio C Hamano 0 siblings, 1 reply; 11+ messages in thread From: Alex Riesen @ 2008-08-20 20:29 UTC (permalink / raw) To: Johannes Schindelin; +Cc: git, Junio C Hamano Johannes Schindelin, Wed, Aug 20, 2008 22:16:19 +0200: > > > > No. It strips refs/ OR remotes/ (because of prefixcmp with argv[0]). > > And I still wanted refs/<namespace>/something... > > Yes, you are correct. However, to fix my thinko, I deem this preferable: > > -- snipsnap -- > > builtin-checkout.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/builtin-checkout.c b/builtin-checkout.c > index e95eab9..2a076cf 100644 > --- a/builtin-checkout.c > +++ b/builtin-checkout.c > @@ -448,8 +448,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) > if (!argc || !strcmp(argv[0], "--")) > die ("--track needs a branch name"); > slash = strchr(argv[0], '/'); > - if (slash && !prefixcmp(argv[0], "refs/")) > - slash = strchr(slash + 1, '/'); > + if (slash && !prefixcmp(argv[0], "refs/")) { > + argv[0] = slash + 1; > + slash = strchr(argv[0], '/'); > + } Yes, I agree (and its shorter). The git-checkout manpage can be improved, too (no DWIM is obvious, except may be for the implementor). ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Extend "checkout --track" DWIM to support more cases 2008-08-20 20:29 ` Alex Riesen @ 2008-08-20 22:22 ` Junio C Hamano 2008-08-21 17:23 ` Alex Riesen 0 siblings, 1 reply; 11+ messages in thread From: Junio C Hamano @ 2008-08-20 22:22 UTC (permalink / raw) To: Alex Riesen; +Cc: Johannes Schindelin, git Alex Riesen <raa.lkml@gmail.com> writes: > Johannes Schindelin, Wed, Aug 20, 2008 22:16:19 +0200: >> > >> > No. It strips refs/ OR remotes/ (because of prefixcmp with argv[0]). >> > And I still wanted refs/<namespace>/something... >> >> Yes, you are correct. However, to fix my thinko, I deem this preferable: >> >> -- snipsnap -- >> >> builtin-checkout.c | 6 ++++-- >> 1 files changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/builtin-checkout.c b/builtin-checkout.c >> index e95eab9..2a076cf 100644 >> --- a/builtin-checkout.c >> +++ b/builtin-checkout.c >> @@ -448,8 +448,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) >> if (!argc || !strcmp(argv[0], "--")) >> die ("--track needs a branch name"); >> slash = strchr(argv[0], '/'); >> - if (slash && !prefixcmp(argv[0], "refs/")) >> - slash = strchr(slash + 1, '/'); >> + if (slash && !prefixcmp(argv[0], "refs/")) { >> + argv[0] = slash + 1; >> + slash = strchr(argv[0], '/'); >> + } > > Yes, I agree (and its shorter). The git-checkout manpage can be > improved, too (no DWIM is obvious, except may be for the implementor). I think that makes sense. Care to send an appliable patch with documentation updates, please? ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] Extend "checkout --track" DWIM to support more cases 2008-08-20 22:22 ` Junio C Hamano @ 2008-08-21 17:23 ` Alex Riesen 2008-08-22 5:54 ` Junio C Hamano 2008-08-22 23:33 ` Jay Soffian 0 siblings, 2 replies; 11+ messages in thread From: Alex Riesen @ 2008-08-21 17:23 UTC (permalink / raw) To: Junio C Hamano; +Cc: Johannes Schindelin, git The code handles additionally "refs/remotes/<something>/name", "remotes/<something>/name", and "refs/<namespace>/name". Signed-off-by: Alex Riesen <raa.lkml@gmail.com> --- Junio C Hamano, Thu, Aug 21, 2008 00:22:21 +0200: > Alex Riesen <raa.lkml@gmail.com> writes: > > Johannes Schindelin, Wed, Aug 20, 2008 22:16:19 +0200: > >> > No. It strips refs/ OR remotes/ (because of prefixcmp with argv[0]). > >> > And I still wanted refs/<namespace>/something... > >> > >> Yes, you are correct. However, to fix my thinko, I deem this preferable: > >> > > > > Yes, I agree (and its shorter). The git-checkout manpage can be > > improved, too (no DWIM is obvious, except may be for the implementor). > > I think that makes sense. Care to send an appliable patch with > documentation updates, please? I just have another quiet evening, so I did that. Johannes, I changed your fix a bit: I see that argv[0] is used later (or if I'm blind and it actually isn't, it may be used in future: I have a feeling that builtint-checkout.c will be popular place). Documentation/git-checkout.txt | 18 +++++++++++++++--- builtin-checkout.c | 13 ++++++++----- t/t7201-co.sh | 23 ++++++++++++++++++++++- 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 43d4502..d93a18f 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -64,9 +64,21 @@ OPTIONS given. Set it to `always` if you want this behavior when the start-point is either a local or remote branch. + -If no '-b' option was given, a name will be made up for you, by stripping -the part up to the first slash of the tracked branch. For example, if you -called 'git checkout --track origin/next', the branch name will be 'next'. +If no '-b' option was given, the name of the new branch will be +derived from the remote branch, by attempting to guess the name of the +branch on remote system and use it. The algorithm will remove a +prefixed refs/ and the part after refs/ up to a slash (that part +usually being a branch namespace, which makes it confusing to use for +branch names). If the part after refs/ was remotes/, than a part past +it is stripped too (it is expected to be the name of remote system). +Otherwise, the part up to the first slash is removed. +The algorithm aborts either if the given name has no slashes in it or +if the part left after stripping the prefixes is empty. In this case, +the name should be provided with '-b'. ++ +For example, if you called 'git checkout --track origin/next', the +branch name will be 'next', as it will for 'git checkout --track +remotes/origin/next'. --no-track:: Ignore the branch.autosetupmerge configuration variable. diff --git a/builtin-checkout.c b/builtin-checkout.c index e95eab9..214b0b2 100644 --- a/builtin-checkout.c +++ b/builtin-checkout.c @@ -445,12 +445,15 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) /* --track without -b should DWIM */ if (opts.track && opts.track != -1 && !opts.new_branch) { char *slash; - if (!argc || !strcmp(argv[0], "--")) + char *argv0 = argv[0]; + if (!argc || !strcmp(argv0, "--")) die ("--track needs a branch name"); - slash = strchr(argv[0], '/'); - if (slash && !prefixcmp(argv[0], "refs/")) - slash = strchr(slash + 1, '/'); - if (slash && !prefixcmp(argv[0], "remotes/")) + slash = strchr(argv0, '/'); + if (slash && !prefixcmp(argv0, "refs/")) { + argv0 = slash + 1; + slash = strchr(argv0, '/'); + } + if (slash && !prefixcmp(argv0, "remotes/")) slash = strchr(slash + 1, '/'); if (!slash || !slash[1]) die ("Missing branch name; try -b"); diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 943dd57..1dff84d 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -340,9 +340,30 @@ test_expect_success \ test_expect_success \ 'checkout with --track fakes a sensible -b <name>' ' git update-ref refs/remotes/origin/koala/bear renamer && + git update-ref refs/new/koala/bear renamer && + git checkout --track origin/koala/bear && test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" && - test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"' + test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" && + + git checkout master && git branch -D koala/bear && + + git checkout --track refs/remotes/origin/koala/bear && + test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" && + test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" && + + git checkout master && git branch -D koala/bear && + + git checkout --track remotes/origin/koala/bear && + test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" && + test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" && + + git checkout master && git branch -D koala/bear && + + git checkout --track refs/new/koala/bear && + test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" && + test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" +' test_expect_success \ 'checkout with --track, but without -b, fails with too short tracked name' ' -- 1.6.0.59.g8ae62 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] Extend "checkout --track" DWIM to support more cases 2008-08-21 17:23 ` Alex Riesen @ 2008-08-22 5:54 ` Junio C Hamano 2008-08-22 9:08 ` Alex Riesen 2008-08-22 23:33 ` Jay Soffian 1 sibling, 1 reply; 11+ messages in thread From: Junio C Hamano @ 2008-08-22 5:54 UTC (permalink / raw) To: Alex Riesen; +Cc: Johannes Schindelin, git Alex Riesen <raa.lkml@gmail.com> writes: > The code handles additionally "refs/remotes/<something>/name", > "remotes/<something>/name", and "refs/<namespace>/name". > > Signed-off-by: Alex Riesen <raa.lkml@gmail.com> > --- > ... > I just have another quiet evening, so I did that. Johannes, I changed > your fix a bit: I see that argv[0] is used later (or if I'm blind and > it actually isn't, it may be used in future: I have a feeling that > builtint-checkout.c will be popular place). Thanks; the documentation looks good to me. > + char *argv0 = argv[0]; > + if (!argc || !strcmp(argv0, "--")) > die ("--track needs a branch name"); > + slash = strchr(argv0, '/'); > + if (slash && !prefixcmp(argv0, "refs/")) { > + argv0 = slash + 1; > + slash = strchr(argv0, '/'); > + } > + if (slash && !prefixcmp(argv0, "remotes/")) > slash = strchr(slash + 1, '/'); > if (!slash || !slash[1]) > die ("Missing branch name; try -b"); I however wonder if this is clearer. * "enum branch_track" was unsigned; comparing equality with -1 was Ok but we couldn't say 0 < opts.track; * argv[] is an array of constant strings; cannot point into it with opts.newbranch without making the latter also a constant string. * the logic is to strip "refs/" if there is one, "remotes/" if there is one after that, and then strip one level after that unconditionally. No need to look explicitly for a slash while doing the first two steps. cache.h | 1 + builtin-checkout.c | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git i/cache.h w/cache.h index 928ae9f..a097a95 100644 --- i/cache.h +++ w/cache.h @@ -451,6 +451,7 @@ enum safe_crlf { extern enum safe_crlf safe_crlf; enum branch_track { + BRANCH_TRACK_UNSPECIFIED = -1, BRANCH_TRACK_NEVER = 0, BRANCH_TRACK_REMOTE, BRANCH_TRACK_ALWAYS, diff --git i/builtin-checkout.c w/builtin-checkout.c index e95eab9..b380ad6 100644 --- i/builtin-checkout.c +++ w/builtin-checkout.c @@ -157,7 +157,7 @@ struct checkout_opts { int force; int writeout_error; - char *new_branch; + const char *new_branch; int new_branch_log; enum branch_track track; }; @@ -437,27 +437,27 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) git_config(git_default_config, NULL); - opts.track = -1; + opts.track = BRANCH_TRACK_UNSPECIFIED; argc = parse_options(argc, argv, options, checkout_usage, PARSE_OPT_KEEP_DASHDASH); /* --track without -b should DWIM */ - if (opts.track && opts.track != -1 && !opts.new_branch) { - char *slash; - if (!argc || !strcmp(argv[0], "--")) + if (0 < opts.track && !opts.new_branch) { + const char *argv0 = argv[0]; + if (!argc || !strcmp(argv0, "--")) die ("--track needs a branch name"); - slash = strchr(argv[0], '/'); - if (slash && !prefixcmp(argv[0], "refs/")) - slash = strchr(slash + 1, '/'); - if (slash && !prefixcmp(argv[0], "remotes/")) - slash = strchr(slash + 1, '/'); - if (!slash || !slash[1]) + if (!prefixcmp(argv0, "refs/")) + argv0 += 5; + if (!prefixcmp(argv0, "remotes/")) + argv0 += 8; + argv0 = strchr(argv0, '/'); + if (!argv0 || !argv0[1]) die ("Missing branch name; try -b"); - opts.new_branch = slash + 1; + opts.new_branch = argv0 + 1; } - if (opts.track == -1) + if (opts.track == BRANCH_TRACK_UNSPECIFIED) opts.track = git_branch_track; if (opts.force && opts.merge) ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] Extend "checkout --track" DWIM to support more cases 2008-08-22 5:54 ` Junio C Hamano @ 2008-08-22 9:08 ` Alex Riesen 2008-08-22 21:17 ` Junio C Hamano 0 siblings, 1 reply; 11+ messages in thread From: Alex Riesen @ 2008-08-22 9:08 UTC (permalink / raw) To: Junio C Hamano; +Cc: Johannes Schindelin, git 2008/8/22 Junio C Hamano <gitster@pobox.com>: > I however wonder if this is clearer. It is :) > * "enum branch_track" was unsigned; comparing equality with -1 was Ok but > we couldn't say 0 < opts.track; > > * argv[] is an array of constant strings; cannot point into it with > opts.newbranch without making the latter also a constant string. Cleanup, but it is unrelated, isn't it? > * the logic is to strip "refs/" if there is one, "remotes/" if there is > one after that, and then strip one level after that unconditionally. > No need to look explicitly for a slash while doing the first two steps. Maybe that should go in documentation instead of the piece I wrote ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Extend "checkout --track" DWIM to support more cases 2008-08-22 9:08 ` Alex Riesen @ 2008-08-22 21:17 ` Junio C Hamano 0 siblings, 0 replies; 11+ messages in thread From: Junio C Hamano @ 2008-08-22 21:17 UTC (permalink / raw) To: Alex Riesen; +Cc: Junio C Hamano, Johannes Schindelin, git "Alex Riesen" <raa.lkml@gmail.com> writes: > 2008/8/22 Junio C Hamano <gitster@pobox.com>: >> I however wonder if this is clearer. > > It is :) > >> * "enum branch_track" was unsigned; comparing equality with -1 was Ok but >> we couldn't say 0 < opts.track; >> >> * argv[] is an array of constant strings; cannot point into it with >> opts.newbranch without making the latter also a constant string. > > Cleanup, but it is unrelated, isn't it? The code did not compile without it for me as I sometimes use -Werror. >> * the logic is to strip "refs/" if there is one, "remotes/" if there is >> one after that, and then strip one level after that unconditionally. >> No need to look explicitly for a slash while doing the first two steps. > > Maybe that should go in documentation instead of the piece I wrote Oh I think what you wrote is fine. I tried to be more descriptive than simply saying "No need to look explicitly for a slash" while explaining the changes. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Extend "checkout --track" DWIM to support more cases 2008-08-21 17:23 ` Alex Riesen 2008-08-22 5:54 ` Junio C Hamano @ 2008-08-22 23:33 ` Jay Soffian 1 sibling, 0 replies; 11+ messages in thread From: Jay Soffian @ 2008-08-22 23:33 UTC (permalink / raw) To: Alex Riesen; +Cc: Junio C Hamano, Johannes Schindelin, git On Thu, Aug 21, 2008 at 1:23 PM, Alex Riesen <raa.lkml@gmail.com> wrote: > +If no '-b' option was given, the name of the new branch will be > +derived from the remote branch, by attempting to guess the name of the > +branch on remote system and use it. The algorithm will remove a > +prefixed refs/ and the part after refs/ up to a slash (that part > +usually being a branch namespace, which makes it confusing to use for > +branch names). If the part after refs/ was remotes/, than a part past s/than/then/ j. ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-08-22 23:34 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-08-20 18:50 [PATCH] Extend "checkout --track" DWIM to support more cases Alex Riesen 2008-08-20 19:52 ` Johannes Schindelin 2008-08-20 20:04 ` Alex Riesen 2008-08-20 20:16 ` Johannes Schindelin 2008-08-20 20:29 ` Alex Riesen 2008-08-20 22:22 ` Junio C Hamano 2008-08-21 17:23 ` Alex Riesen 2008-08-22 5:54 ` Junio C Hamano 2008-08-22 9:08 ` Alex Riesen 2008-08-22 21:17 ` Junio C Hamano 2008-08-22 23:33 ` Jay Soffian
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).