dim: Allow passing rebase options to retip with implicit branch
The subcommand "retip" allows passing extra git rebase options, but that requires the branch name to be explicitly passed as first argument. Since we do not expect branch names to start with a dash, let's allow the user to pass extra rebase options without the need to explicitly pass the branch name if the current one is to be used.
Signed-off-by: Gustavo Sousa gustavo.sousa@intel.com
Merge request reports
Activity
Only because git really doesn't allow branches starting with '-' we can do this. Otherwise I wouldn't like this assumption.
$ git branch -- -branch-name fatal: '-branch-name' is not a valid branch name
But we should perhaps have a deeper change in dim to get more towards using local branches then passing the branch name... I believe @demarchi had some thoughts and proposal on that.
But anyway, for this case here at least the proposed solution should always work...
According to the note on git-check-ref-format for
--branch
, a branch can not start with a dash (although that's more like an "observation" type of note then an official list of rules for branches).For me, passing the branch name is always odd, because that's not how
git
itself works. If I want to operate in another branch, I'd just cd to the corresponding directory. Even dim itself having a DIM_HOMEI think of dim as an extension to
git
, so that's why I think it's odd. Even dim needing a DIM_PREFIX is odd IMO. I'd rather letdim
assume PWD is part of a dim setup and work from there. When you have 2 dim checkouts and have to work on both it's very odd to have:setup2 $ dim ub
and then realize that it was "setup1" that actually got updated. But I know changing it would be very hard.