'--tags' for auto push mode to include --follow-tags (pushes annotated tags)#40
'--tags' for auto push mode to include --follow-tags (pushes annotated tags)#40joseluisq merged 6 commits intojoseluisq:masterfrom lukasgierth:master
Conversation
There was a problem hiding this comment.
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
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. |
joseluisq
left a comment
There was a problem hiding this comment.
I did upgrade the draft code.
|
Did change it, was already implementing it. |
joseluisq
left a comment
There was a problem hiding this comment.
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-dateReview
- 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-tagspushes annotated tags only. That's why we should prefer just the--tagsflag similar topullcommand.
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. |
joseluisq
left a comment
There was a problem hiding this comment.
Regarding 3), do we want that? I mean pushing all tags, because that's what it does as far as i understand.
--follow-tagsdoes 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. |
joseluisq
left a comment
There was a problem hiding this comment.
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.