Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path=. confusion #72

Open
jcbhmr opened this issue May 8, 2023 · 4 comments
Open

path=. confusion #72

jcbhmr opened this issue May 8, 2023 · 4 comments

Comments

@jcbhmr
Copy link
Contributor

jcbhmr commented May 8, 2023

Just realized that this could have a potential conflict with the documented usage to use path: ., since a .git directory will likely already exist at ./.

Originally posted by @spenserblack in #70 (comment)

we could use:

  • GIT_DIR is the location of the .git folder. If this isn’t specified, Git walks up the directory tree until it gets to ~ or /, looking for a .git directory at every step.
  • GIT_WORK_TREE is the location of the root of the working directory for a non-bare repository. If --git-dir or GIT_DIR is specified but none of --work-tree, GIT_WORK_TREE or core.worktree is specified, the current working directory is regarded as the top level of your working tree.
    from https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables

and basically do

export GIT_DIR=../wiki.git
export GIT_WORK_TREE="$INPUT_PATH"
gh repo clone "$GITHUB_REPOSITORY" "$GIT_DIR" -- --bare
git config --unset core.bare
git reset

?? 🤔

@jcbhmr jcbhmr changed the title path=. .git confusion path=. confusion May 8, 2023
@jcbhmr
Copy link
Contributor Author

jcbhmr commented May 16, 2023

There's a working version of a github wiki action that uses this technique: https://github.com/Andrew-Chen-Wang/github-wiki-action/tree/jcbhmr

ref Andrew-Chen-Wang/github-wiki-action#30

@spenserblack
Copy link
Owner

I'm thinking the solution to this is really simple, actually. When path is . (or something that resolve to .), just push the main repository's history to the wiki. The whole point of pulling down the wiki's commits is to preserve its history. When the main repository is the wiki, that's not really necessary.

This can be even further simplified, but I'll put that in a separate issue.

@jcbhmr
Copy link
Contributor Author

jcbhmr commented Jun 7, 2023

Good point! Would this work with an ignore: input though? 🤔 #49

@spenserblack
Copy link
Owner

Since nobody has actually expressed a need for #49, I think it's not that high priority. As a potential bug, this takes priority IMO.

But I believe we can find an implementation of #49 that wouldn't conflict with this 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants