此代码获取Git fromHash
和toHash
,然后进行比较。被注释掉的行不会产生正确的Git语句。我可以获取该结果并自己运行,并获得正确的差异结果。但是,当diff = MyUtilities.RunCommandCom...
运行它时,它似乎忽略了最后一个toHash
变量,因为它返回了从fromHash
到当前的所有内容。我也证实了这一点。为什么会这样呢?我也尝试过fromHash & " " & toHash
。谢谢!
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim fromHash As String
Dim toHash As String
Dim diff As String
fromHash = MyUtilities.RunCommandCom("cd " & repoBox.Text & " & ""c:\Program Files\Git\cmd\git.exe"" rev-list -n 1 " & fromTagBox.Text, False)
toHash = MyUtilities.RunCommandCom("cd " & repoBox.Text & " & ""c:\Program Files\Git\cmd\git.exe"" rev-list -n 1 " & toTagBox.Text, False)
'resultsLabel.Text = "diff --name-only " & fromHash & " " & toHash
diff = MyUtilities.RunCommandCom("cd " & repoBox.Text & " & ""c:\Program Files\Git\cmd\git.exe"" diff --name-only " & fromHash & Space(1) & toHash, False)
resultsLabel.Text = diff
End Sub