Skip to content

Authors file copies to wrong path on Clone #1071

@leftler

Description

@leftler

When you specify a --authors= value when doing a clone command the File.Copy for this section

public bool Parse(string authorsFilePath, string gitDir)
{
    var savedAuthorFile = Path.Combine(gitDir, GitTfsCachedAuthorsFileName);
    if (!string.IsNullOrWhiteSpace(authorsFilePath))
    {
        if (!File.Exists(authorsFilePath))
        {
            throw new GitTfsException("Authors file cannot be found: '" + authorsFilePath + "'");
        }
        else
        {
            Trace.WriteLine("Reading authors file : " + authorsFilePath);
            bool parseSuccess;
            using (StreamReader sr = new StreamReader(authorsFilePath))
            {
                parseSuccess = Parse(sr);
            }
            try
            {
                File.Copy(authorsFilePath, savedAuthorFile, true);
                return parseSuccess;
            }
            catch (Exception) { }
        }
    }
    ...

Will only have .git passed in to gitDir this causes the 2nd argument to File.Copy to be .git\git-tfs_authors which will be aginst the relitive path of where you ran git-tfs, not the path of the directory that is about to be cloned.

I think both the incorrect path and a trace warning inside the empty catch block should be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions