From da06fb2951b830fbbf33db5a7c700811eb0f1463 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Sat, 10 Mar 2012 15:14:45 +0400 Subject: [PATCH] Fix 'git fetch --prune' deleting all remote refs. Before Git 1.7.7.2 'git fetch --prune origin master' used to remove all remote references. This was fixed in 1.7.7.2. For the sake of simplicity we are not going to call '--prune' for the older Gits. Other way would be to call 'git remote prune origin' for older Gits, but this auto-prune feature doesn't seem to be important enough for such effort. --- .../git4idea/src/git4idea/config/GitVersionSpecialty.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/config/GitVersionSpecialty.java b/plugins/git4idea/src/git4idea/config/GitVersionSpecialty.java index 3c3f384249b2..fbb0826f1fd8 100644 --- a/plugins/git4idea/src/git4idea/config/GitVersionSpecialty.java +++ b/plugins/git4idea/src/git4idea/config/GitVersionSpecialty.java @@ -73,10 +73,15 @@ public enum GitVersionSpecialty { } }, + /** + * {@code git fetch --prune} is actually supported since 1.7.0, + * but before 1.7.7.2 calling {@code git fetch --prune origin master} would delete all other references. + * This was fixed in {@code ed43de6ec35dfd4c4bd33ae9b5f2ebe38282209f} and added to the Git 1.7.7.2 release. + */ SUPPORTS_FETCH_PRUNE { @Override public boolean existsIn(@NotNull GitVersion version) { - return version.isLaterOrEqual(new GitVersion(1, 7, 0, 0)); + return version.isLaterOrEqual(new GitVersion(1, 7, 7, 2)); } },