Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/poetrible
Browse files Browse the repository at this point in the history
  • Loading branch information
vanpipy committed Nov 30, 2023
2 parents 45c2b56 + 2c2bd07 commit 1980978
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 15 deletions.
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.
-->
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Maintainers
- Nimit Kalra <me@nimit.io>
- Nicolai Skogheim <nicolai.skogheim@gmail.com>
- spacewander <spacewanderlzx@gmail.com>
- Edwin Kofler <edwin@kofler.dev>

Patches and Suggestions
```````````````````````
- Jonhnny Weslley
- Tobias Fendin
- LeeW
- Edwin Kofler
- timfeirg
- Niklas Schlimm
- nickl-
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ Let's say you wish to add a new command. Assuming your new command is named `foo
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`.
30 changes: 17 additions & 13 deletions bin/git-utimes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# shellcheck disable=SC2312,SC2248,SC2250,SC2064,SC2086
# shellcheck disable=SC2312
#
# Change files modification time to their last commit date
#
Expand Down Expand Up @@ -34,13 +34,6 @@ fi
if bash --help 2>&1 | grep -q -- '--norc'; then
bash_opts="${bash_opts} --norc"
fi
# sanity check, not required:
if bash --help 2>&1 | grep -q -- '--posix'; then
bash_opts="${bash_opts} --posix"
fi

prefix="$(git rev-parse --show-prefix) "
strip="${#prefix}"

status_opts=
whatchanged_opts=
Expand All @@ -55,16 +48,22 @@ if git status --help 2>&1 | grep -q -- "--ignored"; then
status_opts="${status_opts} --ignored=no"
fi

prefix="$(git rev-parse --show-prefix) "
strip="${#prefix}"

tmpfile=$(mktemp)
# shellcheck disable=SC2064
trap "rm -f '${tmpfile}'" 0

# prefix is stripped:
# shellcheck disable=SC2086
git --no-pager status --porcelain --short ${status_opts} . |
cut -c 4- >"${tmpfile}"

# prefix is not stripped:
# shellcheck disable=SC1003,SC2086,SC2248
git --no-pager whatchanged ${whatchanged_opts} --format='%ct' . |
awk $awk_flags \
awk ${awk_flags} \
-F'\t' \
-v date_flags="${date_flags}" \
-v op="${op}" \
Expand All @@ -80,7 +79,7 @@ git --no-pager whatchanged ${whatchanged_opts} --format='%ct' . |
print " echo \"+ touch -h -d@$1 $2\""
print " touch -h -d@$1 \"$2\""
} else {
printf(" t=$(date %s$1 \"+%Y%m%d%H%M.%S\")\n", date_flags)
print " t=$(date -r$1 \"+%Y%m%d%H%M.%S\")"
print " echo \"+ touch -h -t $t $2\""
print " touch -h -t $t \"$2\""
}
Expand All @@ -107,8 +106,13 @@ FILENAME==tmpfile {
next
}
seen[$2]=1
# escape quotes:
gsub(/"/, "\\\"", $2)
printf("t %s \"%s\"\n", ct, $2)
# remove double quotes and backslashes that git adds:
if (substr($2, 1, 1) == "\"" && substr($2, length($2), 1) == "\"") {
$2 = substr($2, 2, length($2) - 2)
gsub(/\\/, "", $2)
}
# escape single quotes:
gsub(/'\''/, "'\''\\'\'''\''", $2)
printf("t %s '\''%s'\''\n", ct, $2)
}
' "${tmpfile}" - | BASH_ENV='' bash ${bash_opts} /dev/stdin

0 comments on commit 1980978

Please sign in to comment.