Skip to content

Commit

Permalink
Merge branch 'tj:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
havocesp authored Dec 10, 2023
2 parents c52e709 + 28b48c7 commit b99d826
Show file tree
Hide file tree
Showing 23 changed files with 459 additions and 181 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ trim_trailing_whitespace = false

[*.html]
trim_trailing_whitespace = false

[*.py]
indent_size = 4
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!--
Note
* Mark the PR as draft until it's ready to be reviewed.
* Please update the documentation to reflect the changes made in the PR.
* If the command is covered by tests under ./tests, please add/update tests for any changes unless you have a good reason.
* Make a new commit to resolve conversations instead of `push -f`.
* To resolve merge conflicts, merge from the `main` branch instead of rebasing over `main`.
* Please wait for the reviewer to mark a conversation as resolved.
-->
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest==7.4.0
pip install GitPython==3.1.36
pip install GitPython==3.1.40
- name: Unit test
run: make test

Expand All @@ -67,7 +67,7 @@ jobs:
- name: Check out code.
uses: actions/checkout@v3
- name: Linux Install
if: matrix.platform == 'ubuntu-22.04'
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get install -y bsdmainutils
- name: Script
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.venv/
__pycache__/
1 change: 1 addition & 0 deletions .pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
minversion = 7.4
addopts = -ra -q
testpaths = tests
faulthandler_timeout = 5
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Maintainers
- Nimit Kalra <[email protected]>
- Nicolai Skogheim <[email protected]>
- spacewander <[email protected]>
- Edwin Kofler <[email protected]>

Patches and Suggestions
```````````````````````
- Jonhnny Weslley
- Tobias Fendin
- LeeW
- Edwin Kofler
- timfeirg
- Niklas Schlimm
- nickl-
Expand Down
30 changes: 21 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
## Your new git-extra command should support
# Contributing

* OSX, Linux, BSD (You may need to browse their man page)<sup>*</sup>
* Bash 3.2+ (If you aren't sure, see [the Bash changelog](https://www.tldp.org/LDP/abs/html/bash2.html))
* Git 2.1+
Thanks for contributing! Please read this document before you make a PR.

<sup>*</sup>If you aren't able to test your new command on a platform,
make that clear in your PR and someone else may be able to test it on their system.
## Supported Platforms

## To submit a new command, you should
Any changes must support the following platforms:

Let's assume your new command is named `foo`.
- macOS
- Linux
- OpenBSD (You may need to browse their man page)

Your change must also be compatible with the dependency constraints that we specify in [Installation](./Installation.md). If you aren't sure if a feature is compatible, check the manual or release notes. For example, the Bash changelog is [here](https://git.savannah.gnu.org/cgit/bash.git/tree/NEWS?h=devel).

If you aren't able to test your new command on a platform, make that clear in your PR; someone else may be able to test it on their system.

## Adding a New Command

Let's say you wish to add a new command. Assuming your new command is named `foo`:

1. Write a bash script under `./bin` called `git-foo`. The script should be started with `#!/usr/bin/env bash`.
2. Read `./man/Readme.md` and write documentation for `git-foo`.
3. Don't forget to introduce it in `Commands.md`.
4. Update `./etc/git-extras-completion.zsh`. Just follow existing code.
5. (Optional) Update `./etc/bash_completion.sh`.
6. (Optional) Update `./etc/git-extras.fish`.
7. Run `./check_integrity.sh foo` to check if all done.
7. (Optional) Add a test under `./tests`.
8. Run `./check_integrity.sh foo` to check if all done.

You are welcome to open up an issue to discuss new commands or features before opening a pull request.

## Submitting a pull request

Please follow the suggestion in `./.github/PULL_REQUEST_TEMPLATE.md`.
2 changes: 0 additions & 2 deletions Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -953,8 +953,6 @@ $ git squash HEAD~3 "Work on a feature"
Populates the file matching `authors|contributors -i` with the authors of commits, according to the number of commits per author.
Opens the file in `$EDITOR` when set.
See the ["MAPPING AUTHORS" section](https://git-scm.com/docs/git-shortlog#_mapping_authors) of **git-shortlog**(1) to coalesce together commits by the same person.
Updating AUTHORS file:
Expand Down
23 changes: 15 additions & 8 deletions Installation.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# Installing git-extras
# Installation

## Dependencies

Some commands require extra dependencies which are unavailable in some platforms.
You may need to install them manually.
You may need to install them manually. They are:

Those dependencies are listed below:

* column
* bash 4.0+
* Git 2.17+
* `column`
* `awk`
* `find`
* `tput`
* cURL (only required for `git-fork`, `git-ignore-io`, `git-pull-request`)
* `ps` (only required for `git-changelog`)
* `rsync` (only required for `git-rscp`, `git-scp`)
* `xargs` (only required for `git-delete-merged-branches`, `git-force-clone`, `git-sed`, `git-scp`)

If `bash --version` shows a lower version, you need to update it.
For example, the default bash in Mac is usually too old and you may need to update it via `brew install bash`.
Expand Down Expand Up @@ -36,6 +42,7 @@ $ sudo dnf install git-extras
### openSUSE

Substitute your openSUSE version in the command below (in this case we are considering openSUSE Leap 15.2):

```bash
$ sudo zypper ar https://download.opensuse.org/repositories/devel:/tools:/scm/openSUSE_Leap_15.2/devel:tools:scm.repo
```
Expand Down Expand Up @@ -68,7 +75,6 @@ $ nix-env -i git-extras

[Abdullah](https://github.com/AWAN) has written a [Pkgfile](https://abdullah.today/ports/git-extras/Pkgfile) for his beloved [distro](https://crux.nu).


### Homebrew

```bash
Expand All @@ -77,7 +83,6 @@ $ brew install git-extras

Installing from Homebrew will not give you the option omit certain `git-extras` if they conflict with existing git aliases. To have this option, build from source.


### Arch Linux

* [git-extras](https://aur.archlinux.org/packages/git-extras/)
Expand All @@ -87,6 +92,7 @@ Installing from Homebrew will not give you the option omit certain `git-extras`

First, please install `Git for Windows 2.x` from 'https://github.com/git-for-windows/git/releases'.
Second, clone the `git-extras` repo into any folder you like.

```bash
git clone https://github.com/tj/git-extras.git
# checkout the latest tag (optional)
Expand Down Expand Up @@ -148,7 +154,7 @@ If you want to relocate the bulk of the installation but still have configuratio
files installed to the system `/etc` dir or other alternate location, you can
specify `SYSCONFDIR` in addition to `PREFIX`.

```
```sh
$ sudo make install PREFIX=/usr/local SYSCONFDIR=/etc
```

Expand All @@ -165,6 +171,7 @@ curl -sSL https://raw.githubusercontent.com/tj/git-extras/main/install.sh | sudo
## Installing as Zsh plugin

[ZInit](https://github.com/zdharma/zinit) can install git-extras by using:

```zsh
zinit ice as"program" pick"$ZPFX/bin/git-*" src"etc/git-extras-completion.zsh" make"PREFIX=$ZPFX"
zinit light tj/git-extras
Expand Down
12 changes: 0 additions & 12 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@ Go to the [Commands](Commands.md) page for basic usage and examples.

__GIT utilities__ -- repo summary, repl, changelog population, author commit percentages and more

## Test

Nowaday the continues integrations test is coming and you can access it via the `make test` easily.

The CI depends on

* `python==3.10`
* `pytest==7.4.0`
* `GitPython==3.1.36`

So the version or higher is recommended.

## Contributing

Interested in contributing? Awesome!
Expand Down
6 changes: 2 additions & 4 deletions bin/git-authors
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
LIST=false
NO_EMAIL=false
FILE=""
EDITOR=$(git var GIT_EDITOR)

while [[ $# -gt 0 ]]; do
case $1 in
Expand Down Expand Up @@ -37,10 +36,10 @@ fi
authors() {
if $NO_EMAIL; then
# email will be used to uniq authors.
git shortlog -sne | awk '{$1=""; sub(" ", ""); print}' | awk -F'<' '!x[$1]++' | awk -F'<' '!x[$2]++' \
git shortlog HEAD -sne | awk '{$1=""; sub(" ", ""); print}' | awk -F'<' '!x[$1]++' | awk -F'<' '!x[$2]++' \
| awk -F'<' '{gsub(/ +$/, "", $1); print $1}'
else
git shortlog -sne | awk '{$1=""; sub(" ", ""); print}' | awk -F'<' '!x[$1]++' | awk -F'<' '!x[$2]++'
git shortlog HEAD -sne | awk '{$1=""; sub(" ", ""); print}' | awk -F'<' '!x[$1]++' | awk -F'<' '!x[$2]++'
fi
}

Expand All @@ -52,5 +51,4 @@ if $LIST; then
authors
else
authors >> "$FILE"
test -n "$EDITOR" && $EDITOR "$FILE"
fi
3 changes: 2 additions & 1 deletion bin/git-standup
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ if [[ $in_git_repo != 0 ]]; then
## Set delimiter to newline for the loop
IFS=$'\n'
## Recursively search for git repositories
PROJECT_DIRS=$(find "$INCLUDE_LINKS" . -maxdepth "$MAXDEPTH" -mindepth 0 -name .git)
# shellcheck disable=SC2086
PROJECT_DIRS=$(find $INCLUDE_LINKS . -maxdepth "$MAXDEPTH" -mindepth 0 -name .git)

# Fetch the latest commits, if required
if [ "$FETCH_LAST_COMMIT" = true ]; then
Expand Down
Loading

0 comments on commit b99d826

Please sign in to comment.