This error occurred while piping the output of powershell script to git fast import. The detailed error report is as follows:
D:\demo_history7 [master +4 ~0 -0 !]> .\testscript.ps1 -CSVFileName Report_Recent.csv |git fast-import fatal: Branch name doesn't conform to GIT standards: refs/heads/master fast-import: dumping crash report to .git/fast_import_crash_5968
So what is the cause of this error and how can I resolve it ?
Git fast import is not recognizing the output of powershell script. That's why itz showing the error:branch name does not conform to git standards: refs/heads/master. I am trying to pipe the output of this script to git fast-import, in order to display the history of the respective file in git remote repository, but getting the above error(as mentioned in question).My powershell script is given in the below answer. Please provide a solution.
This is my powershell script:
Script for traversing through csv file
[CmdletBinding(SupportsShouldProcess=$true)]
Param
(
[string] $CSVFileName
)
# Readthe contents of the CSV file in a single shot
#Write-Output "CSV File Name is $CSVFileName"
$CSVFileContents = Import-Csv $CSVFileName
# Iterate through each file(column) in the list
foreach($CSVFile in $CSVFileContents)
{
# Get the parameters related to each file(column)
$FileVersion = $CSVFile."File Version"
$Owner = $CSVFile.Owner
$UpdateDate = $CSVFile."Update Date"
$FileName = $CSVFile.Filename
$Specification = $CSVFile.Specification
$ProjectFolder = $CSVFile."Project Folder"
#Get the string size of the path
$FolderName = "D:\demo_history\" + $ProjectFolder + $FileVersion + "_" + $FileName + "\" + $FileVersion + "_" + $FileName
$FolderName = $FolderName.Replace("/","\")
$count = $FolderName.length
#Get contents of the file,display the contents and get size
$Filecontent = Get-Content D:\demo_history2\RMS\APP\RSS\src\com\retek\stores\transfers\states\1_SearchTransferState.java\SearchTransferState.java
$Getitemsize = Get-Item D:\demo_history2\RMS\APP\RSS\src\com\retek\stores\transfers\states\1_SearchTransferState.java\SearchTransferState.java
$Length = $Getitemsize.length
$getmark=Write-Output "mark :$FileVersion"
$Comment = "from Serena Dimensions by $Owner on $UpdateDate"
$Sample = $ProjectFolder + $FileVersion + "_" + $FileName + "\" + $FileVersion + "_" + $FileName
$Sample = $Sample.Replace("/","\")
$Mode = "M 644 inline $Sample"
#printing output
Write-Output "commit refs/heads/master\r\n"
Write-Output "$getmark"
Write-Output "committer $Owner <$UpdateDate> -62167239000 -0700"
Write-Output "data $count"
Write-Output "$Comment"
Write-Output "$Mode"
Write-Output "data $Length"
Write-Output "$Filecontent"
}
I am trying to pipe the output of this script to git fast-import, in order to display the history of the respective file in git remote repository, but getting the above error(as mentioned in question). Please provide a solution.
The branch name
testscript.ps1
consists of some invalid characters for a branch name in git.A Git branch name can not include the following characters.: