Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

do not assume default ref to be master #617

Open
trieloff opened this issue Sep 29, 2020 · 4 comments
Open

do not assume default ref to be master #617

trieloff opened this issue Sep 29, 2020 · 4 comments
Assignees

Comments

@trieloff
Copy link
Contributor

set req.http.X-Ref = "master";

We may be able to just keep it empty since adobe/helix-resolve-git-ref#253 added a default branch fallback

@tripodsan
Copy link
Contributor

would be interesting to see what breaks if no ref is present :-) but I assume it is most of the times read from the strains, so should be present.

a problem will be, if a customer uses a different default branch than helix-pages....

trieloff added a commit that referenced this issue Sep 30, 2020
this should allow us to support main and master, assuming helix-resolve-git-ref is used consistently downstream

fixes #617
@trieloff
Copy link
Contributor Author

trieloff commented Oct 6, 2020

adobe/helix-pages#491 is the more effective change

@kptdobe
Copy link
Contributor

kptdobe commented Nov 6, 2020

I do not think the proposed change in adobe/helix-pages#491 is what we need / is enough, especially after my last changes adobe/helix-pages@70b582a.

There are 4 cases to cover at 2 different places:

  • branch/repo/owner is provided in url: X-Ref should use the branch
  • repo/owner is provided in url: X-Ref should be null so that default branch resolution can happen
  • www / helix-pages site is requested (branch/repo/owner is not provided) AND strain_refs is set (case of testing a helix-pages branch): X-Ref should be strain_refs
  • www / helix-pages site is requested (branch/repo/owner is not provided) AND strain_refs is null: X-Ref should be null so that default branch resolution can happen

Assuming that "X-Ref should be null so that default branch resolution can happen" is what we need to do in the end.

This requires to also rework this block:

if (!req.http.X-Ref) {
set req.http.X-Ref = table.lookup(strain_refs, "default");
}
# if default isn't set, use 'master'
if (!req.http.X-Ref) {
set req.http.X-Ref = "master";
}

@kptdobe
Copy link
Contributor

kptdobe commented Nov 6, 2020

which in the end should be simple: logically replace req.http.X-Ref = "master" by unset req.http.X-Ref on side (if might just be removed).

I can look at it next week.

@kptdobe kptdobe self-assigned this Nov 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants