Skip to content

Commit 7d1afd2

Browse files
authored
Merge pull request #151 from blairconrad/update-docs
Update docs
2 parents 60a8f2c + 234450c commit 7d1afd2

File tree

6 files changed

+82
-95
lines changed

6 files changed

+82
-95
lines changed

.github/workflows/release.yml

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# The way this works is the following:
22
#
3-
# The create-release job runs purely to initialize the GitHub release itself
4-
# and to output upload_url for the following job.
3+
# The create-release job runs purely to initialize the GitHub release itself.
54
#
6-
# The build-release job runs only once create-release is finished. It gets the
7-
# release upload URL from create-release job outputs, then builds the release
8-
# executables for each supported platform and attaches them as release assets
9-
# to the previously created release.
5+
# The build-man-page job runs once create-release is finished.
6+
# It builds the man page and attaches it as a release asset to the previously
7+
# created release.
108
#
11-
# The key here is that we create the release only once.
9+
# The build-release job runs only once build-man-page is finished. It downloads
10+
# the man page, then builds the release executables for each supported platform
11+
# and attaches them to the previously created release.
12+
#
13+
# The key here is that we create the release and man page only once.
1214
#
1315
# Reference:
1416
# https://eugene-babichenko.github.io/blog/2020/05/09/github-actions-cross-platform-auto-releases/
@@ -43,14 +45,12 @@ jobs:
4345
echo "GA_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
4446
echo "version is: ${{ env.GA_VERSION }}"
4547
- name: Create GitHub release
46-
# Todo: Maybe replace it with https://github.com/softprops/action-gh-release to generate a nice changelog?
48+
# Todo: Generate a nice changelog using https://github.com/softprops/action-gh-release
4749
id: release
48-
uses: actions/create-release@v1
49-
env:
50-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
uses: softprops/action-gh-release@v2
5151
with:
52+
name: ${{ env.GA_VERSION }}
5253
tag_name: ${{ env.GA_VERSION }}
53-
release_name: ${{ env.GA_VERSION }}
5454

5555
build-man-page:
5656
name: build-man-page
@@ -73,14 +73,10 @@ jobs:
7373
path: Documentation/git-absorb.1
7474
name: git-absorb.1
7575
- name: Attach man page to release
76-
uses: actions/upload-release-asset@v1.0.1
77-
env:
78-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
uses: softprops/action-gh-release@v2
7977
with:
80-
upload_url: ${{ needs.create-release.outputs.upload_url }}
81-
asset_path: Documentation/git-absorb.1
82-
asset_name: git-absorb.1
83-
asset_content_type: application/octet-stream
78+
name: ${{ needs.create-release.outputs.GA_VERSION }}
79+
files: Documentation/git-absorb.1
8480

8581
build-release:
8682
name: build-release
@@ -166,7 +162,7 @@ jobs:
166162
mkdir -p "$staging"/doc
167163
168164
cp {README.md,LICENSE.md} "$staging/"
169-
cp Documentation/{git-absorb.1,git-absorb.txt} "$staging/doc/"
165+
cp Documentation/{git-absorb.1,git-absorb.adoc} "$staging/doc/"
170166
171167
if [[ "${{ matrix.target }}" =~ .*windows.* ]]; then
172168
cp "target/${{ matrix.target }}/release/git-absorb.exe" "$staging/"
@@ -179,11 +175,7 @@ jobs:
179175
fi
180176
181177
- name: Upload release archive
182-
uses: actions/upload-release-asset@v1.0.1
183-
env:
184-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
178+
uses: softprops/action-gh-release@v2
185179
with:
186-
upload_url: ${{ needs.create-release.outputs.upload_url }}
187-
asset_path: ${{ env.ASSET }}
188-
asset_name: ${{ env.ASSET }}
189-
asset_content_type: application/octet-stream
180+
name: ${{ needs.create-release.outputs.GA_VERSION }}
181+
files: ${{ env.ASSET }}

Documentation/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
build-manpage: git-absorb.1
22

