Skip to content

Commit d4c21f1

Browse files
committed
Merge branch 'main' into hyperupcall-bats-2
2 parents 505c57b + 18d1017 commit d4c21f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+893
-243
lines changed

.github/workflows/ci.yml

Lines changed: 57 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,90 @@ on:
66
branches: [main]
77
jobs:
88
lint:
9-
runs-on: 'ubuntu-latest'
9+
runs-on: ubuntu-latest
1010
steps:
11-
- name: 'Get Changed Files'
12-
id: 'files'
13-
uses: 'masesgroup/retrieve-changed-files@v3'
14-
with:
15-
format: 'json'
16-
# a force push will cause the action above to fail. Don't do force push when people are
17-
# reviewing!
1811
- name: Check out code.
1912
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
- name: 'Get Changed Files'
16+
id: 'files'
17+
run: |
18+
CHANGED_FILES=$(git diff --name-only "${BASE_SHA:-$BEFORE_SHA}...${HEAD_SHA:-$GITHUB_REF}")
19+
echo "::notice::Changed files: $CHANGED_FILES"
20+
{
21+
echo "added_modified<<EOF"
22+
echo "$CHANGED_FILES"
23+
echo "EOF"
24+
} >> "$GITHUB_OUTPUT"
25+
env:
26+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
27+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
28+
BEFORE_SHA: "${{ github.event.before }}"
2029
- uses: 'actions/setup-go@v5'
2130
with:
2231
go-version: '1.20'
32+
- name: 'Install EditorConfig Lint'
33+
run: go install 'github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@latest'
2334
- name: 'Check EditorConfig Lint'
24-
run: |
25-
sudo apt install -y jq
26-
go install 'github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@latest'
27-
28-
readarray -t changed_files <<<"$(jq -r '.[]' <<<'${{ steps.files.outputs.added_modified }}')"
29-
~/go/bin/editorconfig-checker ${changed_files[@]}
35+
run: echo "$FILES" | xargs ~/go/bin/editorconfig-checker
36+
env:
37+
# NOTE: use env to pass the output in order to avoid possible injection attacks
38+
FILES: "${{ steps.files.outputs.added_modified }}"
39+
- name: Shellcheck
40+
run: shellcheck --severity=error bin/* ./*.sh
41+
- name: Lint and format Python with Ruff
42+
uses: astral-sh/ruff-action@v3
3043

3144
typo:
3245
runs-on: ubuntu-latest
3346
steps:
3447
- name: Check out code.
3548
uses: actions/checkout@v4
49+
- name: Install poetry
50+
run: pip install poetry
51+
- name: Set up Python
52+
uses: actions/setup-python@v5
53+
with:
54+
cache: 'poetry'
55+
cache-dependency-path: "tests/pyproject.toml"
56+
python-version-file: "tests/pyproject.toml"
57+
- name: Install dependencies
58+
run: |
59+
cd tests || exit
60+
poetry install --only dev
3661
- name: spell check
3762
run: |
38-
pip install codespell==2.2
39-
git grep --cached -l '' | grep -v -e 'History\.md' -e 'AUTHORS' -e 'man/.*\.1' -e 'man/.*\.html' | xargs codespell --ignore-words=.github/.ignore_words
63+
cd tests
64+
git grep --cached -l '' .. | \
65+
grep -v -e 'History\.md' -e 'AUTHORS' -e 'man/.*\.1' -e 'man/.*\.html' | \
66+
xargs poetry run codespell --ignore-words=../.github/.ignore_words
4067
4168
test:
4269
runs-on: ubuntu-latest
4370

4471
steps:
4572
- uses: actions/checkout@v4
46-
- name: Set up Python 3.12
73+
- name: Install poetry
74+
run: pip install poetry
75+
- name: Set up Python
4776
uses: actions/setup-python@v5
4877
with:
4978
python-version: '3.12'
79+
cache: 'poetry'
80+
cache-dependency-path: "tests/pyproject.toml"
81+
python-version-file: "tests/pyproject.toml"
5082
- name: Install Python Dependencies
5183
run: |
52-
python -m pip install --upgrade pip
53-
pip install pytest==8.1.2 GitPython==3.1.43 testpath==0.6.0
54-
- name: Setup Bats and bats libs
84+
cd tests || exit
85+
poetry install --only test
86+
- name: Setup Bats
5587
id: setup-bats
5688
uses: bats-core/bats-action@3.0.0
5789
- name: Test with Pytest
58-
run: make test
90+
run: |
91+
cd tests
92+
poetry run pytest
5993
- name: Test with Bats
6094
env:
6195
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
@@ -75,11 +109,9 @@ jobs:
75109
uses: actions/checkout@v4
76110
- name: Linux Install
77111
if: matrix.platform == 'ubuntu-latest'
78-
run: |
79-
sudo apt-get install -y bsdmainutils
112+
run: sudo apt-get install -y bsdmainutils
80113
- name: Script
81-
run: |
82-
./check_integrity.sh
114+
run: ./check_integrity.sh
83115
- name: Brew release
84116
if: matrix.platform == 'macos-latest'
85117
run: |

AUTHORS

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
git-extras is written and maintained by TJ Holowaychuk and
2-
various contributors:
3-
4-
Development Lead
5-
````````````````
6-
- TJ Holowaychuk <tj@vision-media.ca>
1+
git-extras is written and maintained by various contributors:
72

83
Maintainers
94
```````````
5+
- TJ Holowaychuk <tj@vision-media.ca>
106
- Hemanth.HM <hemanth.hm@gmail.com>
117
- Nimit Kalra <me@nimit.io>
128
- Nicolai Skogheim <nicolai.skogheim@gmail.com>
@@ -37,6 +33,7 @@ Patches and Suggestions
3733
- David Baumgold
3834
- Jan Schulz
3935
- Kenneth Reitz
36+
- Leroy
4037
- Mark Pitman
4138
- Peter Benjamin
4239
- Günther Grill
@@ -49,6 +46,7 @@ Patches and Suggestions
4946
- Ross Smith II
5047
- Yi EungJun
5148
- grindhold
49+
- wyattscarpenter
5250
- Aggelos Orfanakos
5351
- Camille Reynders
5452
- Carlos Prado
@@ -70,6 +68,7 @@ Patches and Suggestions
7068
- Justin Dugger
7169
- Nils Winkler
7270
- Philipp Klose
71+
- Raphael Boidol
7372
- Richard Russon
7473
- Sam Bostock
7574
- Vladimir Jimenez
@@ -110,6 +109,7 @@ Patches and Suggestions
110109
- Wil Moore III
111110
- William Montgomery
112111
- Ye Lin Aung
112+
- dependabot[bot]
113113
- luozexuan
114114
- roxchgt
115115
- soffolk
@@ -146,6 +146,7 @@ Patches and Suggestions
146146
- Christophe Badoit
147147
- Ciro Nunes
148148
- CleanMachine1
149+
- CodeByZach
149150
- Craig MacGregor
150151
- Dan Goodliffe
151152
- Dan Jackson
@@ -174,6 +175,7 @@ Patches and Suggestions
174175
- James Manning
175176
- James Zhu
176177
- Jan Krueger
178+
- Jared Baur
177179
- Jarod Stewart
178180
- Jason Young
179181
- Jens K. Mueller
@@ -201,7 +203,9 @@ Patches and Suggestions
201203
- Mathieu D. (MatToufoutu)
202204
- Matt
203205
- Matt Colyer
206+
- Matt Headley
204207
- Matthew Avant
208+
- Mattias Andersson
205209
- Michael Komitee
206210
- Michael Matuzak
207211
- Michele Bologna
@@ -224,6 +228,7 @@ Patches and Suggestions
224228
- Raphael Fleischlin
225229
- Rasmus Wriedt Larsen
226230
- René
231+
- Revisor
227232
- Riceball LEE
228233
- Rob Kennedy
229234
- Robin von Bülow
@@ -254,6 +259,8 @@ Patches and Suggestions
254259
- Vitaly Chikunov
255260
- Wei Lee
256261
- Wei Wu
262+
- Wen Sun
263+
- Wiktor Żurawik
257264
- Xavier Krantz
258265
- Xiaopei Li
259266
- Zeeshan Ahmed
@@ -270,7 +277,6 @@ Patches and Suggestions
270277
- sgleizes
271278
- tfendin
272279
- tiemonl
273-
- Zachary Miller
274280
- zentarul
275281
- zeroDivisible
276282
- zhiyanfoo

Commands.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- [`git clear-soft`](#git-clear-soft)
1313
- [`git coauthor`](#git-coauthor)
1414
- [`git commits-since`](#git-commits-since)
15+
- [`git continue`](#git-continue)
1516
- [`git contrib`](#git-contrib)
1617
- [`git count`](#git-count)
1718
- [`git cp`](#git-cp)
@@ -279,11 +280,20 @@ usage: git bulk [-g] ([-a]|[-w <ws-name>]) <git command>
279280
git bulk --listall
280281
```
281282

282-
Register a workspace so that `git bulk` knows about it (notice that <ws-root-directory> must be absolute path):
283+
Register a workspace so that `git bulk` knows about it (it will be registered in your `.gitconfig`):
283284

284285
```bash
285286
$ git bulk --addworkspace personal ~/workspaces/personal
286287
```
288+
289+
Notice that `<ws-root-directory>` must be an absolute path (or an environment variable pointing to an absolute path).
290+
In the case of a **single quoted environment variable**, it will be dereferenced at `git-bulk` runtime, suitable for dynamic workspaces (*e.g.*, defined in your `.bashrc`).
291+
As an illustration:
292+
293+
```bash
294+
$ git bulk --addworkspace personal '$PERSONAL_WORKSPACE'
295+
```
296+
287297
With option `--from` the URL to a single repository or a file containing multiple URLs can be added and they will be cloned directly into the workspace. Suitable for the initial setup of a multi-repo project.
288298

289299
```bash
@@ -415,9 +425,9 @@ $ git coauthor user user@email.com
415425
2 files changed, 145 insertions(+), 0 deletions(-)
416426
create mode 100644 README.md
417427
create mode 100644 CONTRIBUTING.md
418-
428+
419429
$ git log -1
420-
430+
421431
commit b62ceae2685e6ece071f3c3754e9b77fd0a35c88 (HEAD -> master)
422432
Author: user person <userperson@email.com>
423433
Date: Sat Aug 17 17:33:53 2019 -0500
@@ -1368,7 +1378,7 @@ Switched to branch 'mr/51'
13681378
With full URL, the head is fetched from a temporary remote pointing to the base URL.
13691379
13701380
``` bash
1371-
$ git mr https://gitlab.com/owner/repository/merge_requests/51
1381+
$ git mr https://gitlab.com/owner/repository/merge_requests/51
13721382
From gitlab.com:owner/repository
13731383
* [new ref] refs/merge-requests/51/head -> mr/51
13741384
Switched to branch 'mr/51'
@@ -1623,3 +1633,7 @@ Abort current revert, rebase, merge or cherry-pick, without the need to find exa
16231633
## git magic
16241634
16251635
Commits changes with a generated message.
1636+
1637+
## git continue
1638+
1639+
Continue current revert, rebase, merge or cherry-pick, without the need to find exact command in history.

History.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11

2+
7.3.0 / 2024-10-20
3+
==================
4+
5+
* Fix stripping trailing forward slash for git-get (#1172)
6+
* Change git-cp to use cleaner branch approach (#1169)
7+
* Improve warning for `git clear` (#1168)
8+
* Enhance `git-repl` (#1160)
9+
* Update some documentation that was out of sync (#1164)
10+
* Use filetimes in check_integrity (#1162)
11+
* Update git-alias.md: add brs to prevent incorrect line behavior (#1161)
12+
* Update git-bulk.md: use correct stylization in synopsis (#1163)
13+
* Update git-repl.md: typo: "let's" for "lets" (#1158)
14+
* Update instructions for the OpenSUSE installation (#1157)
15+
* Add pathspec support in `git-missing` (#1156)
16+
* feat: add rename-file command (#1149)
17+
* Update Commands.md (#1148)
18+
* fix: git-summary commit count (#1147)
19+
* tests: update dependencies (#1142)
20+
* chore(deps): bump masesgroup/retrieve-changed-files from 2 to 3 (#1144)
21+
* chore(deps): bump actions/setup-go from 4 to 5 (#1143)
22+
* ci: add dependabot update for GitHub actions (#1141)
23+
* ci: update actions (#1140)
24+
* Bump version to 7.3.0-dev (#1139)
25+
226
7.2.0 / 2024-04-21
327
==================
428

bin/git-abort

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,42 @@
11
#!/usr/bin/env bash
22

3-
gitdir="$(git rev-parse --git-dir)" || exit
4-
opfound=
5-
fcnt=
6-
for i in cherry-pick merge rebase revert; do
7-
f=${i^^}
8-
f=${f/-/_}
9-
test -f "${gitdir}/${f}_HEAD" && fcnt=1$fcnt && opfound=$i
10-
done
3+
set -euo pipefail
114

12-
if [ "${fcnt}" != 1 ]; then
13-
echo "I don't know what to abort" >&2
14-
exit 1
15-
fi
5+
function discover_op() {
6+
local gitdir
7+
# git rev-parse emits an error if not in a git repo so only need to bail out
8+
gitdir="$(git rev-parse --git-dir)" || exit
9+
local op
10+
for op in cherry_pick merge rebase revert ; do
11+
if [ -f "${gitdir}/${op^^}_HEAD" ]; then
12+
echo "${op/_/-}"
13+
fi
14+
done
15+
}
1616

17-
git "${opfound}" --abort
17+
function validate_op() {
18+
local op="$1"
19+
if [ -z "$op" ]; then
20+
echo "No active operation found" >&2
21+
exit 1
22+
fi
23+
if [[ "$(echo "$op" | wc -l)" -gt 1 ]]; then
24+
echo "Multiple active operations found: $op" >&2
25+
exit 1
26+
fi
27+
}
28+
29+
function discover_action() {
30+
local action=${1/git-/}
31+
if [ "$action" != "abort" ] && [ "$action" != "continue" ]; then
32+
echo "Invalid action: $1" >&2
33+
exit 1
34+
fi
35+
echo "$action"
36+
}
37+
38+
action=$(discover_action "$(basename "$0")")
39+
op=$(discover_op)
40+
validate_op "$op"
41+
42+
git "$op" "--$action"

0 commit comments

Comments
 (0)