Cleanup - #29
Conversation
* Removed duplicate / unnecessary code
This reverts commit b920130.
| 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_); |
There was a problem hiding this comment.
this is not equivalent to the previous version if the same branch exists on multiple remotes?
There was a problem hiding this comment.
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)
| e.exec(d->path_, "git fetch {}", remote); | ||
| } | ||
|
|
||
| // Select latest known commit. |
There was a problem hiding this comment.
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.
| try { | ||
| // Fetch if commit is not known. | ||
| if (!commit_exists(d, d->commit_) || | ||
| (d->commit_ != bc.commit_ && !commit_exists(d, bc.commit_))) { |
There was a problem hiding this comment.
bc is initialized from d - so it should always be equal (see here)
No description provided.