Skip to content

Commit

Permalink
fix: #52 - manage failure of git log command if no commits in repo (#53)
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
  • Loading branch information
pylapp authored Mar 9, 2022
1 parent 89b1a2b commit 2d20ed6
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- [#32](https://github.com/Orange-OpenSource/floss-toolbox/issues/32) GitLab Auto Backup

### Bugs

- [#52](https://github.com/Orange-OpenSource/floss-toolbox/issues/52) Failure of git log if no commits

## Version 2.4.0

### Features
Expand Down
10 changes: 8 additions & 2 deletions toolbox/diver/extract-emails-from-history.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# Author: Pierre-Yves LAPERSONNE <pierreyves(dot)lapersonne(at)orange(dot)com> et al.

# Version.............: 1.0.1
# Version.............: 1.0.2
# Since...............: 06/10/2021
# Description.........: Using the Git history, provide a list of contributors
#
Expand All @@ -22,7 +22,7 @@

set -euo pipefail

VERSION="1.0.1"
VERSION="1.0.2"
SCRIPT_NAME="extract-emails-from-history"

# -------------
Expand Down Expand Up @@ -216,6 +216,12 @@ fi

touch "$git_log_file"

if [ "$( git log --oneline -5 2>/dev/null | wc -l )" -eq 0 ]; then
echo "Warning: Project '$git_based_project' is a git repository without any commit, that's weird"
CleanFiles
NormalExit
fi

git log --since=$git_log_limit > $git_log_file

if [ ! -s "$git_log_file" ]; then
Expand Down
9 changes: 7 additions & 2 deletions toolbox/diver/find-contributors-in-git-logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# Author: Pierre-Yves LAPERSONNE <pierreyves(dot)lapersonne(at)orange(dot)com> et al.

# Version.............: 1.2.0
# Version.............: 1.2.1
# Since...............: 11/05/2020
# Description.........: Looks for words (defined in dedicated file) in git logs
#
Expand All @@ -21,7 +21,7 @@
#


VERSION="1.2.0"
VERSION="1.2.1"
SCRIPT_NAME="find-contributors-in-git-logs"

# -------------
Expand Down Expand Up @@ -234,6 +234,11 @@ if [ -f $git_log_file ]; then
rm $git_log_file
fi

if [ "$( git log --oneline -5 2>/dev/null | wc -l )" -eq 0 ]; then
echo "Warning: Project '$git_based_project' is a git repository without any commit, that's weird"
NormalExit
fi

git log --since=$git_log_limit > $git_log_file

if [ ! -s "$git_log_file" ]; then
Expand Down
9 changes: 7 additions & 2 deletions toolbox/diver/find-missing-developers-in-git-commits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# Author: Pierre-Yves LAPERSONNE <pierreyves(dot)lapersonne(at)orange(dot)com> et al.

# Version.............: 1.1.0
# Version.............: 1.1.1
# Since...............: 12/05/2020
# Description.........: Looks in git commits in the DCO has been used, i.e. if commits have been signed off.
# Checks also if commits authors are defined.
Expand All @@ -21,7 +21,7 @@
# 3 - problem with a command
#

VERSION="1.1.0"
VERSION="1.1.1"
SCRIPT_NAME="find-missing-developers-in-git-commits"

# -------------
Expand Down Expand Up @@ -199,6 +199,11 @@ if [ -f $git_log_file ]; then
rm $git_log_file
fi

if [ "$( git log --oneline -5 2>/dev/null | wc -l )" -eq 0 ]; then
echo "Warning: Project '$git_based_project' is a git repository without any commit, that's weird"
NormalExit
fi

git log --since=$git_log_limit > $git_log_file

if [ ! -s "$git_log_file" ]; then
Expand Down
9 changes: 7 additions & 2 deletions toolbox/diver/list-contributors-in-history.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# Author: Pierre-Yves LAPERSONNE <pierreyves(dot)lapersonne(at)orange(dot)com> et al.

# Version.............: 1.0.0
# Version.............: 1.0.2
# Since...............: 24/02/2022
# Description.........: Using the Git history, provide a list of contributors' email addresses
#
Expand All @@ -22,7 +22,7 @@

set -euo pipefail

VERSION="1.0.1"
VERSION="1.0.2"
SCRIPT_NAME="list-contributors-in-history"

# -------------
Expand Down Expand Up @@ -197,6 +197,11 @@ fi

touch "$git_log_file"

if [ "$( git log --oneline -5 2>/dev/null | wc -l )" -eq 0 ]; then
echo "Warning: Project '$git_based_project' is a git repository without any commit, that's weird"
NormalExit
fi

git log --since=$git_log_limit > $git_log_file

if [ ! -s "$git_log_file" ]; then
Expand Down

0 comments on commit 2d20ed6

Please sign in to comment.