Skip to content

Backport #6626 - Fix for git fetcher#6640

Merged
Vasu1105 merged 1 commit intoinspec-5from
vj/backport-6626
Sep 1, 2023
Merged

Backport #6626 - Fix for git fetcher#6640
Vasu1105 merged 1 commit intoinspec-5from
vj/backport-6626

Conversation

@Vasu1105
Copy link
Copy Markdown
Contributor

Description

Backport #6626 to InSpec 5

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New content (non-breaking change)
  • Breaking change (a content change which would break existing functionality or processes)

Checklist:

  • I have read the CONTRIBUTING document.

…ory does not have .git directory (#6626)

* Functional Test to verify git fetcher able to work in a directory where git is not initialized or does not contain the .git directory

Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>

* Fix: If git branch, tag or reference information is not given it should clone the repo and checkout the default HEAD

Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>

* Remove the logic to find default branch in case of branch, tag or ref is not provided as it's not required logically as we will be cloning the and checkout the default HEAD

Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>

* This is a temporary change to make verify test working on this PR. Revert once the work is done for the git fetcher fix

Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>

* Unit Test: Fix unit test

Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>

* Verifies the git url before creating cache_key, if given relative path does not exist make sure it deletes the cache directory created to copy the cloned repo. It raises error if any git command fails

Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>

* Reverted verify git repo url call from cache_key as cache_key and shifted that to resolve_ref which is already raising the error in case of git ls remote command fails

Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>

* Unit test to cover the changes done for resolve_ref when branch, tag or ref is not given and
unit test for invalid git repo

Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>

---------

Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>
@Vasu1105 Vasu1105 requested a review from a team as a code owner August 31, 2023 14:44
@Vasu1105 Vasu1105 requested review from ahasunos and clintoncwolfe and removed request for a team August 31, 2023 14:44
@Vasu1105
Copy link
Copy Markdown
Contributor Author

Vasu1105 commented Sep 1, 2023

Merging this as this is backport of #6626

@Vasu1105 Vasu1105 merged commit 19fa97a into inspec-5 Sep 1, 2023
@Vasu1105 Vasu1105 deleted the vj/backport-6626 branch September 1, 2023 06:25
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 this pull request may close these issues.

1 participant