Commit Graph

130 Commits

Author SHA1 Message Date
f317ed81c2 git: Add last-changed to mimic github file browser
List all files and directories but include the latest commits date and
subject, similar to the file browser in web-UIs of services like GitHub.
Also sort the entries by the commits date and time to see the most
recent changed files/folders at the bottom.
2023-01-17 01:38:17 +01:00
df39b04cb2 zsh:ls-show-hidden: Take quotes in double brackets 2022-12-27 16:53:25 +01:00
3ddfadf360 zsh:ls-show-hidden: Fix listing of broken symlinks
The `-e` and `-d` checks fail if the file is a broken symlink, which
would lead to a 'No such file...' message for each of them.
2022-12-27 16:47:17 +01:00
c4125ddc25 zsh:ls-show-hidden: Fix ./ listing on non-existing
Fix a bug that ls-show-hidden always listed `./` when all other non-flag
arguments were non-existing (in addition to their 'No such file...'
message).
2022-12-27 16:45:06 +01:00
9b0e49b319 zsh:ls-show-hidden: Use short param expansion form
Use the short parameter expansion form where it leads to a better
readability in my eyes (e.g. "${dir:A}" -> "$dir:A" does not, I think.)
2022-12-27 16:39:40 +01:00
b93c4ee377 zsh:glog: Only pipe to fzf if stdout is a tty
This makes it easy to use `glog` in a pipe as replacement for `git log
--oneline`, for example to count the commits.
2022-12-27 04:27:21 +01:00
73c0864c8b git: Add https-and-ssh to setup origin
Sets up origin so that it fetches over https but pushes over ssh. This
way unlocking the ssh key is only needed when really necessary.
2022-12-01 01:27:28 +01:00
b22085777e git:checkout-worktree: Remove tmp dir on error
When the git-worktree call exits with an error we can delete the
temporary directory as nothing is in it.
2022-10-27 23:52:17 +02:00
e15fc71054 zsh,git: Add git-make-fork 2022-10-17 17:28:31 +02:00
61e8ccc176 zsh:glog: Add bindings for faster navigation 2022-10-15 19:01:18 +02:00
af2c96cd5c zsh:glog: Cycle preview positions with ctrl-space 2022-10-15 18:57:11 +02:00
87e3232780 zsh:glog: Require 152 columns for preview on right
This seem to make more sense especially for smaller terminals where the
previous formula would have resulted in both sides being unreadable.
2022-10-15 18:56:26 +02:00
1d99d5dbf5 zsh:glog: Do not pass --graph by default
`--graph` can get very slow for large repos with many branches. Make
`glog` independent of it and rather add an alias that uses `glog
--graph`.
2022-10-05 17:13:52 +02:00
69edbd6f10 zsh:ls-show-hidden: Add -- support
All arguments following `--` should be taken as either files or
directories not flags, even if they start with a dash.
2022-09-27 01:28:10 +02:00
e5010d76b5 zsh:ls-show-hidden: Correct print format
When an argument is passed that does not exist, `ls` always prints the
directory name for the existing ones, even if there is only one
remaining directory that is listed.
2022-09-27 01:16:19 +02:00
82fc29f9c0 zsh:ls-show-hidden: Fix non_existing arg parsing
`ls` prints a warning if a non-flag argument is specified that does not
exist.

Previously ls-show-hidden assumed that all arguments that are neither a
directory nor an otherwise existing file are flags. As all flags are
passed to the ls call the warning still got printed, but this also lead
to the current working directory (i.e. `.`) being added to the
directories to process.

If `ls` expects an argument to a flag, it is always passed in the format
`--flag=arg` where the equal sign is mandatory. This makes it possible
to simply filter out all flags (and their arguments) from the other
arguments without needing to know which flags take an argument and which
don't.

Fix this behaviour by printing the same warning as `ls` does when an
argument is neither a flag, nor a directory nor an existing file. Also
only add `.` to the directories if *really* only flags were passed.
2022-09-27 01:05:42 +02:00
0ad0ccb0c8 git: Make commit-last-msg available as alias
Move `git-commit-last-msg` into an autoloadable function. This way it
can also be executed as external script and thus in a git alias. This
makes it additionally possible to call it in vim over fugitive's `:Git`.
2022-08-30 19:52:24 +02:00
43d87467d2 git:checkout-worktree: Pass all arguments
Pass all given arguments to `git worktree add`. This makes it possible
to directly create a new branch with `-b` for example. As the arguments
are not used anywhere else, this should not introduce any parsing
issues.
2022-07-12 21:00:12 +02:00
65fc5efdec git:submodule-rm: Update to current .git structure
Update the function to use the current `.git/modules/` structure, by
only using the basename of the path.

I am not sure when this was changed and too lazy right now to find it
out.
2022-07-12 21:00:10 +02:00
09ef4d4d93 git: Replace git-signoff with rebase --signoff
Replace my custom git-signoff script with the native `--signoff` flag
for `git rebase`.
2022-07-12 21:00:00 +02:00
1fbdc60b6b glog: Disable --quit-if-one-screen in $LESS
Make glog always open the output of `git show` in a **real** pager by
disabling `--quit-if-one-screen`.
2022-07-12 21:00:00 +02:00
3512199fce git:spull: Rename to ssync
As I rarely use git-pull(1) and instead fetch and act manually, I'd
rather have it to just sync the submodules.
2022-07-12 20:59:59 +02:00
c22fcf5fce git,zsh:autoload: Move spull into own function
Move `git-track` into its own autoloadable function.

This way it is better maintainable as in one-liner format and brings the
possibility of having more complexity (e.g. for better portability).

