Skip to content

Cleanup - #29

Open
aff3npirat wants to merge 5 commits into
motis-project:masterfrom
aff3npirat:cleanup
Open

Cleanup#29
aff3npirat wants to merge 5 commits into
motis-project:masterfrom
aff3npirat:cleanup

Conversation

@aff3npirat

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread src/git.cc
d->branch_);
fmt::print("{} ({}): fetch\n", d->name(), remote);
e.exec(d->path_, "git fetch {} {}:{}", remote, d->branch_, d->branch_);
e.exec(d->path_, "git checkout {}", d->branch_);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is not equivalent to the previous version if the same branch exists on multiple remotes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The only case I can see that this differs is when there is a local branch with the same name. Currently we would change the tracking information of the existing local branch, with my changes it would throw (but with the changes in #28 this case is prevented so both implementations are equal)

Comment thread src/load_deps.cc
e.exec(d->path_, "git fetch {}", remote);
}

// Select latest known commit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this not needed?

@aff3npirat aff3npirat Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because between execution of line 58 and call to git_attach we dont need to fetch from upstream. And having only one place where fetch is implemented seemed cleaner to me.

Comment thread src/load_deps.cc
try {
// Fetch if commit is not known.
if (!commit_exists(d, d->commit_) ||
(d->commit_ != bc.commit_ && !commit_exists(d, bc.commit_))) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this equivalent?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

bc is initialized from d - so it should always be equal (see here)

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.

2 participants