0% found this document useful (0 votes)
5 views

gitlab

The document outlines an assignment for students to learn Git version control through a series of tasks involving a fictional scenario where they must save scientists trapped underground. Students are instructed to connect to a server, unpack the assignment, and complete various problems that require them to find log entries, create commits, push changes, and handle merge conflicts. The assignment emphasizes collaboration, tracking changes, and proper Git practices, with specific commands and expected outcomes provided for each task.

Uploaded by

purebredgoats
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

gitlab

The document outlines an assignment for students to learn Git version control through a series of tasks involving a fictional scenario where they must save scientists trapped underground. Students are instructed to connect to a server, unpack the assignment, and complete various problems that require them to find log entries, create commits, push changes, and handle merge conflicts. The assignment emphasizes collaboration, tracking changes, and proper Git practices, with specific commands and expected outcomes provided for each task.

Uploaded by

purebredgoats
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

DVGA14, Working with Git

Created by Freysteinn Alfredsson

“If debugging is the process of removing bugs, then programming must be the process of
putting them in.”

-Edsger Dijkstra

Instructions:

• You should do this assignment on KAU’s Hex server.


• You must handin this assignment through Hex or we will not grade it.

What you are learning:

• How to use the Git version control system.


• How to keep track of changes of your work.
• How to collaborate with others.

• How to blame the correct people for breaking the build.

Handout instructions: Connect to Hex using your favorite ssh client and unpack the assignment into
your home directory by running the following commands:

[student100@hex ~]$ tar xzvf /labs/dvga14-2024/gitlab/gitlab.tar.gz


[student100@hex ~]$ cd gitlab
[student100@hex ~/gitlab]$ make init

You must run the “make init” command to prep the lab assignment. It is imperative you do so before
starting the problems.
To handin the assignment, you must run the “make handin” command while inside the “gitlab” directory.
This command will archive a copy of your lab assignment into a file called “handin.tar.gz” in the “/labs/dvga14-
2024/.handin/gitlab/student100/” folder, where student100 refers to your Canvas account. Remember that
we automate the grading; therefore, if the handin file does not exist, you will not get a grade for the lab assign-
ment. A couple of minutes after handin you will have the result of the grading in the ”gitlab-feedback.txt”
file in you home directory.
Example of handing in your lab assignment:

[student100@hex ~]$ cd gitlab


[student100@hex ~/gitlab]$ pwd
/home/student100/gitlab/
[student100@hex ~/gitlab]$ make handin
Problem 1: Finding the log entry to save the scientists
The president has called you yet again. Today, like most other days, the fate of the world is in the
hands of a single person. (And they picked you!) In your briefing in a room full of fancy equipment and
important people, you are told that scientists have been researching underground tunnels. The team,
digging strangely close to the borders of a foreign country, is off track, and the people are starting to
fear for their lives. Unlike the movies, where it is possible to maintain lossless video contact with people
digging into the Earth’s core, communicating with the trapped team has proven much more complicated.
In fact, only a limited form of communication has been possible. Moreover, nobody seems to know where
the team is located, which has foiled all rescue missions.
However, one of the people in your briefing, Dr. Stefan Alfredsson, informs you that one of the scientists
managed to send a signal from the drill. Apparently, the reason for this crisis is that one of the
programmers added the wrong coordinates to the source code. You have now been tasked with the
critical mission of retrieving the log entry from the researcher’s git repository where the mistake was
made! The scientists agree that a researcher named Dr. Mahdi Bayrem is to blame for this ordeal.
Use the git repository named researchers1 and find Mahdi’s log entry in the repository using the ap-
propriate git command. The log entry will contain a string in the form of DVGA14{SECRET1}, where
SECRET1 is the objective of this assignment. Write the SECRET1 into the file gitlab/answers/prob-
lem1.txt.
Expected results:

[student100@hex ~/gitlab]$ cat answers/problem1.txt


SECRET1

If you like to try the drill program:

[student100@hex ~/gitlab]$ cd
[student100@hex researchers1]$ make && ./driver

To clean up the compiled files:

[student100@hex researchers1]$ make clean

Page 2
Problem 2: Saving the scientists by go back in time!
Excellent work; you have found the git commit! While you can smell the sweaty suspense in the command
room, you are not done yet. Your next task is determining what malicious command was added to the
offending commit.
Use the researchers1 git repository again to check out the commit you found from problem 1. You will
find the offending line in the commands.data file earmarked with a DVGA14{SECRET2} string. Write
the SECRET2 into the file gitlab/answers/problem2.txt.
Expected results:

[student100@hex ~/gitlab]$ cat answers/problem2.txt


SECRET2

Page 3
Problem 3: Add a commit to save the scientists
Marvelous work! While the contents of the git repository provided ample proof of foul play, you have
no time to discuss this with the suits. You are in a race against time and must fix the issue! We have
one shot at sending an updated command list to the drill before it is out of range. You have figured out
that the original command should have been R30 and that you still have time to do what you do best:
save the day!
Create a new commit in the researchers1 repository where you have to replace the malicious command
with the line “R30 DVGA14{FIXED}”. Ensure the email address in the commit is “[email protected]”,
where student100 is your username on Hex, and the commit has a fitting name with the email address.
No further action is needed. We can see the result in the repository when we grade it.

Page 4
Problem 4: Pushing the changes to really save the scientists
The scientists are still stuck underground with little food, no water, a shrinking air supply, and the
unfortunate company of one another. Now that you have found the location of the issue, it is clear that
they are very far underground but still not too far for you to update the code. The drill pulls all the
newest code directly from the central repository. Therefore, you can update the drill by pushing your
commit to the repository.
Push the commit you created in problem 3 to the “origin” external repository.

Page 5
Problem 5: Report your findings in a branch
Your Git abilities were a major success, and the president is in your debt. The command room is now
slowly starting to smell like cheap coffee, and the rambling is less stern than just a few moments ago.
However, you are still unsure whom you can trust with the information recovered from the git repository.
Therefore, you have decided to write a report in the repository before you hand it over to the correct
official.
Using the researchers2 repository, create a new branch called report. Then, add a commit with a new
file called report.txt that contains the text DVGA14{REPORT} in the newly created branch.

Page 6
Problem 6: A professional merge
Due to your professionalism, you know that working directly on the main branch is not desirable and
that professionals work in a separate git branch before merging it into the main branch when they are
done.
It is now time to merge the report branch from problem 5 with the new report.txt commit into the main
branch in the repository researchers2.

Page 7
Problem 7: The merge conflict fight
Panic has fueled the command room as the coffee smell fades away, and you start to feel an all too
familiar tense atmosphere again. Someone with access to the git central repository has managed to
overwrite the drill commands. But you will not let them take the drill without a fight!
Using the researchers3 repository, push the commits that are already there to the origin remote repos-
itory. You will get a merge conflict; resolve it using your commits.

Page 8
Problem 8: A bureaucratic reset
You did it! The drill is now updated, and the scientists have destroyed the drill’s antenna at their end
to stop more updates. You see the room dispersing in joy while you hear one of the scientists complain
while walking out of the room about how they could have just turned the network connection off instead
of destroying expensive equipment for no good reason. Suddenly, you notice that the suits have been
replaced with bureaucrats who have been droning into the room at an alarming rate. Armed with boring
documents, rules, and regulations, they force you to remove the last two commits from the repository
due to Article 5, section IV of the git repository act of 2019.
Delete the last two commits from repository4 using a hard reset. Force push the results to the remote
repository.

Page 9

You might also like