By that it is also now executable as `git-spull` as well as `git spull`
as before.
2022-07-12 20:59:59 +02:00
932c2eee35 git:checkout-worktree: Format description comment 2022-06-23 23:59:01 +02:00
b96d32996b *: Wrap lines at 80 columns where appropriate
Wrap lines at 80 columns where appropriate and I had the energy to think
about how/where to wrap.

There are still lines longer than that, which I plan to wrap in the
future. But that is enough for now.
2022-06-23 23:59:00 +02:00
e13ab8e855 zk: Add a horizontal ruler before the modeline
When using the zettel as a commit message this is also convenient as git
will ignore everything behind it. (Which also means that all horizontal
rulers in a zettel should use atleast 4 dashes)
2022-06-23 23:56:53 +02:00
79c7cdf416 git:checkout-worktree: Escape slashes in branch
Escape slashes in the branch name before passing it to `mktemp`.
Otherwise it would complain with:

    mktemp: invalid suffix [...], contains directory separator
2022-06-23 23:54:13 +02:00
be1bd6f08d git:checkout-worktree: Add scripted-use examples 2022-03-31 17:56:07 +02:00
ab53cff2a3 git:checkout-worktree: Update description
Add description in one sentence and use cases for this.
Remove sentence about removing `TEMP_DIR` that is outdated since:
5a8b5ffd21 ("git:checkout-worktree: Use `mktemp` template")
2022-03-31 17:48:05 +02:00
71450ad133 git:checkout-worktree: Fix endless loop
Fix endless loop when commands are passed via stdin that result in the
worktree not being removable. Fix by then dropping into an interactive
shell.
2022-03-31 17:28:05 +02:00
399b571e85 git:checkout-worktree: Refactor into one loop 2022-03-31 17:11:59 +02:00
a60c955d3d git:checkout-worktree: Set err_return + no_unset
If anything happens abnormally, return early and leave it to the user to
fix things.
2022-03-31 16:57:46 +02:00
d56979362a git:checkout-worktree: s/REPO_DIR/WORKTREE_PATH/ 2022-03-31 16:15:46 +02:00
5a8b5ffd21 git:checkout-worktree: Use mktemp template
Use a template that directly includes the repository name and the branch
checked out. This makes finding and deleting the worktree directory if
anything goes wrong a lot easier.

Checkout the worktree directly in the temporary directory. With that
`TEMP_DIR` becomes obsolete.
2022-03-31 16:00:47 +02:00
976d3f9000 git:checkout-worktree: Mention non-interactive use 2022-03-31 15:43:49 +02:00
02a0e17bcb git:checkout-worktree: Fix exit when not in repo
Fix the exit condition when the function is called outside of a git
repository.
Use zsh's `:t` History Expansion Modifier, as `$?` does not keep `git
rev-parse`'s exit code, but rather `basename`'s.
2022-03-31 15:33:53 +02:00
eb323992dc git:checkout-worktree: Keep the shell's exit code
Exit with the exit code of the last spawned shell.
2022-03-31 15:29:53 +02:00
b44ff72210 git:checkout-worktree: Rephrase description 2022-03-31 15:27:29 +02:00
9968edaf09 zsh: Make git-checkout-worktree autoloadable
Transform `git-checkout-worktree` into an autoloadable function.
2022-03-31 15:19:56 +02:00
0ba0c04c56 zsh: Use $+commands[] instead of command -v 2022-03-31 00:46:46 +02:00
e024ca9f0a zsh:auto,comp: Add git-signoff function
Add `git-signoff` to signoff commits in given range.
Reuse the `_git-rebase` completion function for `git-signoff`.
2022-03-30 03:00:48 +02:00
d4350dbd7c zsh:auto:git-submodule-rm: Keep git exit code
Split `toplevel` definition and assignment as the `local` builtin has
it's own exit code. Thus the function previously did not return if the
`PWD` was not in a git repo.
2022-03-30 03:00:46 +02:00
5df9e4d6ee zsh,vim: Add WIP Zettelkasten tooling
Add `zk`, an autoloadable function that creates a new zettel after a
template in the right directory.
Add `zettel` vim ftplugin.
2022-03-28 23:48:51 +02:00
5794af1c52 zsh:autoload:git-track: Make more portable
Some distributions ship older versions of `column` that do not have the
flags `-dNLO`. This is a workaround around this limitation that creates
the same output using other tools.
2022-02-17 15:40:51 +01:00
7f52c7a4cb git,zsh:autoload: Move git-track into own function
Move `git-track` into its own autoloadable function.
This way it is
better maintainable as in one-liner format and brings the possibility of
having more complexity (e.g. for better portability).
By that it is also now executable as `git-track` as well as `git track`
as before.
2022-01-31 12:50:54 +01:00
0e1712b4c0 zsh:autoload: Move git functions into git/ 2022-01-28 16:35:56 +01:00
851674efeb zsh:autoload:glog: Fix syntax w/ bash login shell
When bash is set as standard shell, fzf passes the commands to it and
bash throws a syntax error because of the missing semicolon.
2022-01-14 15:02:50 +01:00
ca5edbe538 zsh:glog: Remove --all flag
This annoys me in more cases than I thought. For example when checking
out a commit in the past in detached head mode and I want to see the
past commits before the current one.
Especially because there is no flag that can disable it again.

The flag has to be passed manually to `glog` now.
2021-07-23 12:06:58 +02:00
93ff4e7da2 zsh:glog: Add --all flag
Pretend as if all the refs in refs/, along with HEAD, are listed on the
command line.
2021-07-15 15:58:43 +02:00
b1d396babd *: Use /usr/bin/env in shebangs for bash & zsh
To increase the portability (OSX for example has zsh under `/bin/zsh`).
2021-07-14 13:48:21 +02:00