-
-
Notifications
You must be signed in to change notification settings - Fork 28
'--tags' for auto push mode to include --follow-tags (pushes annotated tags) #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is not bad but we can improve the validation a bit more.
Try what the merge
command or other do:
For example this below:
Lines 260 to 292 in 79b9681
set -l v_abort | |
set -l v_continue | |
set -l v_branch | |
for v in $argv | |
switch $v | |
case -a --abort | |
set v_abort $v | |
case -c --continue | |
set v_continue $v | |
case -h --help | |
echo "NAME" | |
echo " Gitnow: merge - Merge given branch into the active one" | |
echo "EXAMPLES" | |
echo " merge <branch to merge>" | |
echo "OPTIONS:" | |
echo " -a --abort Abort a conflicted merge" | |
echo " -c --continue Continue a conflicted merge" | |
echo " -h --help Show information about the options for this command" | |
return | |
case -\* | |
case '*' | |
set v_branch $v | |
end | |
end | |
# abort | |
if test "$v_abort"; | |
echo "Abort the current merge" | |
command git merge --abort | |
commandline -f repaint | |
return | |
end |
Can you follow the code?
What essentially does is it just iterate all possible args passed for that command and collect them inside a loop and a switch. Then finally verify some options as needed.
The idea of this approach is that not always a particular flag like --tags
can be in the same array position.
For example in your code you are assuming that --tags
is coming in the second item (index 1) of the $opts
array which can be not necessarily the case depending in the user typing.
I think that loop and switch approach give you more flexibility to decide when apply certain actions independently of user typing. It also increases readability and you could add a |
Also those are the "old" commands |
The question is: What happens to/with the auto mode? Those other commands (merge/move) work that way because they have no auto mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did upgrade the draft code.
Did change it, was already implementing it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to adjust a bit the push
command.
Here my tests:
# 0.
~/d/test (master) 18ms > tag
v0.0.0
v0.0.0-beta.4
v0.0.0-beta.3
v0.0.0-beta.2
v0.0.0-beta.1
v0.0.0-beta.0
# 1.
~/d/test (master) 25ms > push -h
🚀 Pushing changes...
NAME
Gitnow: push - Push current branch to default origin
OPTIONS:
-t --tags (auto mode) include annotated tags the relate to the commits
-h --help Show information about the options for this command
# 2.
~/d/test (master) 26ms > push -t
🚀 Pushing changes...
Mode: Auto (incl. tags)
Remote URL: origin (ssh://git@server.com/test/test.git)
Remote branch: master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 894 bytes | 894.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To server.com:test/test.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
# 3.
~/d/test (master) 995ms > git push origin master --follow-tags
Everything up-to-date
Review
- This one is fine but the echo
🚀 Pushing changes...
is wrong. - This looks ok at the beginning but at the end the tags are not pushed. See next one.
- Looks like
--follow-tags
pushes annotated tags only. That's why we should prefer just the--tags
flag similar topull
command.
Here using --tags
for pushing:
~/d/test (master) 4.95s > git push origin master --tags
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 904 bytes | 904.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0), pack-reused 0
To server.com:test/test.git
221c82f..bfacee4 master -> master
* [new tag] v0.0.0-beta.5 -> v0.0.0-beta.5
* [new tag] v0.0.0-beta.6 -> v0.0.0-beta.6
Regarding 3), do we want that? I mean pushing all tags, because that's what it does as far as i understand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding 3), do we want that? I mean pushing all tags, because that's what it does as far as i understand.
--follow-tags
does only push the annotated tags, which relate to the commits I am pushing.
Sorry, I misunderstood the intention of the PR. You are right about --follow-tags
.
I think for make it even more clear please update the PR description accordingly.
After those changes I think we should be ready to merge. |
I think it makes sense (for now) to only push the annotated tags with the extended auto mode since these are meant to be for releases and the lightweight tags without annotations are made for local use only. Those should not be pushed so easily, at least not in auto mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense (for now) to only push the annotated tags with the extended auto mode since these are meant to be for releases and the lightweight tags without annotations are made for local use only. Those should not be pushed so easily, at least not in auto mode.
Yeah, that was the idea so we are done.
Thanks 👍 |
Feel free to comment/change.