should warn about unused branch path element attribute

Bug #1843124 reported by Sam Bull
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Breezy
Triaged
Low
Unassigned

Bug Description

When running something like:
  brz branch git+ssh://....git,branch=fix/something

It actually branches from the master branch. Even worse (though I didn't want to run this again to double check), if I later 'brz push :parent', it actually force pushes this local branch over the correct remote branch, thus wiping out any commits on the remote branch that already existed.

Tags: git url
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

forward slashes need to be escaped in branch names; you'd want fix%2Fsomething rather than fix/something.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

In this particular case, you're setting the "branch" attribute on the parent directory, rather than the actual thing you're cloning.

Revision history for this message
Sam Bull (dreamsorcerer) wrote :

So, not putting in the slash gives me the expected result. But, if the slash is there then it clones master, regardless of the branch value. I'm not sure what you mean about setting the attribute on the parent directory, but it's certainly not the behaviour I would expect just from the presence of a slash.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

To put it differently, this specifies that there is a branch named fix under repository bar and that you want the contents of a directory named "something" in that branch.

git+ssh://example.com/bar,branch=fix/something

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

We could potentially warn you in this case that /bar is not a repository and so the branch parameter is ignored.

Revision history for this message
Sam Bull (dreamsorcerer) wrote :

So, you're saying that it is essentially looking for: git+ssh://example.com/bar,branch=fix ?

However, if I put that in directly, I either get the fix branch, or I get an error that the fix branch doesn't exist. The presence of a slash changes this behaviour to get the master branch without any errors.

So, I would expect to see the same behaviour, and get an error that the branch doesn't exist (which will then make it more obvious that it's only getting the branch name up to the slash).

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

It would be looking at the branch=fix attribute if it didn't find a version control directory at git+ssh://example.com/bar/something, but did find a version control directory at git+ssh://example.com/bar.

summary: - branch remote git gives the wrong branch
+ should warn about unused branch path element attribute
Changed in brz:
status: New → Triaged
importance: Undecided → Low
tags: added: git url
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.