0

I'm in the process of writing an application to move commits back and forth between Git and ClearCase repositories.

Git version is: 1.8.3.msysgit.0

The code is written in Python (2.7.5) and I'm getting a wierd error. The behaviour on the command line and the behaviour of the same command in the application are not the same:

From my application's log, I get this::

[git diff --name-status -M -z --ignore-submodules 4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac^..4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac --] exit code: 128
Command output for [git diff --name-status -M -z --ignore-submodules 4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac^..4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac --]:
stderr >> fatal: bad revision '4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac^..4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac'

However from the same Windows command line, no results, but no error either:

C:\Temp\gitcc_test>git diff --name-status -M -z --ignore-submodules 4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac^..4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac --

C:\Temp\gitcc_test>

On a similar note, if I run this command line (showing the diffs, not just renamed files), I get output:

C:\Temp\gitcc_test>git diff --ignore-submodules 6a4db18a0048db2dfe0e6639cabcdf10e265a1b6..4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac --
diff --git a/hello.txt b/hello.txt
index 3eecb7d..da588dd 100644
--- a/hello.txt
+++ b/hello.txt
@@ -1 +1 @@
-Bonjour!
+Hello!

C:\Temp\gitcc_test>

But this command returns nothing:

C:\Temp\gitcc_test>git diff --ignore-submodules 4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac^..4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac --

C:\Temp\gitcc_test>

The parent commit of 4dc7... is 6a4d..., so why doesn't 4dc7...^ give me any results?

Thanks in advance!

Chris Cooper
  • 4,982
  • 1
  • 17
  • 27
  • 1
    That does look like it should work. I know msysgit has oddities due to Windows (though I don't use Windows so am not sure about the various broken bits), so the first thing I'd try is this: When you give `git diff` the `A..B` syntax it behaves the same as `git diff A B`, so maybe replacing the `A..B` part with two separate arguments will make msysgit behave better. (But that's just a shot in the dark.) – torek Feb 25 '14 at 17:19
  • @torek Thanks for the suggestion, I had tried that, and I'm afraid the behaviour is the same. – Chris Cooper Feb 26 '14 at 15:09

1 Answers1

0

It turns out that not using the '..' and placing the caret at the other end of the hash works a treat on both command line and under Python.

So this:

git diff --name-status -M -z --ignore-submodules 4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac^..4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac --

Becomes this:

git diff --name-status -M -z --ignore-submodules ^4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac 4dc7ad29d69ee2385802b262bfb9a4f1e28f10ac --

And everything works a treat!

Chris Cooper
  • 4,982
  • 1
  • 17
  • 27