Add tests for fast-forwarding a tag by push
Lightweight tags can be fast-forwarded if Push is assigned. Since Push allows pushing tags for new commits, fast-forward also succeeds if the tag is updated to a new commit. To update an annotated tag git requires --force on push. Hence annotated tags can only be updated if force Push is assigned. Change-Id: I976f0174b1842003d37e437920d68307fa8ba05a Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -150,6 +150,16 @@ public class GitUtil {
|
||||
return cmd.call();
|
||||
}
|
||||
|
||||
public static Ref updateAnnotatedTag(TestRepository<?> testRepo, String name,
|
||||
PersonIdent tagger) throws GitAPIException {
|
||||
TagCommand tc = testRepo.git().tag().setName(name);
|
||||
return tc.setAnnotated(true)
|
||||
.setMessage(name)
|
||||
.setTagger(tagger)
|
||||
.setForceUpdate(true)
|
||||
.call();
|
||||
}
|
||||
|
||||
public static void fetch(TestRepository<?> testRepo, String spec)
|
||||
throws GitAPIException {
|
||||
FetchCommand fetch = testRepo.git().fetch();
|
||||
@@ -205,7 +215,7 @@ public class GitUtil {
|
||||
return pushTag(testRepo, tag, false);
|
||||
}
|
||||
|
||||
private static PushResult pushTag(TestRepository<?> testRepo, String tag,
|
||||
public static PushResult pushTag(TestRepository<?> testRepo, String tag,
|
||||
boolean force) throws GitAPIException {
|
||||
PushCommand pushCmd = testRepo.git().push();
|
||||
pushCmd.setForce(force);
|
||||
|
||||
Reference in New Issue
Block a user