Commit 130a9da1 authored by Ari Trachtenberg's avatar Ari Trachtenberg
Browse files

Added rule of only one file committed

parent ae1debca
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -11,12 +11,10 @@ prebuild_lab_2:
        exit 1;
      fi
      
      # Check if lab0.cpp has been merged into master
      git fetch origin master  # Fetch the latest master branch
      if git ls-tree -r origin/master --name-only | grep -q 'lab0.cpp'; then
        echo "Lab 0 complete";
      else
        echo "Please have lab 0 merged first";
      # Check that only one file was checked in
      FILE_COUNT=$(git diff --name-only HEAD~1 | wc -l)
      if [ "$FILE_COUNT" -ne 1 ]; then
        echo "Error: Only one file should be committed.";
        exit 1;
      fi

+8 −7
Original line number Diff line number Diff line
@@ -5,12 +5,6 @@ prebuild_lab_3:
    - echo "Changes Detected (if any):";
    - git diff --name-only $CI_COMMIT_SHA~ $CI_COMMIT_SHA || echo "No changes found";
    - |
      # Check that only one file was checked in
      - FILE_COUNT=$(git diff --name-only HEAD~1 | wc -l)
      if [ "$FILE_COUNT" -ne 1 ]; then
        echo "Error: Only one file should be committed.";
        exit 1;
      fi
    
      # Check if lab3.cpp exists
      if [ ! -f "lab3.cpp" ]; then
@@ -18,6 +12,13 @@ prebuild_lab_3:
        exit 1;
      fi

      # Check that only one file was checked in
      FILE_COUNT=$(git diff --name-only HEAD~1 | wc -l)
      if [ "$FILE_COUNT" -ne 1 ]; then
        echo "Error: Only one file should be committed.";
        exit 1;
      fi
      
      # Check if lab2.cpp has been merged into master
      if git ls-tree -r origin/master --name-only | grep -q 'lab2.cpp'; then
        echo "Lab 2 complete";