3-
git-absorb.1: git-absorb.txt
3+
git-absorb.1: git-absorb.adoc
44
$(if $(shell which a2x),,$(error "No a2x in PATH; install asciidoc."))
55
$(info Building manpage. This may take a few moments...)
6-
a2x -L -d manpage -f manpage git-absorb.txt --attribute man-version=${GA_VERSION}
6+
a2x -L -d manpage -f manpage git-absorb.adoc --attribute man-version=${GA_VERSION}
77

88
clean:
99
rm -f git-absorb.1 git-absorb.xml

Documentation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
git-absorb manual
22
=================
33

4-
This project's man page `git-absorb.1` can be generated from `git-absorb.txt`
4+
This project's man page `git-absorb.1` can be generated from `git-absorb.adoc`
55
by running `make`.
66

77
Build dependencies

Documentation/git-absorb.txt renamed to Documentation/git-absorb.adoc

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ FLAGS
5353
--force-author::
5454
Generate fixups to commits not made by you
5555

56+
-F::
57+
--one-fixup-per-commit::
58+
Only generate one fixup per commit
59+
5660
-f::
5761
--force::
5862
Skip all safety checks.
@@ -82,6 +86,10 @@ OPTIONS
8286
--base <base>::
8387
Use this commit as the base of the absorb stack
8488

89+
--gen-completions <SHELL>::
90+
Generate completions
91+
[possible values: bash, fish, nushell, zsh, powershell, elvish]
92+
8593
USAGE
8694
-----
8795

@@ -94,18 +102,14 @@ SHA of the commit it should be squashed into.
94102
95103
3. If you are satisfied with the output, `git rebase -i --autosquash` to
96104
squash the `fixup!` commits into their predecessors. You can set the
97-
[GIT_SEQUENCE_EDITOR][] environment variable if you don't need to edit
98-
the rebase TODO file.
105+
https://stackoverflow.com/a/29094904[GIT_SEQUENCE_EDITOR] environment
106+
variable if you don't need to edit the rebase TODO file.
99107
100108
4. If you are not satisfied (or if something bad happened), `git reset
101109
--soft` to the pre-absorption commit to recover your old state. (You can
102-
find the commit in question with `git reflog`.) And if you think `git
103-
absorb` is at fault, please [file an issue][].
104-
105-
.............................................................................
106-
[GIT_SEQUENCE_EDITOR]: https://stackoverflow.com/a/29094904
107-
[file an issue]: https://github.com/tummychow/git-absorb/issues/new
108-
.............................................................................
110+
find the commit in question with `git reflog`.) And if you think
111+
`git absorb` is at fault, please
112+
https://github.com/tummychow/git-absorb/issues/new[file an issue].
109113
110114
CONFIGURATION
111115
-------------
@@ -128,6 +132,49 @@ edit your local or global `.gitconfig` and add the following section:
128132
maxStack=50 # Or any other reasonable value for your project
129133
.............................................................................
130134

135+
ONE FIXUP PER FIXABLE COMMIT
136+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
137+
138+
By default, git-absorb will generate separate fixup commits for every
139+
absorbable hunk. To always generate only 1 fixup commit for all hunks that
140+
absorb into the same commit, edit your local or global `.gitconfig` and add
141+
the following section:
142+
143+
.............................................................................
144+
[absorb]
145+
oneFixupPerCommit = true
146+
.............................................................................
147+
148+
AUTO-STAGE ALL CHANGES IF NOTHING STAGED
149+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
150+
151+
By default, git-absorb will only consider files that you've staged to the index
152+
via `git add`. However, sometimes one wants to try and absorb from all changes,
153+
which would require to stage them first via `git add .`. To avoid this extra
154+
step, set
155+
156+
.............................................................................
157+
[absorb]
158+
autoStageIfNothingStaged = true
159+
.............................................................................
160+
161+
which tells git-absorb, when no changes are staged, to auto-stage them all,
162+
create fixup commits where possible, and unstage remaining changes from the
163+
index.
164+
165+
FIXUP TARGET ALWAYS SHA
166+
~~~~~~~~~~~~~~~~~~~~~~~
167+
168+
By default, git-absorb will create fixup commits with their messages pointing
169+
to the target commit's summary, and if there are duplicate summaries, will
170+
fall back to pointing to the target's SHA. Instead, can always point to the
171+
target's SHA via:
172+
173+
.............................................................................
174+
[absorb]
175+
fixupTargetAlwaysSHA = true
176+
.............................................................................
177+
131178
GENERATE FIXUPS FOR COMMITS NOT AUTHORED BY YOU
132179
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133180

