Closed metanivek closed 2 years ago
The best I can tell, the code at the core of this issue is very old so I guess this is something to do with my system (?). I even tried downgrading to an older version of git but behavior did not change.
I was ultimately able to successfully use dune-release distrib
locally by changing the code to use .
instead of .git
.
Am I right in assuming that you are trying to release Irmin 3.4.0? Have you run dune-release tag
before?
Just so I know how to reproduce this issue.
Yep, that's right. dune-release tag
was run before dune-release distrib
. Here is our release checklist https://github.com/mirage/irmin/blob/main/RELEASE.md#releasing-to-opam-repository-and-github.
I'm pretty confused by this issue given the code is old and I have successfully used dune-release
with irmin on a different computer.
If it helps, here is my hacky patch to get a local version that allowed me to release.
diff --git a/lib/dune b/lib/dune
index 3c85f62..c3c1cde 100644
--- a/lib/dune
+++ b/lib/dune
@@ -1,5 +1,5 @@
(library
(name dune_release)
(public_name dune-release)
- (libraries fmt fpath bos curly opam-state rresult bos.setup yojson
+ (libraries str fmt fpath bos curly opam-state rresult bos.setup yojson
opam-file-format re))
diff --git a/lib/vcs.ml b/lib/vcs.ml
index dc0d5d8..2618997 100644
--- a/lib/vcs.ml
+++ b/lib/vcs.ml
@@ -147,10 +147,19 @@ let git_branch_exists ~dry_run r br =
match run_git_quiet ~dry_run r cmd with Ok () -> true | _ -> false
let git_clone ~dry_run ?force ?branch ~dir:d r =
+ let src =
+ (match
+ Fpath.to_string (dir r) |> Str.global_replace (Str.regexp {|\.git|}) ""
+ with
+ | "" -> "."
+ | s -> s)
+ |> Fpath.v
+ in
+
let branch =
match branch with None -> Cmd.empty | Some b -> Cmd.(v "-b" % b)
in
- let clone = Cmd.(v "clone" % "--local" %% branch % p (dir r) % p d) in
+ let clone = Cmd.(v "clone" % "--local" %% branch % p src % p d) in
run_git ~dry_run ?force r clone ~default:Default.unit OS.Cmd.out_stdout
>>= fun () -> Ok ()
This is very strange, given as you say this code hasn't been changed in forever and it would mean it doesn't work at all anywhere. So I went to clone irmin (btw, I think you forgot to push the commit that updates the changelog to 3.4.0 - I know because that happens to me all the time) and tried releasing (or well, building a tarball) and it… worked out of the box with dune-release.1.6.2
.
It is pretty disheartening to just say "works on my machine" so let's try to investigate further. I tried the same command as you: git --git-dir .git clone --local .git _build/irmin-3.4.0.build
and that has created a working clone. I use Fedora Linux so my git version should be reasonably up to date, and git --version
tells me git version 2.37.2
which is even the newest release.
So maybe there is some odd setting in your git
config? Maybe something strange in your .git
? Could you try creating a new switch and see if it works there?
Thanks for helping to investigate. I figured out what it is, and it's a pretty funny issue (to me).
I'm using Arch, git version 2.37.2
. The other computer (also running Arch) hasn't had its packages updated in a few weeks. After confirming it still worked to create the tarball with dune-release distrib
, I updated its packages, and indeed -- it still worked.
So it came down to something with git. Git configs on both computers are equivalent, so I looked into the .git
directory and noticed a very odd thing -- another .git
directory! I have no idea how I ended up in this situation, but deleting this directory fixes the issue for me.
I learned two things with this issue:
git clone
is resilient to a nested .git
directory if you clone the root of the project but not the .git
directory itself, which in hindsight makes sense.Thanks again for your help.
Hey all, I'm running into an issue with
dune-release.1.6.2
and hoping somebody sees something I don't. I initially randune-release distrib
and received an error from a git command, so I randune-release distrib --dry-run
in hopes of seeing more info and noticed a linegit --git-dir .git clone --local .git _build/irmin-3.4.0.build
which clones an empty repository as demonstrated by:Here is the original error, which makes sense if the repository is empty (and therefore doesn't have the tag):
If I change the git clone command to
git --git-dir .git clone --local . _build/irmin-3.4.0.build
(change--local .git
to--local .
) it clones correctly, but I cannot use this sincedune-release distrib
removes the directory first. I'm on git version 2.37.2.Any advice or help?