0

I use cygwin with mintty terminal to simulate a linux commandline environment under windows. It's really helpful because I can use e.g. git with aliases via commandline.

But I recognized an issue using GIT via cygwin. When I try to use 'git rebase -i' to reorder my commits I get always the following error message: '/usr/libexec/git-core/git-rebase--interactive: line 135: 1 + : syntax error: operand expected (error token is "+ ")'

It doesn't matter in which project I use this command, I tried an Android project of mine and a different Java project. So it seems it's not related to the sourcecode itself. Also a different terminal seems to have no effect. I tried the Cygwin Mintty terminal and the windows powershell. The issue appears in both terminals.

Does someone have an idea what could be the problem?

Ben
  • 696
  • 9
  • 19

1 Answers1

0

I think the culprit is this line: total=$(($new_count + $(git stripspace --strip-comments <"$todo" | wc -l))). The $(( operator , in my experience, can be tricky if it's not separated with a white space. If that's the case, I think you should edit the line (so that you don't wait for a newer version of git with it corrected) to have a single space between $(( and the $new_count.... the same thing on closing. In other words, replace it for: total=$(( $new_count + $(git stripspace --strip-comments <"$todo" | wc -l) )). In my git for windows, the path is in: <git_installation_dir>/mingw64/libexec/git-core/git-rebase--interactive. Let me know how it goes so that I can send a patch to the git community.

eftshift0
  • 26,375
  • 3
  • 36
  • 60
  • thanks for your suggestion, but the change does not fix the issue. But I guess to change it would be correct because in line 133 the $( is also seperated with spaces. For me the file path was '/usr/libexec/git-core/git-rebase--interactive' Edit: Probably I have to reboot to make get your suggestion work, I will test it. – Ben Jun 27 '17 at 22:05
  • So I tried a reboot, unfortunately the issue is still there. I think it has something to do with the 'wc -l' command. But I don't know exactly what's the problem. – Ben Jun 27 '17 at 22:11
  • Then try mailing the git community directly. No need to be registered on the mail list to be able to send them a question. – eftshift0 Jun 27 '17 at 22:22
  • before I'll try to debug that a little bit deeper so I can give them more information. Probably the $todo variable is empty or something like that. If I or guys from the mailing list can find the origin of that issue, I will post it here. – Ben Jun 28 '17 at 08:14