Merge "Make Repository.shortenRefName static"

This commit is contained in:
Shawn Pearce 2010-11-08 17:42:21 -05:00 committed by Code Review
commit 09555c9853
3 changed files with 4 additions and 5 deletions

View File

@ -150,7 +150,7 @@ protected void run() throws Exception {
startBranch = startRef.getName(); startBranch = startRef.getName();
else else
startBranch = startAt.name(); startBranch = startAt.name();
startBranch = db.shortenRefName(startBranch); startBranch = Repository.shortenRefName(startBranch);
String newRefName = newHead; String newRefName = newHead;
if (!newRefName.startsWith(Constants.R_HEADS)) if (!newRefName.startsWith(Constants.R_HEADS))
newRefName = Constants.R_HEADS + newRefName; newRefName = Constants.R_HEADS + newRefName;

View File

@ -77,14 +77,13 @@ protected RefRename(final RefUpdate src, final RefUpdate dst) {
source = src; source = src;
destination = dst; destination = dst;
Repository repo = destination.getRepository();
String cmd = ""; String cmd = "";
if (source.getName().startsWith(Constants.R_HEADS) if (source.getName().startsWith(Constants.R_HEADS)
&& destination.getName().startsWith(Constants.R_HEADS)) && destination.getName().startsWith(Constants.R_HEADS))
cmd = "Branch: "; cmd = "Branch: ";
setRefLogMessage(cmd + "renamed " setRefLogMessage(cmd + "renamed "
+ repo.shortenRefName(source.getName()) + " to " + Repository.shortenRefName(source.getName()) + " to "
+ repo.shortenRefName(destination.getName())); + Repository.shortenRefName(destination.getName()));
} }
/** @return identity of the user making the change in the reflog. */ /** @return identity of the user making the change in the reflog. */

View File

@ -1119,7 +1119,7 @@ public File getWorkTree() throws NoWorkTreeException {
* *
* @return a more user friendly ref name * @return a more user friendly ref name
*/ */
public String shortenRefName(String refName) { public static String shortenRefName(String refName) {
if (refName.startsWith(Constants.R_HEADS)) if (refName.startsWith(Constants.R_HEADS))
return refName.substring(Constants.R_HEADS.length()); return refName.substring(Constants.R_HEADS.length());
if (refName.startsWith(Constants.R_TAGS)) if (refName.startsWith(Constants.R_TAGS))