Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-13417

git-plugin: rev-parse dereferencing tags breaks on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • git-plugin
    • None
    • Windows 2008 R2 slave launched with cygwin ssh, cygwin git

      The change to GitAPI.java in commit 13f6038acc4fa5b5a62413155da6fc8cfcad3fe0 seems to break the git plugin for Windows, at least in some circumstances. The syntax rev^

      {commit} gets mangled by cmd because ^ is a quote character. This means that cmd passes rev{commit}

      to git, which as a cygwin executable being run from Windows, further tries to do wildcard expansion and maps this to revcommit. Putting "" around rev^

      {commit} empirically seems to work, though I haven't tried it in the git plugin itself.

      This C fragment:
      #include <stdio.h>
      int main(int argc, char* argv[])
      {
          int i;
          for (i = 0; i < argc; ++i)
          {
              printf("%s\n", argv[i]);
          }
          return 0;
      }
      


      when compiled with mingw to a native Windows application (a.exe) and invoked from cmd as a.exe a^{b} prints a{b}. When the same fragment is compiled with cygwin gcc to cygwin executable a.exe and is invoked the same way from cmd, it prints ab. Both print a^{b} when invoked from cmd as a.exe "a^{b}".

      I'm not sure what the fix is here other than perhaps detecting that this is windows and putting quotes around the argument in Windows.

      On another note, I left the Affects Version/s field blank. My Jenkins installation claims that it is using version 1.1.6. Looking at the git repo for the plugin, it appears that 1.1.6 should not have the ^{commit}

      fix, yet running strings on plugins/git/WEB-INF/classes/hudson/plugins/git/GitAPI.class clearly shows that my git plugin has that change in it.

            Unassigned Unassigned
            jberkenbilt Jay Berkenbilt
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: