* BUG 1.7.9: git branch fails to create new branch when --edit-description is used @ 2012-01-27 21:52 Mark Jason Dominus 2012-01-27 23:21 ` Junio C Hamano 0 siblings, 1 reply; 9+ messages in thread From: Mark Jason Dominus @ 2012-01-27 21:52 UTC (permalink / raw) To: git This should work, but doesn't: % git branch * master % git branch --edit-description blarf [Edit description and exit editor normally] % cat .git/BRANCH_DESCRIPTION I like blarf # Please edit the description for the branch # blarf # Lines starting with '#' will be stripped. % git branch -a * master Where is branch blarf? Creating the branch and editing the description afterwards works correctly: % git branch blarf % git branch --edit-description blarf % git branch -a blarf * master % cat .git/config [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [branch "master"] description = I like pie\n [branch "blarf"] description = I like blarf\n Mark Jason Dominus mjd@plover.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: BUG 1.7.9: git branch fails to create new branch when --edit-description is used 2012-01-27 21:52 BUG 1.7.9: git branch fails to create new branch when --edit-description is used Mark Jason Dominus @ 2012-01-27 23:21 ` Junio C Hamano 2012-01-28 6:46 ` Michael Haggerty 0 siblings, 1 reply; 9+ messages in thread From: Junio C Hamano @ 2012-01-27 23:21 UTC (permalink / raw) To: Mark Jason Dominus; +Cc: git Mark Jason Dominus <mjd@plover.com> writes: > This should work, but doesn't: > > % git branch > * master > % git branch --edit-description blarf > [Edit description and exit editor normally] > % cat .git/BRANCH_DESCRIPTION > I like blarf > # Please edit the description for the branch > # blarf > # Lines starting with '#' will be stripped. > % git branch -a > * master > > Where is branch blarf? You haven't created one in that sequence yet. This is more of a documentation bug. As the SYNOPSIS section makes it clear, the '--edit-description' is a separate mode from showing (the first group), creating or repointing (the second), or renaming (the third). After that you should be able to say "git branch blarf" and view its description. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: BUG 1.7.9: git branch fails to create new branch when --edit-description is used 2012-01-27 23:21 ` Junio C Hamano @ 2012-01-28 6:46 ` Michael Haggerty 2012-01-28 7:27 ` Junio C Hamano 0 siblings, 1 reply; 9+ messages in thread From: Michael Haggerty @ 2012-01-28 6:46 UTC (permalink / raw) To: Junio C Hamano; +Cc: Mark Jason Dominus, git On 01/28/2012 12:21 AM, Junio C Hamano wrote: > Mark Jason Dominus <mjd@plover.com> writes: > >> This should work, but doesn't: >> >> % git branch >> * master >> % git branch --edit-description blarf >> [Edit description and exit editor normally] >> % cat .git/BRANCH_DESCRIPTION >> I like blarf >> # Please edit the description for the branch >> # blarf >> # Lines starting with '#' will be stripped. >> % git branch -a >> * master >> >> Where is branch blarf? > > You haven't created one in that sequence yet. > > This is more of a documentation bug. > > As the SYNOPSIS section makes it clear, the '--edit-description' is a > separate mode from showing (the first group), creating or repointing (the > second), or renaming (the third). > > After that you should be able to say "git branch blarf" and view its > description. Given this design, shouldn't "git branch --edit-description" fail if the branch doesn't already exist? Shouldn't it also resolve ambiguous reference names? Michael -- Michael Haggerty mhagger@alum.mit.edu http://softwareswirl.blogspot.com/ ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: BUG 1.7.9: git branch fails to create new branch when --edit-description is used 2012-01-28 6:46 ` Michael Haggerty @ 2012-01-28 7:27 ` Junio C Hamano 2012-01-29 3:18 ` Jeff King 2012-01-29 6:30 ` Michael Haggerty 0 siblings, 2 replies; 9+ messages in thread From: Junio C Hamano @ 2012-01-28 7:27 UTC (permalink / raw) To: Michael Haggerty; +Cc: Junio C Hamano, Mark Jason Dominus, git Michael Haggerty <mhagger@alum.mit.edu> writes: >>> Where is branch blarf? >> >> You haven't created one in that sequence yet. >> >> This is more of a documentation bug. >> >> As the SYNOPSIS section makes it clear, the '--edit-description' is a >> separate mode from showing (the first group), creating or repointing (the >> second), or renaming (the third). >> >> After that you should be able to say "git branch blarf" and view its >> description. > > Given this design, shouldn't "git branch --edit-description" fail if the > branch doesn't already exist? The only use scenario in the original design was to have a way to store the description given a branch name, and giving a description to a branch that does not yet exist is outside the scope of the design. So it all boils down to what is the most convenient and the simplest to explain. We could error it out (i.e. you cannot name a thing that does not yet exist), or we could consider it is a convenience feature that you can prepare a description even before you create one, or we could even tweak it more like "-t $name" that tries to work both on existing one (without changing any base) or non-existing one, creating it while at it. The last approach historically is the most error prone (we had numerous bugs in the create_branch() helper after it started allowing an existing branch when updating the "track" information) and I would rather not go that route if we can avoid it. Honestly speaking, I haven't formed an opinion. > Shouldn't it also resolve ambiguous reference names? As this mode, just like other modes of "git branch" _always_ takes a branch name, I do not think there is any "ambiguous reference name". You give $name to it, and it should always mean refs/heads/$name, and there shouldn't be any DWIMming to something like refs/heads/mh/$name Or do you have other kinds of ambiguity in mind? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: BUG 1.7.9: git branch fails to create new branch when --edit-description is used 2012-01-28 7:27 ` Junio C Hamano @ 2012-01-29 3:18 ` Jeff King 2012-01-29 6:30 ` Michael Haggerty 1 sibling, 0 replies; 9+ messages in thread From: Jeff King @ 2012-01-29 3:18 UTC (permalink / raw) To: Junio C Hamano; +Cc: Michael Haggerty, Mark Jason Dominus, git On Fri, Jan 27, 2012 at 11:27:29PM -0800, Junio C Hamano wrote: > > Given this design, shouldn't "git branch --edit-description" fail if the > > branch doesn't already exist? > > The only use scenario in the original design was to have a way to store > the description given a branch name, and giving a description to a branch > that does not yet exist is outside the scope of the design. So it all > boils down to what is the most convenient and the simplest to explain. How do we define "branch exists"? That the ref exists? What about a HEAD that points to a branch-to-be-born? Specifically, I am wondering whether this: $ git init $ git branch --edit-description should work. Right now it edits the description for "master", even though you haven't yet committed to it. -Peff ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: BUG 1.7.9: git branch fails to create new branch when --edit-description is used 2012-01-28 7:27 ` Junio C Hamano 2012-01-29 3:18 ` Jeff King @ 2012-01-29 6:30 ` Michael Haggerty 2012-01-29 6:42 ` Junio C Hamano 2012-01-29 21:49 ` Junio C Hamano 1 sibling, 2 replies; 9+ messages in thread From: Michael Haggerty @ 2012-01-29 6:30 UTC (permalink / raw) To: Junio C Hamano; +Cc: Mark Jason Dominus, git On 01/28/2012 08:27 AM, Junio C Hamano wrote: > Michael Haggerty <mhagger@alum.mit.edu> writes: > >>>> Where is branch blarf? >>> >>> You haven't created one in that sequence yet. >>> >>> This is more of a documentation bug. >>> >>> As the SYNOPSIS section makes it clear, the '--edit-description' is a >>> separate mode from showing (the first group), creating or repointing (the >>> second), or renaming (the third). >>> >>> After that you should be able to say "git branch blarf" and view its >>> description. >> >> Given this design, shouldn't "git branch --edit-description" fail if the >> branch doesn't already exist? > > The only use scenario in the original design was to have a way to store > the description given a branch name, and giving a description to a branch > that does not yet exist is outside the scope of the design. So it all > boils down to what is the most convenient and the simplest to explain. > > We could error it out (i.e. you cannot name a thing that does not yet > exist), or we could consider it is a convenience feature that you can > prepare a description even before you create one, or we could even tweak > it more like "-t $name" that tries to work both on existing one (without > changing any base) or non-existing one, creating it while at it. The last > approach historically is the most error prone (we had numerous bugs in the > create_branch() helper after it started allowing an existing branch when > updating the "track" information) and I would rather not go that route if > we can avoid it. > > Honestly speaking, I haven't formed an opinion. I vote for an error. Otherwise a typo in the branch name would lead to the description's apparent disappearance into Nirvana. An error would, for example, have made it clear to the OP what was happening. A more useful option might be git branch --with-description <branchname> [<start-point>] i.e., that a branch's description can be set at the same time as the branch is created. >> Shouldn't it also resolve ambiguous reference names? > > As this mode, just like other modes of "git branch" _always_ takes a > branch name, I do not think there is any "ambiguous reference name". > > You give $name to it, and it should always mean refs/heads/$name, and > there shouldn't be any DWIMming to something like refs/heads/mh/$name > > Or do you have other kinds of ambiguity in mind? OK, I wasn't aware that only local branches can have descriptions attached to them. Given that fact, you are correct that DWIMming doesn't make sense. Michael -- Michael Haggerty mhagger@alum.mit.edu http://softwareswirl.blogspot.com/ ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: BUG 1.7.9: git branch fails to create new branch when --edit-description is used 2012-01-29 6:30 ` Michael Haggerty @ 2012-01-29 6:42 ` Junio C Hamano 2012-01-29 10:11 ` Michael Haggerty 2012-01-29 21:49 ` Junio C Hamano 1 sibling, 1 reply; 9+ messages in thread From: Junio C Hamano @ 2012-01-29 6:42 UTC (permalink / raw) To: Michael Haggerty; +Cc: Mark Jason Dominus, git Michael Haggerty <mhagger@alum.mit.edu> writes: > On 01/28/2012 08:27 AM, Junio C Hamano wrote: >> >> We could error it out (i.e. you cannot name a thing that does not yet >> exist), or we could consider it is a convenience feature that you can >> prepare a description even before you create one, or we could even tweak >> it more like "-t $name" that tries to work both on existing one (without >> changing any base) or non-existing one, creating it while at it. The last >> approach historically is the most error prone (we had numerous bugs in the >> create_branch() helper after it started allowing an existing branch when >> updating the "track" information) and I would rather not go that route if >> we can avoid it. >> >> Honestly speaking, I haven't formed an opinion. > > I vote for an error. Otherwise a typo in the branch name would lead to > the description's apparent disappearance into Nirvana. An error would, > for example, have made it clear to the OP what was happening. > > A more useful option might be > > git branch --with-description <branchname> [<start-point>] > > i.e., that a branch's description can be set at the same time as the > branch is created. So you are saying either option 1 or 3 is preferrable, while I was saying I would rather avoid 3 if we could avoid it. Is that the short version? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: BUG 1.7.9: git branch fails to create new branch when --edit-description is used 2012-01-29 6:42 ` Junio C Hamano @ 2012-01-29 10:11 ` Michael Haggerty 0 siblings, 0 replies; 9+ messages in thread From: Michael Haggerty @ 2012-01-29 10:11 UTC (permalink / raw) To: Junio C Hamano; +Cc: Mark Jason Dominus, git On 01/29/2012 07:42 AM, Junio C Hamano wrote: > Michael Haggerty <mhagger@alum.mit.edu> writes: > >> On 01/28/2012 08:27 AM, Junio C Hamano wrote: >>> >>> We could error it out (i.e. you cannot name a thing that does not yet >>> exist), or we could consider it is a convenience feature that you can >>> prepare a description even before you create one, or we could even tweak >>> it more like "-t $name" that tries to work both on existing one (without >>> changing any base) or non-existing one, creating it while at it. The last >>> approach historically is the most error prone (we had numerous bugs in the >>> create_branch() helper after it started allowing an existing branch when >>> updating the "track" information) and I would rather not go that route if >>> we can avoid it. >>> >>> Honestly speaking, I haven't formed an opinion. >> >> I vote for an error. Otherwise a typo in the branch name would lead to >> the description's apparent disappearance into Nirvana. An error would, >> for example, have made it clear to the OP what was happening. >> >> A more useful option might be >> >> git branch --with-description <branchname> [<start-point>] >> >> i.e., that a branch's description can be set at the same time as the >> branch is created. > > So you are saying either option 1 or 3 is preferrable, while I was saying > I would rather avoid 3 if we could avoid it. Is that the short version? Not quite. I agree that "--add-description" should fail if the branch already exists. But I was suggesting that there be a new *different* option that can be used when creating a branch. "--with-description" is probably not a great name, but I think it is a good idea that it be spelled differently than "--add-description". Perhaps even "--message", even though the abbreviation "-m" is precluded by the existing "-m" option. Michael -- Michael Haggerty mhagger@alum.mit.edu http://softwareswirl.blogspot.com/ ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: BUG 1.7.9: git branch fails to create new branch when --edit-description is used 2012-01-29 6:30 ` Michael Haggerty 2012-01-29 6:42 ` Junio C Hamano @ 2012-01-29 21:49 ` Junio C Hamano 1 sibling, 0 replies; 9+ messages in thread From: Junio C Hamano @ 2012-01-29 21:49 UTC (permalink / raw) To: Michael Haggerty; +Cc: Mark Jason Dominus, git Michael Haggerty <mhagger@alum.mit.edu> writes: > On 01/28/2012 08:27 AM, Junio C Hamano wrote: >> Michael Haggerty <mhagger@alum.mit.edu> writes: >> > I vote for an error. Otherwise a typo in the branch name would lead to > the description's apparent disappearance into Nirvana. An error would, > for example, have made it clear to the OP what was happening. I agree with this statement. Unless or until we update --edit-description to create a new branch when given a name of a branch that does not exist, the existing behaviour is simply an accident waiting to happen. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-01-29 21:49 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-01-27 21:52 BUG 1.7.9: git branch fails to create new branch when --edit-description is used Mark Jason Dominus 2012-01-27 23:21 ` Junio C Hamano 2012-01-28 6:46 ` Michael Haggerty 2012-01-28 7:27 ` Junio C Hamano 2012-01-29 3:18 ` Jeff King 2012-01-29 6:30 ` Michael Haggerty 2012-01-29 6:42 ` Junio C Hamano 2012-01-29 10:11 ` Michael Haggerty 2012-01-29 21:49 ` Junio C Hamano
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).