README.md

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -93,63 +93,11 @@ Note: `cargo install` does not currently know how to install manpages ([cargo#27
9393

9494
For each hunk in the index, `git absorb` will check if that hunk commutes with the last commit, then the one before that, etc. When it finds a commit that does not commute with the hunk, it infers that this is the right parent commit for this change, and the hunk is turned into a fixup commit. If the hunk commutes with all commits in the range, it means we have not found a suitable parent commit for this change; a warning is displayed, and this hunk remains uncommitted in the index.
9595

96-
## Configuration
96+
## Documentation
9797

98-
### Stack size
98+
For additional information about git-absorb, including all arguments and configuration options, see [Documentation/git-absorb.adoc](Documentation/git-absorb.adoc),
99+
or the git-absorb manual page.
99100

100-
When run without `--base`, git-absorb will only search for candidate commits to fixup within a certain range (by default 10). If you get an error like this:
101-
102-
```
103-
WARN stack limit reached, limit: 10
104-
```
105-
106-
edit your local or global `.gitconfig` and add the following section
107-
108-
```ini
109-
[absorb]
110-
maxStack=50 # Or any other reasonable value for your project
111-
```
112-
113-
### Generate fixups for commits not authored by you
114-
115-
By default, git-absorb will only generate fixup commits for commits that were authored by you.
116-
Instead, use the `--force-author` flag to generate fixup commits for commits written by any author.
117-
To always have this behavior, set
118-
119-
```ini
120-
[absorb]
121-
forceAuthor = true
122-
```
123-
124-
### One fixup per fixable commit
125-
126-
By default, git-absorb will generate separate fixup commits for every absorbable hunk. Instead, can use the `-F` flag to create only 1 fixup commit for all hunks that absorb into the same commit.
127-
To always have this behavior, set
128-
129-
```ini
130-
[absorb]
131-
oneFixupPerCommit = true
132-
```
133-
134-
### Auto-stage all changes if nothing staged
135-
136-
By default, git-absorb will only consider files that you've staged to the index via `git add`. However, sometimes one wants to try and absorb from all changes, which would require to stage them first via `git add .`. To avoid this extra step, set
137-
138-
```ini
139-
[absorb]
140-
autoStageIfNothingStaged = true
141-
```
142-
143-
which tells git-absorb, when no changes are staged, to auto-stage them all, create fixup commits where possible, and unstage remaining changes from the index.
144-
145-
### Fixup target always SHA
146-
147-
By default, git-absorb will create fixup commits with their messages pointing to the target commit's summary, and if there are duplicate summaries, will fallback to pointing to the target's SHA. Instead, can always point to the target's SHA via:
148-
149-
```ini
150-
[absorb]
151-
fixupTargetAlwaysSHA = true
152-
```
153101

154102
## TODO
155103

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct Cli {
3030
#[clap(long, short = 'r')]
3131
and_rebase: bool,
3232
/// Generate completions
33-
#[clap(long, value_parser = ["bash", "fish", "nushell", "zsh", "powershell", "elvish"])]
33+
#[clap(long, value_name = "SHELL", value_parser = ["bash", "fish", "nushell", "zsh", "powershell", "elvish"])]
3434
gen_completions: Option<String>,
3535
/// Match the change against the complete file
3636
#[clap(long, short)]

0 commit comments

Comments
 (0)