Skip to content

Commit 9038b1d

Browse files
author
Stephan Dilly
committed
pull gets tags on current branch (closes #1013)
1 parent 3bc4feb commit 9038b1d

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ The way this works got changed and simplified ([See docs](https://github.com/ext
2828
- allow customizing key symbols like `` & `` ([see docs](https://github.com/extrawurst/gitui/blob/master/KEY_CONFIG.md#key-symbols)) ([#465](https://github.com/extrawurst/gitui/issues/465))
2929
- simplify key overrides ([see docs](https://github.com/extrawurst/gitui/blob/master/KEY_CONFIG.md)) ([#946](https://github.com/extrawurst/gitui/issues/946))
3030
- dedicated fuzzy finder up/down keys to allow vim overrides ([#993](https://github.com/extrawurst/gitui/pull/993))
31+
- pull will also pull down tags on current branch ([#1013](https://github.com/extrawurst/gitui/pull/1013))
3132

3233
### Fixed
3334
- honor options (for untracked files) in `stage_all` command ([#933](https://github.com/extrawurst/gitui/issues/933))

asyncgit/src/sync/remotes/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ pub(crate) fn fetch(
149149
let mut remote = repo.find_remote(&remote_name)?;
150150

151151
let mut options = FetchOptions::new();
152+
options.download_tags(git2::AutotagOption::All);
152153
let callbacks = Callbacks::new(progress_sender, basic_credential);
153154
options.remote_callbacks(callbacks.callbacks());
154155

asyncgit/src/sync/remotes/tags.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ mod tests {
155155
remotes::{fetch, push::push},
156156
tests::{repo_clone, repo_init_bare},
157157
};
158+
use pretty_assertions::assert_eq;
158159
use sync::tests::write_commit_file;
159160

160161
#[test]
@@ -273,4 +274,42 @@ mod tests {
273274
tags_missing_remote(clone1_dir, "origin", None).unwrap();
274275
assert!(tags_missing.is_empty());
275276
}
277+
278+
#[test]
279+
fn test_tags_fetch_same_branch() {
280+
let (r1_dir, _repo) = repo_init_bare().unwrap();
281+
let r1_dir = r1_dir.path().to_str().unwrap();
282+
283+
let (clone1_dir, clone1) = repo_clone(r1_dir).unwrap();
284+
let clone1_dir = clone1_dir.path().to_str().unwrap();
285+
286+
let commit1 =
287+
write_commit_file(&clone1, "test.txt", "test", "commit1");
288+
push(
289+
clone1_dir, "origin", "master", false, false, None, None,
290+
)
291+
.unwrap();
292+
293+
let (clone2_dir, _clone2) = repo_clone(r1_dir).unwrap();
294+
let clone2_dir = clone2_dir.path().to_str().unwrap();
295+
296+
// clone1 - creates tag
297+
298+
sync::tag(clone1_dir, &commit1, "tag1").unwrap();
299+
300+
let tags1 = sync::get_tags(clone1_dir).unwrap();
301+
302+
push_tags(clone1_dir, "origin", None, None).unwrap();
303+
let tags_missing =
304+
tags_missing_remote(clone1_dir, "origin", None).unwrap();
305+
assert!(tags_missing.is_empty());
306+
307+
// clone 2 - pull
308+
309+
fetch(clone2_dir, "master", None, None).unwrap();
310+
311+
let tags2 = sync::get_tags(clone2_dir).unwrap();
312+
313+
assert_eq!(tags1, tags2);
314+
}
276315
}

0 commit comments

Comments
 (0)