Skip to content

Commit c63ebdf

Browse files
committed
Disable replace references and grafts while running
The algorithm we use relies on traversing all of history, and in the correct order. Replace references and grafts screw up that order. So disable both of them while running.
1 parent b607644 commit c63ebdf

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

git/git.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,21 @@ func NewRepository(path string) (*Repository, error) {
9797
return repo, nil
9898
}
9999

100-
func (repo *Repository) gitCommand(args ...string) *exec.Cmd {
100+
func (repo *Repository) gitCommand(callerArgs ...string) *exec.Cmd {
101+
// Disable replace references when running our commands:
102+
args := []string{"--no-replace-objects"}
103+
104+
args = append(args, callerArgs...)
105+
101106
cmd := exec.Command("git", args...)
102-
cmd.Env = append(os.Environ(), "GIT_DIR="+repo.path)
107+
108+
cmd.Env = append(
109+
os.Environ(),
110+
"GIT_DIR="+repo.path,
111+
// Disable grafts when running our commands:
112+
"GIT_GRAFT_FILE="+os.DevNull,
113+
)
114+
103115
return cmd
104116
}
105117

0 commit comments

Comments
 (0)