* some apparent inaccuracies in "man git-worktree" @ 2017-11-14 8:43 Robert P. J. Day 2017-11-14 18:33 ` Eric Sunshine 0 siblings, 1 reply; 4+ messages in thread From: Robert P. J. Day @ 2017-11-14 8:43 UTC (permalink / raw) To: Git Mailing list more annoying pedantry (but you're used to that by now, right?) ... from "man git-worktree", there seem to be some inaccuracies in the SYNOPSIS regarding the "add" subcommand: git worktree add \ [-f] [--detach] [--checkout] [--lock] [-b <new-branch>] <path> [<branch>] first, there's no mention of "-B" in that SYNOPSIS, even though it's explained further down the man page. next, the SYNOPSIS seems misleading as it doesn't make clear that the options -b, -B and --detach are mutually exclusive, which is made clear in the worktree.c source: if (!!opts.detach + !!opts.new_branch + !!new_branch_force > 1) die(_("-b, -B, and --detach are mutually exclusive")); and, to some extent, further down the man page: "If <branch> is omitted and neither -b nor -B nor --detach used, then, as a convenience, a new branch based at HEAD is created automatically, as if -b $(basename <path>) was specified." finally (and maybe i'm just not reading carefully enough), it's not clear what happens if you add a worktree at a given commit without specifying *any* of -b, -B or --detach. the obvious result should be a new worktree checked out at a detached HEAD and, interestingly, if i do that, then from the main tree, i see: $ git worktree list /home/rpjday/k/git 516fb7f2e73d [master] /home/rpjday/k/temp c470abd4fde4 (detached HEAD) $ but from within the worktree, if i ask for the status, i see only: $ git status Not currently on any branch. nothing to commit, working tree clean $ where i would normally have expected to see "detached HEAD", is there a reason that's not displayed? rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ======================================================================== ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: some apparent inaccuracies in "man git-worktree" 2017-11-14 8:43 some apparent inaccuracies in "man git-worktree" Robert P. J. Day @ 2017-11-14 18:33 ` Eric Sunshine 2017-11-14 20:10 ` Robert P. J. Day 0 siblings, 1 reply; 4+ messages in thread From: Eric Sunshine @ 2017-11-14 18:33 UTC (permalink / raw) To: Robert P. J. Day; +Cc: Git Mailing list On Tue, Nov 14, 2017 at 3:43 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote: > from "man git-worktree", there seem to be some inaccuracies in the > SYNOPSIS regarding the "add" subcommand: > > git worktree add \ > [-f] [--detach] [--checkout] [--lock] [-b <new-branch>] <path> [<branch>] > > first, there's no mention of "-B" in that SYNOPSIS, even though it's > explained further down the man page. Omission of "-B" from the synopsis was intentional. From cbdf60fa18 (worktree: add -b/-B options, 2015-07-06): worktree: add -b/-B options One of git-worktree's roles is to populate the new worktree, much like git-checkout, and thus, for convenience, ought to support several of the same shortcuts. Toward this goal, add -b/-B options to create a new branch and check it out in the new worktree. (For brevity, only -b is mentioned in the synopsis; -B is omitted.) Whether or not the omission was actually a good decision is questionable. The thinking, at the time, may have been that users already familiar with "-b" in 'git checkout' would likewise be familiar with (and be able to infer) "-B", thus it wasn't important to state its existence explicitly in the synopsis, which was already getting lengthy. Of course, that decision does not assist newcomers, so adding "-B" to the synopsis would help the page better stand on its own. > next, the SYNOPSIS seems misleading as it doesn't make clear that > the options -b, -B and --detach are mutually exclusive, which is made > clear in the worktree.c source: > > if (!!opts.detach + !!opts.new_branch + !!new_branch_force > 1) > die(_("-b, -B, and --detach are mutually exclusive")); Failure to update the synopsis to indicate mutual exclusion appears to be a simple oversight in ab0b2c53ed (worktree: make --detach mutually exclusive with -b/-B, 2015-07-17) in response to: https://public-inbox.org/git/55A8F4B1.9060304@drmicha.warpmail.net/ > finally (and maybe i'm just not reading carefully enough), it's not > clear what happens if you add a worktree at a given commit without > specifying *any* of -b, -B or --detach. the obvious result should be a > new worktree checked out at a detached HEAD and, interestingly, if i > do that, then from the main tree, i see: > > $ git worktree list > /home/rpjday/k/git 516fb7f2e73d [master] > /home/rpjday/k/temp c470abd4fde4 (detached HEAD) > $ > > but from within the worktree, if i ask for the status, i see only: > > $ git status > Not currently on any branch. > nothing to commit, working tree clean > $ > > where i would normally have expected to see "detached HEAD", is there > a reason that's not displayed? Someone more familiar with this bit can correct me if I'm wrong, but I believe that the "HEAD detached at/from <branch>" you normally see with 'git status' is derived from the reflog, and if it can't find the information in the reflog, it instead shows the generic "Not currently on any branch" (which is the equivalent of the "(detached HEAD)" you see in "git worktree list"). Each worktree has its own newly-created reflog, which does _not_ contain enough information for 'git status' to present the more detailed "detached" message, thus it falls back to the generic one. Perhaps seeding the worktree's reflog with a bit more information at creation time would be a good #leftoverbits task. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: some apparent inaccuracies in "man git-worktree" 2017-11-14 18:33 ` Eric Sunshine @ 2017-11-14 20:10 ` Robert P. J. Day 2017-11-21 19:44 ` Jonathan Nieder 0 siblings, 1 reply; 4+ messages in thread From: Robert P. J. Day @ 2017-11-14 20:10 UTC (permalink / raw) To: Eric Sunshine; +Cc: Git Mailing list On Tue, 14 Nov 2017, Eric Sunshine wrote: > On Tue, Nov 14, 2017 at 3:43 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote: > > from "man git-worktree", there seem to be some inaccuracies in the > > SYNOPSIS regarding the "add" subcommand: > > > > git worktree add \ > > [-f] [--detach] [--checkout] [--lock] [-b <new-branch>] <path> [<branch>] > > > > first, there's no mention of "-B" in that SYNOPSIS, even though it's > > explained further down the man page. > > Omission of "-B" from the synopsis was intentional. From cbdf60fa18 > (worktree: add -b/-B options, 2015-07-06): > > worktree: add -b/-B options > > One of git-worktree's roles is to populate the new worktree, much like > git-checkout, and thus, for convenience, ought to support several of the > same shortcuts. Toward this goal, add -b/-B options to create a new > branch and check it out in the new worktree. > > (For brevity, only -b is mentioned in the synopsis; -B is omitted.) > > Whether or not the omission was actually a good decision is > questionable. The thinking, at the time, may have been that users > already familiar with "-b" in 'git checkout' would likewise be > familiar with (and be able to infer) "-B", thus it wasn't important to > state its existence explicitly in the synopsis, which was already > getting lengthy. Of course, that decision does not assist newcomers, > so adding "-B" to the synopsis would help the page better stand on its > own. > > > next, the SYNOPSIS seems misleading as it doesn't make clear that > > the options -b, -B and --detach are mutually exclusive, which is made > > clear in the worktree.c source: > > > > if (!!opts.detach + !!opts.new_branch + !!new_branch_force > 1) > > die(_("-b, -B, and --detach are mutually exclusive")); > > Failure to update the synopsis to indicate mutual exclusion appears to > be a simple oversight in ab0b2c53ed (worktree: make --detach mutually > exclusive with -b/-B, 2015-07-17) in response to: > https://public-inbox.org/git/55A8F4B1.9060304@drmicha.warpmail.net/ > > > finally (and maybe i'm just not reading carefully enough), it's not > > clear what happens if you add a worktree at a given commit without > > specifying *any* of -b, -B or --detach. the obvious result should be a > > new worktree checked out at a detached HEAD and, interestingly, if i > > do that, then from the main tree, i see: > > > > $ git worktree list > > /home/rpjday/k/git 516fb7f2e73d [master] > > /home/rpjday/k/temp c470abd4fde4 (detached HEAD) > > $ > > > > but from within the worktree, if i ask for the status, i see only: > > > > $ git status > > Not currently on any branch. > > nothing to commit, working tree clean > > $ > > > > where i would normally have expected to see "detached HEAD", is there > > a reason that's not displayed? > > Someone more familiar with this bit can correct me if I'm wrong, but I > believe that the "HEAD detached at/from <branch>" you normally see > with 'git status' is derived from the reflog, and if it can't find the > information in the reflog, it instead shows the generic "Not currently > on any branch" (which is the equivalent of the "(detached HEAD)" you > see in "git worktree list"). > > Each worktree has its own newly-created reflog, which does _not_ > contain enough information for 'git status' to present the more > detailed "detached" message, thus it falls back to the generic one. > Perhaps seeding the worktree's reflog with a bit more information at > creation time would be a good #leftoverbits task. i'm not sure what i can add to this, but i'm going to leave it to folks higher up the food chain than me to resolve any of the above. rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ======================================================================== ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: some apparent inaccuracies in "man git-worktree" 2017-11-14 20:10 ` Robert P. J. Day @ 2017-11-21 19:44 ` Jonathan Nieder 0 siblings, 0 replies; 4+ messages in thread From: Jonathan Nieder @ 2017-11-21 19:44 UTC (permalink / raw) To: Robert P. J. Day; +Cc: Eric Sunshine, Git Mailing list Hi, Robert P. J. Day wrote: > On Tue, 14 Nov 2017, Eric Sunshine wrote: >> On Tue, Nov 14, 2017 at 3:43 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote: >>> from "man git-worktree", there seem to be some inaccuracies in the >>> SYNOPSIS regarding the "add" subcommand: >>> >>> git worktree add \ >>> [-f] [--detach] [--checkout] [--lock] [-b <new-branch>] <path> [<branch>] >>> >>> first, there's no mention of "-B" in that SYNOPSIS, even though it's >>> explained further down the man page. >> >> Omission of "-B" from the synopsis was intentional. From cbdf60fa18 >> (worktree: add -b/-B options, 2015-07-06): [...] >> Whether or not the omission was actually a good decision is >> questionable. [...] >>> next, the SYNOPSIS seems misleading as it doesn't make clear that >>> the options -b, -B and --detach are mutually exclusive, which is made >>> clear in the worktree.c source: [...] >> Failure to update the synopsis to indicate mutual exclusion appears to >> be a simple oversight in ab0b2c53ed (worktree: make --detach mutually >> exclusive with -b/-B, 2015-07-17) [...] >>> finally (and maybe i'm just not reading carefully enough), it's not >>> clear what happens if you add a worktree at a given commit without >>> specifying *any* of -b, -B or --detach. the obvious result should be a >>> new worktree checked out at a detached HEAD and, interestingly, if i >>> do that, then from the main tree, i see: >>> >>> $ git worktree list >>> /home/rpjday/k/git 516fb7f2e73d [master] >>> /home/rpjday/k/temp c470abd4fde4 (detached HEAD) >>> $ >>> >>> but from within the worktree, if i ask for the status, i see only: >>> >>> $ git status >>> Not currently on any branch. >>> nothing to commit, working tree clean >>> $ >>> >>> where i would normally have expected to see "detached HEAD", is there >>> a reason that's not displayed? >> >> Someone more familiar with this bit can correct me if I'm wrong, but I >> believe that the "HEAD detached at/from <branch>" you normally see >> with 'git status' is derived from the reflog, [...] > i'm not sure what i can add to this, but i'm going to leave it to > folks higher up the food chain than me to resolve any of the above. For what it's worth, the folks higher up the food chain you're referring to don't exist, so the most likely outcome here is that nothing happens. People working on patches (suggesting wording, formatting as a patch, reviewing, testing, etc) are as high on the food chain as it gets. :) One thing we've discussed on this list before is setting up a bug tracker to allow people another way to collaborate (filing a clear summary of a problem for interested people to work on). More on that subject later today --- feel free to poke me if I don't get such a message out. Thanks, Jonathan ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-21 19:44 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-11-14 8:43 some apparent inaccuracies in "man git-worktree" Robert P. J. Day 2017-11-14 18:33 ` Eric Sunshine 2017-11-14 20:10 ` Robert P. J. Day 2017-11-21 19:44 ` Jonathan Nieder
Code repositories for project(s) associated with this public inbox https://80x24.org/mirrors/git.git 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 read-only IMAP folder(s) and NNTP newsgroup(s).