Skip to content

Commit

Permalink
Merge pull request #439 from sternenseemann/fix-tests-in-nix-sandbox
Browse files Browse the repository at this point in the history
git-unix: make index and regression test work without global gitconfig
  • Loading branch information
dinosaure authored Jan 16, 2021
2 parents 6f13511 + b5aa641 commit 2d6fb51
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/index/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ let delete_should_be_empty =
let run path =
let open Rresult in
Bos.OS.Dir.with_current path @@ fun () ->
Bos.OS.Cmd.run Bos.Cmd.(v "git" % "config" % "user.name" % "test")
>>= fun () ->
Bos.OS.Cmd.run
Bos.Cmd.(v "git" % "config" % "user.email" % "[email protected]")
>>= fun () ->
Bos.OS.Cmd.run Bos.Cmd.(v "git" % "commit" % "-m" % ".") >>= fun () ->
load ~hash:SHA1 Fpath.(v ".git" / "index") >>= fun t ->
(* XXX(dinosaure): [git] deletes [should-be-empty] into the index file **AND**
Expand Down
15 changes: 15 additions & 0 deletions test/smart/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,11 @@ let commit_foo store =
let commit =
let open Rresult in
Bos.OS.Dir.with_current path @@ fun () ->
Bos.OS.Cmd.run Bos.Cmd.(v "git" % "config" % "user.name" % "test")
>>= fun () ->
Bos.OS.Cmd.run
Bos.Cmd.(v "git" % "config" % "user.email" % "[email protected]")
>>= fun () ->
Bos.OS.File.write (Fpath.v "foo") "" >>= fun () ->
Bos.OS.Cmd.run Bos.Cmd.(v "git" % "add" % "foo") >>= fun () ->
Bos.OS.Cmd.run Bos.Cmd.(v "git" % "commit" % "-m" % ".") >>= fun () ->
Expand Down Expand Up @@ -1490,6 +1495,11 @@ let test_partial_fetch_ssh () =
let fiber =
let open Rresult in
OS.Dir.with_current path @@ fun () ->
OS.Cmd.run Bos.Cmd.(v "git" % "config" % "user.name" % "test")
>>= fun () ->
OS.Cmd.run
Bos.Cmd.(v "git" % "config" % "user.email" % "[email protected]")
>>= fun () ->
OS.Cmd.run Cmd.(v "touch" % "foo") >>= fun () ->
OS.Cmd.run Cmd.(v "git" % "add" % "foo") >>= fun () ->
OS.Cmd.run Cmd.(v "git" % "commit" % "-m" % ".")
Expand All @@ -1503,6 +1513,11 @@ let test_partial_fetch_ssh () =
let fiber =
let open Rresult in
OS.Dir.with_current path @@ fun () ->
OS.Cmd.run Bos.Cmd.(v "git" % "config" % "user.name" % "test")
>>= fun () ->
OS.Cmd.run
Bos.Cmd.(v "git" % "config" % "user.email" % "[email protected]")
>>= fun () ->
OS.Cmd.run Cmd.(v "touch" % "bar") >>= fun () ->
OS.Cmd.run Cmd.(v "git" % "add" % "bar") >>= fun () ->
OS.Cmd.run Cmd.(v "git" % "commit" % "-m" % ".") >>= fun () ->
Expand Down

0 comments on commit 2d6fb51

Please sign in to comment.