Commit Graph

10 Commits (55da5f7b6f6303186daf659ce7016438136fb5d8)

Author SHA1 Message Date
Johannes Altmanninger 0a32584476 Fix error when inside a bare git repository
For example, "git diff" would print
"fatal: this operation must be run in a work tree"

We could still run git_branch_name in bare repositories in future.
4 years ago
Johannes Altmanninger b1b10c333d
Check whether we are inside the worktree (#651)
Some git commands require to be run from inside the worktree (as opposed
    to the git dir, although it's usually in .git). This commit adds
a function git_is_worktree to check this. It is used for the commands
that need the worktree instead of git_is_repo.

An alternative solution might have been to find the git worktree in the
parent of the git directory, but this doesn't work for all cases.
Generally it's impossible to detect the location of the worktree (plus
    it's not unique).

Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
4 years ago
Fabian Homborg 131c8d74e5 lib/git/git_is_touched: Speed up (#706)
* lib/git/git_is_touched: Speed up

This used to use `git status --porcelain`, which by necessity needs to
check the entire repo for all kinds of changes, just to figure out if
there are any.

Instead, we now use git commands that can exit early.

In large repos, this can be faster by a factor of 15 or so.

Fixes #624.

* Fix return status

`git diff` also returns 1 if there *is* a diff.
5 years ago
Itzik Ephraim a6a67be60b Use posix stderr redirection (2> instead of ^)
Fish is deprecating `^` as a shortcut for stderr redirection.
Replace with the more common and compatible `2>`.

Fixes #609
6 years ago
Derek Willian Stavis 8aa8acb027 lib/git: fix branch name in detached head (#366) 8 years ago
Derek Stavis de0aaeabf7 git_ahead: Fix indicator override 9 years ago
Itzik Ephraim e83b674fd3 bugfix: git_ahead no longer reports 'none' as 'ahead' 9 years ago
Itzik Ephraim ec8c209f07 A different approach in git_ahead 9 years ago
Itzik Ephraim 6fa3332438 bugfix: add missing $s in git_ahead 9 years ago
Jorge Bucaran 2693a2fd18 %%% United States of the Fish → Wahoo + OMF %%% 9 years ago