Skip to content

--exec doesn't work #542

Closed
Closed
@ploeh

Description

@ploeh

While doing an interactive rebase, --exec can be quite handy. Unfortunately, in the git-for-windows fork, this feature seems to no longer work.

Steps to reproduce

In summary:

  1. Create a new repro
  2. Add some commits
  3. Add a script file
  4. Interactively rebase, using --exec to run the script file between each commit.

Here are the detailed steps I used to reproduce the issue from Git Bash:

mark@Canopus MINGW64 ~/Desktop
$ mkdir exec-repro

mark@Canopus MINGW64 ~/Desktop
$ cd exec-repro/

mark@Canopus MINGW64 ~/Desktop/exec-repro
$ git init
Initialized empty Git repository in C:/Users/mark/Desktop/exec-repro/.git/

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ vim .gitignore

In .gitignore, I simply added one line:

*.sh

The I continued:

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ git add .gitignore
warning: LF will be replaced by CRLF in .gitignore.
The file will have its original line endings in your working directory.

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ git commit
[master (root-commit) 96bf28b] Added .gitignore
warning: LF will be replaced by CRLF in .gitignore.
The file will have its original line endings in your working directory.
 1 file changed, 1 insertion(+)
 create mode 100644 .gitignore

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ vim thefile.txt

In thefile.txt, I added first foo on one line, then, in two separate commits bar and baz:

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ git add .
warning: LF will be replaced by CRLF in thefile.txt.
The file will have its original line endings in your working directory.

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ git commit
[master 8a59b46] Added the file.
warning: LF will be replaced by CRLF in thefile.txt.
The file will have its original line endings in your working directory.
 1 file changed, 1 insertion(+)
 create mode 100644 thefile.txt

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ vim thefile.txt

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ git add .
warning: LF will be replaced by CRLF in thefile.txt.
The file will have its original line endings in your working directory.

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ git commit
warning: LF will be replaced by CRLF in thefile.txt.
The file will have its original line endings in your working directory.
[master warning: LF will be replaced by CRLF in thefile.txt.
The file will have its original line endings in your working directory.
c45a948] Added a line to the file.
warning: LF will be replaced by CRLF in thefile.txt.
The file will have its original line endings in your working directory.
 1 file changed, 1 insertion(+)

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ vim thefile.txt

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ git add .
warning: LF will be replaced by CRLF in thefile.txt.
The file will have its original line endings in your working directory.

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ git commit
warning: LF will be replaced by CRLF in thefile.txt.
The file will have its original line endings in your working directory.
[master warning: LF will be replaced by CRLF in thefile.txt.
The file will have its original line endings in your working directory.
6112987] Added a line to the file.
warning: LF will be replaced by CRLF in thefile.txt.
The file will have its original line endings in your working directory.
 1 file changed, 1 insertion(+)

Here's the log so far:

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ git log
commit 6112987c936ca3bff5b707d3e4655c8f1b60123d
Author: Mark Seemann <mark@ploeh.dk>
Date:   Sun Nov 22 12:11:16 2015 +0100

    Added a line to the file.

commit c45a948d2ebc268f24414bb5277d50bd85134b4d
Author: Mark Seemann <mark@ploeh.dk>
Date:   Sun Nov 22 12:10:34 2015 +0100

    Added a line to the file.

commit 8a59b460760551886c573c4059d83a560fd62155
Author: Mark Seemann <mark@ploeh.dk>
Date:   Sun Nov 22 12:10:10 2015 +0100

    Added the file.

commit 96bf28bc45c5a7e5d4b9f1fda02a62b127b4f499
Author: Mark Seemann <mark@ploeh.dk>
Date:   Sun Nov 22 12:09:25 2015 +0100

    Added .gitignore

Then I added a script file:

mark@Canopus MINGW64 ~/Desktop/exec-repro (master)
$ vim thescript.sh

The content of thescript.sh is simple:

#!/bin/bash
printf "Running the script."

Finally, I started an interactive rebase:

$ git rebase -i 8a59b460760551886c573c4059d83a560fd62155 --exec "./thescript.sh"

After having added some changes to thefile.txt, I issued git rebase --continue.

Expected result

I would expect the rebase to continue, executing thescript.sh between applying each commit.

Actual result

$ git rebase --continue
Executing: thescript.sh
/mingw64/libexec/git-core/git-rebase--interactive: line 613: C:/Program: No such file or directory
Execution failed: thescript.sh
You can fix the problem, and then run

        git rebase --continue

It's possible to execute thescript.sh manually from the command line:

$ ./thescript.sh
Running the script.

After each git rebase --continue, though, the above error happens.

Environment information

This is my environment:

$ git --version
git version 2.6.3.windows.1

I'm on Windows 10 Pro x64.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions