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

git_backend: Support shallow git repositories #4448

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Veykril
Copy link
Collaborator

@Veykril Veykril commented Sep 12, 2024

Fixes #675

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@Veykril
Copy link
Collaborator Author

Veykril commented Sep 12, 2024

Only did some light manual testing. Unsure how to write a proper test for this, so if anyone has any ideas I am all ears :)

Do we want to specially render shallow commits? Right now they will just have the virtual root as their parent

@Veykril Veykril force-pushed the veykril/push-ulvyowmotxtr branch 5 times, most recently from 2f535ba to 4d117b0 Compare September 12, 2024 19:54
@Veykril Veykril changed the title shallow: Support shallow git repositories feat: Support shallow git repositories Sep 12, 2024
Copy link
Collaborator

@PhilipMetzger PhilipMetzger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits and some points for further discussion. I also think the initial PR description was good, but we don't really have guidelines here.

cli/src/commands/git/clone.rs Outdated Show resolved Hide resolved
lib/src/git.rs Show resolved Hide resolved
lib/src/git.rs Outdated Show resolved Hide resolved
lib/src/git.rs Outdated Show resolved Hide resolved
lib/src/git_backend.rs Show resolved Hide resolved
docs/git-compatibility.md Outdated Show resolved Hide resolved
docs/git-compatibility.md Show resolved Hide resolved
@Veykril Veykril changed the title feat: Support shallow git repositories git_backend: Support shallow git repositories Sep 13, 2024
@Veykril Veykril force-pushed the veykril/push-ulvyowmotxtr branch 8 times, most recently from e4d43f1 to 6ed25c6 Compare September 15, 2024 08:16
@Veykril Veykril marked this pull request as ready for review September 15, 2024 08:19
@Veykril
Copy link
Collaborator Author

Veykril commented Sep 15, 2024

Okay this is ready for proper review now. I'm leaving deepening/unshallowing for a separate issue (will open an issue for that after this is merged)

Copy link
Collaborator

@yuja yuja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

lib/src/git_backend.rs Outdated Show resolved Hide resolved
lib/tests/test_git.rs Outdated Show resolved Hide resolved
lib/tests/test_git.rs Outdated Show resolved Hide resolved
lib/src/git.rs Outdated Show resolved Hide resolved
lib/src/git.rs Outdated Show resolved Hide resolved
cli/src/commands/git/clone.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add CLI tests of jj git clone --depth?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like local clones do not support shallow clones in git2, yielding

shallow fetch is not supported by the local transport

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it wouldn't be easy to write tests, then. (we could test that non-zero --depth is passed to libgit2, though.)

Thanks for checking.

Copy link
Collaborator

@PhilipMetzger PhilipMetzger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG after addressing Yuya's nits.

@Veykril Veykril force-pushed the veykril/push-ulvyowmotxtr branch 3 times, most recently from b4366ac to ea0cd84 Compare September 19, 2024 13:03
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: squash into previous.

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.

jj crashes on shallow git repositories (cloned with --depth 20)
4 participants