Skip to content

Commit 13b6b2f

Browse files
author
Stephan Dilly
authored
support deleting tag on remote (#1079)
1 parent 060380f commit 13b6b2f

File tree

16 files changed

+221
-61
lines changed

16 files changed

+221
-61
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- allow reverting a commit from the commit log ([#927](https://github.com/extrawurst/gitui/issues/927))
2020
- disable pull cmd on local-only branches ([#1047](https://github.com/extrawurst/gitui/issues/1047))
2121
- support adding annotations to tags ([#747](https://github.com/extrawurst/gitui/issues/747))
22+
- support deleting tag on remote ([#1074](https://github.com/extrawurst/gitui/issues/1074))
2223

2324
### Fixed
2425
- Keep commit message when pre-commit hook fails ([#1035](https://github.com/extrawurst/gitui/issues/1035))

asyncgit/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub use crate::{
5555
status::{AsyncStatus, StatusParams},
5656
sync::{
5757
diff::{DiffLine, DiffLineType, FileDiff},
58+
remotes::push::PushType,
5859
status::{StatusItem, StatusItemType},
5960
},
6061
tags::AsyncTags,

asyncgit/src/push.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
use crate::{
22
error::{Error, Result},
33
sync::{
4-
cred::BasicAuthCredential, remotes::push::push,
5-
remotes::push::ProgressNotification, RepoPath,
4+
cred::BasicAuthCredential,
5+
remotes::push::push_raw,
6+
remotes::push::{ProgressNotification, PushType},
7+
RepoPath,
68
},
79
AsyncGitNotification, RemoteProgress,
810
};
@@ -20,6 +22,8 @@ pub struct PushRequest {
2022
///
2123
pub branch: String,
2224
///
25+
pub push_type: PushType,
26+
///
2327
pub force: bool,
2428
///
2529
pub delete: bool,
@@ -100,10 +104,11 @@ impl AsyncPush {
100104
arc_progress,
101105
);
102106

103-
let res = push(
107+
let res = push_raw(
104108
&repo,
105109
params.remote.as_str(),
106110
params.branch.as_str(),
111+
params.push_type,
107112
params.force,
108113
params.delete,
109114
params.basic_credential.clone(),

asyncgit/src/sync/branch/merge_commit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ mod test {
9999
use super::*;
100100
use crate::sync::{
101101
branch_compare_upstream,
102-
remotes::{fetch, push::push},
102+
remotes::{fetch, push::push_branch},
103103
tests::{
104104
debug_cmd_print, get_commit_ids, repo_clone,
105105
repo_init_bare, write_commit_file, write_commit_file_at,
@@ -129,7 +129,7 @@ mod test {
129129
Time::new(1, 0),
130130
);
131131

132-
push(
132+
push_branch(
133133
&clone1_dir.path().to_str().unwrap().into(),
134134
"origin",
135135
"master",
@@ -151,7 +151,7 @@ mod test {
151151
);
152152

153153
//push should fail since origin diverged
154-
assert!(push(
154+
assert!(push_branch(
155155
&clone2_dir.into(),
156156
"origin",
157157
"master",
@@ -228,7 +228,7 @@ mod test {
228228
"git status",
229229
);
230230

231-
push(
231+
push_branch(
232232
&clone1_dir.path().to_str().unwrap().into(),
233233
"origin",
234234
"master",

asyncgit/src/sync/branch/merge_ff.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub fn branch_merge_upstream_fastforward(
5353
pub mod test {
5454
use super::*;
5555
use crate::sync::{
56-
remotes::{fetch, push::push},
56+
remotes::{fetch, push::push_branch},
5757
tests::{
5858
debug_cmd_print, get_commit_ids, repo_clone,
5959
repo_init_bare, write_commit_file,
@@ -75,7 +75,7 @@ pub mod test {
7575
let commit1 =
7676
write_commit_file(&clone1, "test.txt", "test", "commit1");
7777

78-
push(
78+
push_branch(
7979
&clone1_dir.path().to_str().unwrap().into(),
8080
"origin",
8181
"master",
@@ -99,7 +99,7 @@ pub mod test {
9999
"commit2",
100100
);
101101

102-
push(
102+
push_branch(
103103
&clone2_dir.path().to_str().unwrap().into(),
104104
"origin",
105105
"master",

asyncgit/src/sync/branch/merge_rebase.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ mod test {
3838
use super::*;
3939
use crate::sync::{
4040
branch_compare_upstream, get_commits_info,
41-
remotes::{fetch, push::push},
41+
remotes::{fetch, push::push_branch},
4242
tests::{
4343
debug_cmd_print, get_commit_ids, repo_clone,
4444
repo_init_bare, write_commit_file, write_commit_file_at,
@@ -81,7 +81,7 @@ mod test {
8181

8282
assert_eq!(clone1.head_detached().unwrap(), false);
8383

84-
push(
84+
push_branch(
8585
&clone1_dir.into(),
8686
"origin",
8787
"master",
@@ -111,7 +111,7 @@ mod test {
111111

112112
assert_eq!(clone2.head_detached().unwrap(), false);
113113

114-
push(
114+
push_branch(
115115
&clone2_dir.into(),
116116
"origin",
117117
"master",
@@ -193,7 +193,7 @@ mod test {
193193
Time::new(0, 0),
194194
);
195195

196-
push(
196+
push_branch(
197197
&clone1_dir.into(),
198198
"origin",
199199
"master",
@@ -219,7 +219,7 @@ mod test {
219219
Time::new(1, 0),
220220
);
221221

222-
push(
222+
push_branch(
223223
&clone2_dir.into(),
224224
"origin",
225225
"master",
@@ -287,7 +287,7 @@ mod test {
287287
let _commit1 =
288288
write_commit_file(&clone1, "test.txt", "test", "commit1");
289289

290-
push(
290+
push_branch(
291291
&clone1_dir.into(),
292292
"origin",
293293
"master",
@@ -312,7 +312,7 @@ mod test {
312312
"commit2",
313313
);
314314

315-
push(
315+
push_branch(
316316
&clone2_dir.into(),
317317
"origin",
318318
"master",

asyncgit/src/sync/branch/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ mod tests_branch_compare {
458458
mod tests_branches {
459459
use super::*;
460460
use crate::sync::{
461-
remotes::{get_remotes, push::push},
461+
remotes::{get_remotes, push::push_branch},
462462
rename_branch,
463463
tests::{
464464
debug_cmd_print, repo_clone, repo_init, repo_init_bare,
@@ -509,7 +509,7 @@ mod tests_branches {
509509
write_commit_file(&repo, "f1.txt", "foo", "c1");
510510
rename_branch(&dir.into(), "refs/heads/master", branch_name)
511511
.unwrap();
512-
push(
512+
push_branch(
513513
&dir.into(),
514514
"origin",
515515
branch_name,
@@ -715,7 +715,7 @@ mod test_delete_branch {
715715
#[cfg(test)]
716716
mod test_remote_branches {
717717
use super::*;
718-
use crate::sync::remotes::push::push;
718+
use crate::sync::remotes::push::push_branch;
719719
use crate::sync::tests::{
720720
repo_clone, repo_init_bare, write_commit_file,
721721
};
@@ -744,7 +744,7 @@ mod test_remote_branches {
744744

745745
write_commit_file(&clone1, "test.txt", "test", "commit1");
746746

747-
push(
747+
push_branch(
748748
&clone1_dir.into(),
749749
"origin",
750750
"master",
@@ -759,7 +759,7 @@ mod test_remote_branches {
759759

760760
write_commit_file(&clone1, "test.txt", "test2", "commit2");
761761

762-
push(
762+
push_branch(
763763
&clone1_dir.into(),
764764
"origin",
765765
"foo",
@@ -801,7 +801,7 @@ mod test_remote_branches {
801801
// clone1
802802

803803
write_commit_file(&clone1, "test.txt", "test", "commit1");
804-
push(
804+
push_branch(
805805
&clone1_dir.into(),
806806
"origin",
807807
"master",
@@ -813,7 +813,7 @@ mod test_remote_branches {
813813
.unwrap();
814814
create_branch(&clone1_dir.into(), "foo").unwrap();
815815
write_commit_file(&clone1, "test.txt", "test2", "commit2");
816-
push(
816+
push_branch(
817817
&clone1_dir.into(),
818818
"origin",
819819
"foo",
@@ -869,7 +869,7 @@ mod test_remote_branches {
869869
let branch_name = "bar/foo";
870870

871871
write_commit_file(&clone1, "test.txt", "test", "commit1");
872-
push(
872+
push_branch(
873873
&clone1_dir.into(),
874874
"origin",
875875
"master",
@@ -881,7 +881,7 @@ mod test_remote_branches {
881881
.unwrap();
882882
create_branch(&clone1_dir.into(), branch_name).unwrap();
883883
write_commit_file(&clone1, "test.txt", "test2", "commit2");
884-
push(
884+
push_branch(
885885
&clone1_dir.into(),
886886
"origin",
887887
branch_name,
@@ -921,7 +921,7 @@ mod test_remote_branches {
921921
// clone1
922922

923923
write_commit_file(&clone1, "test.txt", "test", "commit1");
924-
push(
924+
push_branch(
925925
&clone1_dir.into(),
926926
"origin",
927927
"master",
@@ -933,7 +933,7 @@ mod test_remote_branches {
933933
.unwrap();
934934
create_branch(&clone1_dir.into(), "foo").unwrap();
935935
write_commit_file(&clone1, "test.txt", "test2", "commit2");
936-
push(
936+
push_branch(
937937
&clone1_dir.into(),
938938
"origin",
939939
"foo",

asyncgit/src/sync/remotes/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ fn fetch_from_remote(
9595
options.download_tags(git2::AutotagOption::All);
9696
options.remote_callbacks(callbacks.callbacks());
9797
remote.fetch(&[] as &[&str], Some(&mut options), None)?;
98+
// fetch tags (also removing remotely deleted ones)
99+
remote.fetch(
100+
&["refs/tags/*:refs/tags/*"],
101+
Some(&mut options),
102+
None,
103+
)?;
98104

99105
Ok(())
100106
}

0 commit comments

Comments
 (0)