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

[PRETEST 2]:Changed checkoutfrombare() by adding hash values and error handling #403

Closed
wants to merge 2 commits into from

Conversation

Manoramsharma
Copy link
Contributor

1. Does this PR affect any open issues? (Y/N) and add issue references (e.g. "fix #123", "re #123"):

2. What is the scope of this PR (e.g. component or file name):

  • pkg/git/git.go

3. Provide a description of the PR (e.g. more details, effects, motivations or doc link):

This PR enhances the kpm git module to support checking out source code from bare git repositories. The following changes were made:

  • Enhanced CheckoutFromBare Function:

    • Added validation to ensure the repository is bare.
    • Improved reference handling for branches, tags, and commits.
    • Included the force option in CheckoutOptions to ensure forced checkouts.
    • Provided clear error handling throughout the function.

    These changes ensure that users can reliably checkout the correct state from a bare repository, supporting various references like branches, tags, and commits.

4. Are there any breaking changes? (Y/N) and describe the breaking changes (e.g. more details, motivations, or doc link):

  • N

  • Y

    The changes to CheckoutFromBare may affect existing workflows that assume non-bare repositories. Users must ensure they set the Bare flag appropriately when working with bare repositories.

5. Are there test cases for these changes? (Y/N) select and add more details, references, or doc links:

  • Unit test
    • Added unit tests to validate the CheckoutFromBare functionality with various references (branch, tag, commit).
  • Integration test
  • Benchmark
  • Manual test
  • Other

@Peefy
Copy link
Contributor

Peefy commented Aug 1, 2024

PR conflict cc @Manoramsharma

@Peefy
Copy link
Contributor

Peefy commented Aug 1, 2024

@zong-zhe Could you help review it?

@Manoramsharma
Copy link
Contributor Author

@zong-zhe Could you help review it?

Hi @zong-zhe these conflicts are because of the changes merged in this PR. But as per our discussion over checking out from the bare repo will not be something that should be achieve like this.

Where as I am working on enabling this functionality as per the steps below:

  1. Once the clone functions works well which I have already done in the PRETEST 1.
  2. We need to enable user cloning the bare repo as the directory structure we have talked about here:
kpm/git
├── checkouts.   # checkout the specific version of git repository from cache bare repository 
│   ├── kcl-2a81898195a215f1
│   │   └── 33bb450. . # All the version of kcl package from git repository will be replaced with commit id
│   ├── kcl-578669463c900b87
│   │   └── 33bb450
└── db    # A bare git repository for cache git repo
    ├── kcl-2a81898195a215f1.      # <NAME>-<HASH> <NAME> is the name of git repo, 
    ├── kcl-578669463c900b87.   # <HASH> is calculated by the git full url.
  1. Then modifying the commands that support pulling the checkouts from the cache directory already downloaded in the directory above.

Need some help points in this !! Thanks

@zong-zhe
Copy link
Contributor

zong-zhe commented Aug 9, 2024

Hi @Manoramsharma 😃

The PR is a lot different from my idea. I suggest that we suspend this PR for a while and concentrate on completing the content in PR #419 first, because there is a dependency between them. After the completion, we will push forward the next step.

@Manoramsharma
Copy link
Contributor Author

#419

That's right, I think it's better to work on enhance the clone functionality rather working on checkout first. Let me close this PR for now.

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.

Enhancement: kpm add command displaying optimization
3 participants