Add --sync-git-dir flag to odo dev#6910
Add --sync-git-dir flag to odo dev#6910openshift-merge-robot merged 5 commits intoredhat-developer:mainfrom
Conversation
🔨 Deploy Preview deleted from internal cluster!
|
rm3l
left a comment
There was a problem hiding this comment.
One question that came to mind after quickly testing this: we might need to handle the case where a file matches a rule in .gitignore (or .odoignore) but is also present in the .git folder. For example:
$ odo init --name go-app --devfile go --starter go-starter
$ echo ".odo" >> .gitignore
$ git init && git add -A . && git commit -m "initial commit"
At this point, I have a local branch named 'main' with a single commit, but the .gitignore file also contains an entry matching 'main' as a file name:
$ cat .gitignore
.odo/env
.odo/odo-file-index.json
main
main.exe
.odo
$ find . -name main
./.git/refs/heads/main
./.git/logs/refs/heads/main
$ git log --oneline
4ca3c66 (HEAD -> main) initial commit
Now if I run odo dev --sync-git-dir, the .git folder is synchronized, but not its whole content, because of the rule in .gitignore, I guess:
$ odo dev --sync-git-dir --platform podman
...
$ podman container exec -it go-app-app-runtime git -C /projects log --oneline
fatal: your current branch 'main' does not have any commits yet
$ podman container exec -it go-app-app-runtime find /projects -name main
/projects/main
$ podman container exec -it go-app-app-runtime ls -lhrta /projects/.git/refs
total 0
drwxr-xr-x 1 default root 0 Jun 19 13:49 tags
drwxr-xr-x 1 default root 8 Jun 19 13:52 .
drwxr-xr-x 1 default root 144 Jun 19 13:53 ..
So I think we need to forcibly sync the whole content of the .git folder; otherwise, we might have inconsistent behavior with tools relying on Git.
ac999a6 to
c458d59
Compare
c458d59 to
a8c8c35
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
|
/override OpenShift-Integration-tests/OpenShift-Integration-tests |
|
@feloy: Overrode contexts on behalf of feloy: OpenShift-Integration-tests/OpenShift-Integration-tests DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/override windows-integration-test/Windows-test |
|
@feloy: Overrode contexts on behalf of feloy: windows-integration-test/Windows-test DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |








What type of PR is this:
/kind feature
What does this PR do / why we need it:
Which issue(s) this PR fixes:
Fixes #6893
PR acceptance criteria:
Unit test
Integration test
Documentation
How to test changes / Special notes to the reviewer: