<commit_before>#!/bin/bash

#------------------------------------------------------
#(0) exit if there are uncommitted or unstaged files under the specified directory
#(1) check if there are local commits and they are related with specified path
#(2) read the version number
#(3) increment the patch version number (X) in the memory and in the file
#(4) commit and push with incremented patch version number (X+1)
#(5) if commit and push worked then generate the package with the new (X+1) version number which must be unique, else exit
#------------------------------------------------------

package_name="subutai-cli"
absPath="cli"
currentDirectory=$(pwd)
# This function returns true if variable is empty, false if not empty
function isEmpty {
  if [ -z "$1" ]; then
    echo "true"
  else
    echo "false"
  fi
}


function exitIfNoCommits {
  local changelogFile=$1
  branch_name="$(git symbolic-ref HEAD 2>/dev/null)" ||
  branch_name="(unnamed branch)"     # detached HEAD
  branch_name=${branch_name##refs/heads/}
  
  # Check if there are local commits
  git_diff=$(git diff origin/$branch_name..HEAD)
  isDiffEmpty=$(isEmpty $git_diff)
  echo "isDiffEmpty: $isDiffEmpty"
  echo "Checking if there are local commits for branch: $branch_name"
  if [ $isDiffEmpty = "true" ]; then
    echo "No change is made on debian package"
    exit 0
  fi
}


function require_clean_work_directory {
  if [ -z "$(git status --porcelain .)" ]; then
    echo "This directory $currentDirectory is clean"
  else
    echo "Please commit the changes first under $currentDirectory directory!"
    exit 1
  fi 
}


function getListofCommits {
  commitList=($(git log origin/$branch_name..HEAD | grep "^commit" | awk '{split($0,a," "); print a[2] }'))
}


function checkCommitsForPath {
  getListofCommits
  for commit in "${commitList[@]}"
  do
    # Get list of files of this commit
    files=$(git diff-tree --no-commit-id --name-only -r $commit)
    # Check if there are changed files under the specified path
    changedFiles=$(echo $files | grep ^$absPath/)
    if [ -n "$changedFiles" ]; then
      isChanged="true"
      break;
    fi
  done
  if [ -n "$isChanged" -a "$isChanged" == "true" ]; then
    echo "There are changed files for $package_name"
  else
    echo "No change for path $absPath, exiting..."
    exit 0
  fi
}
<commit_msg>Fix bug inside update-version.sh script to detect changes in cli package properly<commit_after>#!/bin/bash

#------------------------------------------------------
#(0) exit if there are uncommitted or unstaged files under the specified directory
#(1) check if there are local commits and they are related with specified path
#(2) read the version number
#(3) increment the patch version number (X) in the memory and in the file
#(4) commit and push with incremented patch version number (X+1)
#(5) if commit and push worked then generate the package with the new (X+1) version number which must be unique, else exit
#------------------------------------------------------

package_name="subutai-cli"
absPath="cli"
currentDirectory=$(pwd)
# This function returns true if variable is empty, false if not empty
function isEmpty {
  if [ -z "$1" ]; then
    echo "true"
  else
    echo "false"
  fi
}


function exitIfNoCommits {
  local changelogFile=$1
  branch_name="$(git symbolic-ref HEAD 2>/dev/null)" ||
  branch_name="(unnamed branch)"     # detached HEAD
  branch_name=${branch_name##refs/heads/}
  
  # Check if there are local commits
  git_diff=$(git diff origin/$branch_name..HEAD)
  isDiffEmpty=$(isEmpty $git_diff)
  echo "isDiffEmpty: $isDiffEmpty"
  echo "Checking if there are local commits for branch: $branch_name"
  if [ $isDiffEmpty = "true" ]; then
    echo "No change is made on debian package"
    exit 0
  fi
}


function require_clean_work_directory {
  if [ -z "$(git status --porcelain .)" ]; then
    echo "This directory $currentDirectory is clean"
  else
    echo "Please commit the changes first under $currentDirectory directory!"
    exit 1
  fi 
}


function getListofCommits {
  commitList=($(git log origin/$branch_name..HEAD | grep "^commit" | awk '{split($0,a," "); print a[2] }'))
}


function checkCommitsForPath {
  getListofCommits
  for commit in "${commitList[@]}"
  do
    # Get list of files of this commit
    files=$(git diff-tree --no-commit-id --name-only -r $commit)
    # Check if there are changed files under the specified path
    changedFiles=$(echo $files | grep $absPath/)
    if [ -n "$changedFiles" ]; then
      isChanged="true"
      break;
    fi
  done
  if [ -n "$isChanged" -a "$isChanged" == "true" ]; then
    echo "There are changed files for $package_name"
  else
    echo "No change for path $absPath, exiting..."
    exit 0
  fi
}

{'fraction_non_alphanumeric': 0.14967278868482162, 'fraction_numerical': 0.006755330377876293, 'mean_word_length': 2.9882154882154883, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '788137', 'n_tokens_mistral': 1438, 'n_tokens_neox': 1387, 'n_words': 539}