Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/doc/src/reference/specifying-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ Cargo will fetch the `git` repository at this location then look for a
of a workspace and setting `git` to the repository containing the workspace).

Since we haven’t specified any other information, Cargo assumes that
we intend to use the latest commit on the main branch to build our package.
we intend to use the latest commit on the Default ("base") branch branch
to build our package, which may not necessarily be the main branch.
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the catch!

I feel like there is still a confusion in this patch. People may wonder what a capital "Default" branch is, and what it is different from base. Is base the correct technical term for the "default branch"?

Technically speaking, Cargo use HEAD (refs/remotes/origin/HEAD)1 to find the default branch.

I would suggest the following change, since the default branch looks like a term in use in git's own doc2:

Suggested change
we intend to use the latest commit on the Default ("base") branch branch
to build our package, which may not necessarily be the main branch.
we intend to use the latest commit on the default branch to build our package

Footnotes

  1. https://github.com/rust-lang/cargo/blob/928b9561c16e73fca6206b42e4c464b80b0e9221/src/cargo/sources/git/utils.rs#L959-L961

  2. Git configuration init.defaultBranch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took the terms from GitHub's settings page. I don't actually know. I used the capital because they had it as capital, I don't feel strongly about it.IMO I think what you said is better than both. Say how it will be determined. Rather than trying to name it. As long as it is clear that it's not always main. Happy to make the edits if you prefer when I get home but you're free to edit as you see fit as well.

You can combine the `git` key with the `rev`, `tag`, or `branch` keys to
specify something else. Here's an example of specifying that you want to use
the latest commit on a branch named `next`:
Expand Down