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

Show current work dir at startup if it is in a git rep #23

Merged
merged 2 commits into from Mar 23, 2012

Conversation

Projects
None yet
2 participants
@davidanthoff
Contributor

davidanthoff commented Mar 22, 2012

This makes SeeGit behave a bit like gitk, i.e. if it is on your path you can just type it at commandline and get a visual of the current rep.

I renamed the function that normalizes the path and made it a normal function. The function now checks for existence of stuff on the disc, in which case it seems weird to have it as an extension method for string.

davidanthoff added some commits Mar 22, 2012

Make function that looks for git rep recursive
With this patch one can specify any folder in a git working directory and
the code will find the .git directory relevant for that working directory,
even if one picked a sub directory.
{
if (path == null) throw new ArgumentNullException("path");
// This is not good, it relies on the rest of the code being ok

This comment has been minimized.

@Haacked

Haacked Mar 23, 2012

Owner

Good point! We should never get an invalid path. Probably should throw an exception. Later on, we need to add in some global exception handling. But for now, I'm fine with crashing the app if you pass us an invalid path. :)

@Haacked

Haacked Mar 23, 2012

Owner

Good point! We should never get an invalid path. Probably should throw an exception. Later on, we need to add in some global exception handling. But for now, I'm fine with crashing the app if you pass us an invalid path. :)

// This is not good, it relies on the rest of the code being ok
// with getting a non-git repo dir
return path;

This comment has been minimized.

@Haacked

Haacked Mar 23, 2012

Owner

Actually, it's ok if we're returning the original path here. Notice in MainWindowViewModel.cs line 53 if the directory you give us is not a .git directory and doesn't have a .git directory, we monitor the directory waiting for you to create one in there.

In my demos, I start monitoring an empty directory. Then I create a git repo in there and add commits and SeeGit automatically comes alive showing the commit graph. :)

@Haacked

Haacked Mar 23, 2012

Owner

Actually, it's ok if we're returning the original path here. Notice in MainWindowViewModel.cs line 53 if the directory you give us is not a .git directory and doesn't have a .git directory, we monitor the directory waiting for you to create one in there.

In my demos, I start monitoring an empty directory. Then I create a git repo in there and add commits and SeeGit automatically comes alive showing the commit graph. :)

This comment has been minimized.

@davidanthoff

davidanthoff Mar 23, 2012

Contributor

Ah, I didn't think about the case where you want to actually point to an empty directory, but it makes sense and I think the code should work for that as well.

@davidanthoff

davidanthoff Mar 23, 2012

Contributor

Ah, I didn't think about the case where you want to actually point to an empty directory, but it makes sense and I think the code should work for that as well.

@Haacked

This comment has been minimized.

Show comment
Hide comment
@Haacked

Haacked Mar 23, 2012

Owner

I assume you've tested this carefully. :)

Owner

Haacked commented Mar 23, 2012

I assume you've tested this carefully. :)

Haacked added a commit that referenced this pull request Mar 23, 2012

Merge pull request #23 from davidanthoff/findgitpath
Show current work dir at startup if it is in a git rep

@Haacked Haacked merged commit fa19466 into Haacked:master Mar 23, 2012

@davidanthoff

This comment has been minimized.

Show comment
Hide comment
@davidanthoff

davidanthoff Mar 23, 2012

Contributor

The algorithm is essentially the one posh-git uses when it looks for the .git directory for the prompt. So, if it doesn't work, blame them ;)

Contributor

davidanthoff commented Mar 23, 2012

The algorithm is essentially the one posh-git uses when it looks for the .git directory for the prompt. So, if it doesn't work, blame them ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment