From 72c58a1ef47153239a74bef7c7aa792d49da17ab Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Sat, 4 Jan 2025 12:09:48 +0100 Subject: [PATCH] jj-codereview: make FETCH_HEAD visible to jj in fetch --- jj-codereview/fetch.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jj-codereview/fetch.go b/jj-codereview/fetch.go index 73476cdb..3a1fe5c7 100644 --- a/jj-codereview/fetch.go +++ b/jj-codereview/fetch.go @@ -35,8 +35,10 @@ Fetches a single CL by number, Change-Id, or other Gerrit query. } run("git", "fetch", c.Revisions[c.CurrentRevision].Fetch.HTTP.URL, c.Revisions[c.CurrentRevision].Fetch.HTTP.Ref) + ref := fmt.Sprintf("refs/remotes/gerrit/cl/%d/%d", c.Number, c.Revisions[c.CurrentRevision].Number) if !*noRun { - for _, c := range jjLog("-T", "commit_id ++ '\n'", "-r", "::"+c.CurrentRevision+" ~ ::remote_bookmarks(remote=origin)") { + run("git", "update-ref", ref, "FETCH_HEAD") + for _, c := range jjLog("-T", "commit_id ++ '\n'", "-r", "::"+c.CurrentRevision+" ~ ::remote_bookmarks(remote=origin) ~ "+c.CurrentRevision) { labelCommit(c, 5) } printf("%s", jjLog("-r", c.CurrentRevision)[0])