My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 365: CommitMsgHookTest does not support windows
1 person starred this issue and may be notified of changes. Back to list
Status:  Released
Owner:  ----
Closed:  Oct 2012


Sign in to add a comment
 
Reported by bernd.kolb, Dec 21, 2009
Affected Version: MASTER
Environment: Windows

The testclass com.google.gerrit.sshd.scproot.hooks.CommitMsgHookTest does
not support windows as an execution env as it uses a shell script.
Dec 21, 2009
#1 sop@google.com
What should we do on Win32, not run the test?
Dec 22, 2009
#2 bernd.kolb
Yes, this would probably be the one option.
Another one would be to change 
org.eclipse.jgit.junit.LocalDiskRepositoryTestCase.runHook(Repository, File,
String...) to 

  protected int runHook(final Repository db, final File hook,
      final String... args) throws IOException, InterruptedException {
    final String[] argv = null;
    String os = System.getProperty("os.name");
    if (os.startsWith("Windows")) {
      argv = new String[2 + args.length];
      argv[0] = "sh.exe";
      argv[1] = hook.getAbsolutePath();
      System.arraycopy(args, 0, argv, 2, args.length);
    } else {
      argv = new String[1 + args.length];
      argv[0] = hook.getAbsolutePath();
      System.arraycopy(args, 0, argv, 1, args.length);
    }
    final Map<String, String> env = cloneEnv();
    env.put("GIT_DIR", db.getDirectory().getAbsolutePath());
    putPersonIdent(env, "AUTHOR", author);
    putPersonIdent(env, "COMMITTER", committer);

    final File cwd = db.getWorkDir();
    final Process p = Runtime.getRuntime().exec(argv, toEnvArray(env), cwd);
    p.getOutputStream().close();
    p.getErrorStream().close();
    p.getInputStream().close();
    return p.waitFor();
  }

This would allow people running on windows to install cygwin with perl and run the
script.

What do you think?
Dec 22, 2009
#3 sop@google.com
Fixed by change I456fb8bd94558f6765eadd45274489e9c48c5f55.

I actually am just skipping this test on Win32.  Changing upstream JGit to
start running hooks out of Cygwin is messier than it sounds.
Status: Fixed
Labels: FixedIn-2.1.1
Oct 21, 2012
#4 sop@google.com
(No comment was entered for this change.)
Status: Released
Sign in to add a comment

Powered by Google Project Hosting