Skip to content

Commit

Permalink
refactor: check for master as main branch
Browse files Browse the repository at this point in the history
Signed-off-by: Sébastien Elet <sebastien@elet.fr>
  • Loading branch information
SebastienElet committed Jan 13, 2025
1 parent 561312c commit f279bca
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
Empty file modified scripts/git_hook_assert_empty_files
100644 → 100755
Empty file.
14 changes: 8 additions & 6 deletions scripts/git_hook_assert_todoes
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#!/usr/bin/env bash

source ~/.dotfiles/scripts/git_main_branch

function git_hook_assert_todoes {
echo 'Check for todoes'
start=$(git_main_branch)
git diff origin/${start}... \
-G 'TODO' \
--name-only \
--relative \
| xargs -n1 git blame -f -n -w \
| grep "$(git config user.name)" \
| grep TODO \
| sed "s/.\{9\}//" \
| sed "s/(.*)[[:space:]]*//"
--relative |
xargs -n1 git blame -f -n -w |
grep "$(git config user.name)" |
grep TODO |
sed "s/.\{9\}//" |
sed "s/(.*)[[:space:]]*//"
}
Empty file modified scripts/git_hook_assert_typos
100644 → 100755
Empty file.
Empty file modified scripts/git_hook_detect_copy_paste
100644 → 100755
Empty file.
Empty file modified scripts/git_hook_push
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion scripts/git_main_branch
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
function git_main_branch() {
command git rev-parse --git-dir &>/dev/null || return
local ref
for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk}; do
for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,master}; do
if command git show-ref -q --verify $ref; then
echo ${ref:t}
return
Expand Down

0 comments on commit f279bca

Please sign in to comment.