package com.atlassian.stash.internal.scm.git.command.foreachref;

public class ForEachRefUtils {

    // http://git.661346.n2.nabble.com/git-log-doesn-t-allow-x00-in-custom-format-anymore-td5610930.html
    public static final String SEPARATOR_CHAR = "\2";

    /**
     * @param format Git format string using '|' to separate each column of data, for readability only
     * @return new format that uses {@link #SEPARATOR_CHAR} which will avoid clashes with strings that actually contain '|'
     */
    public static String normalize(String format) {
        // Note that for-each-ref uses a slightly different format for hex bytes than rev-list
        return format.replace("|", "%02");
    }
}
