Bug 515165 - Transport.push doesn't prune stale heads nor tags though Transport.setRemoveDeletedRefs(true) set
Summary: Transport.push doesn't prune stale heads nor tags though Transport.setRemoveD...
Status: NEW
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 4.6.1   Edit
Hardware: PC Mac OS X
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-12 05:45 EDT by Sergey Voytovich CLA
Modified: 2017-05-27 10:42 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Voytovich CLA 2017-04-12 05:45:02 EDT
Documentation describing setRemoveDeletedRefs tells us that 
git push --prune behaviour is supported and one can enable it by setting removeDeletedRefs to true. 
        //from org.eclipse.jgit.transport
	/**
	 * Set whether or not to remove refs which no longer exist in the source.
	 * <p>
	 * If true, refs at the destination repository (local for fetch, remote for
	 * push) are deleted if they no longer exist on the source side (remote for
	 * fetch, local for push).
	 * <p>
	 * False by default, as this may cause data to become unreachable, and
	 * eventually be deleted on the next GC.
	 *
	 * @param remove true to remove refs that no longer exist.
	 */
	public void setRemoveDeletedRefs(final boolean remove) {
		removeDeletedRefs = remove;
	}

That doesn't happen for push: neither locally removed heads or refs becomes deleted on remote unless implicit refspec ":refs/heads/head-to-delete" passed.

Works as expected for fetch.