Skip to content

Default Branch / Recent Branches / Other Branches - #247

Merged
haacked merged 19 commits into
masterfrom
fav-branches
Aug 12, 2016
Merged

haacked merged 19 commits into
masterfrom
fav-branches

Conversation

@joshaber

Copy link
Copy Markdown
Contributor

Fixes #65

screen shot 2016-08-11 at 5 11 24 pm

Comment thread app/src/lib/local-git-operations.ts Outdated
// "git reflog show" is just an alias for "git log -g --abbrev-commit --pretty=oneline"
// but by using log we can give it a max number which should prevent us from balling out
// of control when there's ginormous reflogs around (as in e.g. github/github).
const regex = new RegExp(/.* checkout: moving from .* to (.*)$/i)

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@joshaber

Copy link
Copy Markdown
Contributor Author

Bah, this got collapsed:

@joshaber: Ah that works, but I'm still not sure I understand. Can you describe what that's doing?

@haacked

haacked commented Aug 11, 2016

Copy link
Copy Markdown
Contributor

Can you describe what that's doing?

Sure! So ? means optional except when it comes after *, in which case it makes the * lazy instead of greedy.

For example, let's take this regex: .* abc and try to match the string foo abc foo abc. Let's assume we're only interested in the first match.

.* is greedy, so it tries to match everything it can, including spaces.

Thus .* abc matches the entire string foo abc foo abc.

But if we change it to .*? abc, the .*? is lazy and will stop at the first instance of the next matching character (aka the space).

Thus .*? abc matches foo abc.

This is important because it reduces the amount of backtracking the regex engine does. For example, imagine we're matching the following.

.* foo .* bar against the string this is a foo and another foo and the bar is a bar

                      matches
.* foo .* bar          entire string.
^

The initial .* matches the entire string. But then the regex moves to the space and realizes it's already at the end of the string it's matching against and it has to backtrack to the first space.

                      matches
.* foo .* bar          'this is a foo and another foo and the bar is a '
  ^

Then it moves to the f and has to backtrack again.

                      matches
.* foo .* bar          'this is a foo and another f'
   ^

And so on, and so on. With a lazy match, it's way more efficient for scenarios like this.

@haacked

haacked commented Aug 11, 2016

Copy link
Copy Markdown
Contributor

BTW, if you ever want to level up your regular expression skills, I highly recommend Mastering Regular Expressions by Friedl. I actually found it to be an enjoyable read and he explains them so well that to this day I still feel very comfortable with them.

@haacked

haacked commented Aug 11, 2016

Copy link
Copy Markdown
Contributor

Dumb question, but how do I show the branches pop-up. I don't see the menu option anywhere.

@joshaber

Copy link
Copy Markdown
Contributor Author

except when it comes after *, in which case it makes the * lazy instead of greedy.

Ahhhh ok that's the bit I was missing 👍

Dumb question, but how do I show the branches pop-up. I don't see the menu option anywhere.

So I think on Windows right now you can right-click most anywhere and it shows the menu. Alternatively, hitting Control-B should work too.

@haacked

haacked commented Aug 12, 2016

Copy link
Copy Markdown
Contributor

Should we be showing the remote tracking branches here?

@haacked

haacked commented Aug 12, 2016

Copy link
Copy Markdown
Contributor

I guess they're useful, but maybe should be grouped in a "remote branches" section or "branches on the server"

@joshaber

joshaber commented Aug 12, 2016 •

Copy link
Copy Markdown
Contributor Author

Hmm yeah. In Desktop TPG we don't put them in their own section but it's worth talking about.

I'll make a new issue for it 👍

@haacked

haacked commented Aug 12, 2016

Copy link
Copy Markdown
Contributor

Hmm yeah. In Desktop TPG we don't put them in their own section but it's worth talking about.

I'll make a new issue for it

Ok, there's other concerns I have. But for now, this code is fine. After all, it's pretty clearly a WIP UI and we can iterate on that in future PRs.

If it's not a WIP UI, what happened to @donokuda? His skills are atrophying. :trollface:

@haacked
haacked merged commit 03dd656 into master Aug 12, 2016
@haacked
haacked deleted the fav-branches branch August 12, 2016 17:47
@joshaber

Copy link
Copy Markdown
Contributor Author

Ok, there's other concerns I have.

If they're non-UI related, mind making issues for them?

@donokuda

Copy link
Copy Markdown
Contributor

If it's not a WIP UI, what happened to @donokuda? His skills are atrophying.

💀

An issue around branches would be ✨. Other things we might want to think about are branch management. Are there things we would want to consider such as deleting or renaming branches, when are those capabilities considered useful to have, and how often does that need occur?

Not sure if that's aligned with @haacked's concerns so I'll wait until he opens up the issue before I jump in with a few quick 💭s

@haacked

haacked commented Aug 12, 2016

Copy link
Copy Markdown
Contributor

Ok, there's other concerns I have.

I'm not sure Hot pink with fire is a good look for our pop ups. 😛

@joshaber

Copy link
Copy Markdown
Contributor Author

Daniel-McCarthy pushed a commit to Daniel-McCarthy/desktop that referenced this pull request Jul 30, 2020
mijiang168 pushed a commit to mijiang168/desktop that referenced this pull request Apr 22, 2022
mijiang168 pushed a commit to mijiang168/desktop that referenced this pull request Apr 22, 2022
yasuking0304 pushed a commit to yasuking0304/desktop that referenced this pull request Jan 22, 2023
yasuking0304 pushed a commit to yasuking0304/desktop that referenced this pull request Jan 22, 2023
yasuking0304 pushed a commit to yasuking0304/desktop that referenced this pull request Mar 9, 2023
yasuking0304 pushed a commit to yasuking0304/desktop that referenced this pull request Mar 9, 2023
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.

3 participants