Commit Graph

10 Commits

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.
2020-12-01 01:47:35 -08:00
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>
2020-11-30 15:09:43 -08:00
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.
2019-06-07 12:14:11 -07:00
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
2018-06-09 01:23:32 +03:00
Derek Willian Stavis
8aa8acb027 lib/git: fix branch name in detached head (#366) 2016-07-22 13:27:38 -03:00
Derek Stavis
de0aaeabf7 git_ahead: Fix indicator override 2016-01-21 09:47:11 -02:00
Itzik Ephraim
e83b674fd3 bugfix: git_ahead no longer reports 'none' as 'ahead' 2016-01-19 19:00:21 +02:00
Itzik Ephraim
ec8c209f07 A different approach in git_ahead 2016-01-16 17:30:52 +02:00
Itzik Ephraim
6fa3332438 bugfix: add missing $s in git_ahead 2015-12-31 15:19:06 +02:00
Jorge Bucaran
2693a2fd18 %%% United States of the Fish → Wahoo + OMF %%% 2015-08-27 00:20:13 +09:00